diff options
author | Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> | 2009-06-10 00:38:48 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-14 23:26:20 -0400 |
commit | d3352c9f1e8e2f2989d9686c8aa8acb4842fe75e (patch) | |
tree | ea8a18d573a45f913d9e0669a17a0b39835e55ff /drivers/video/ps3fb.c | |
parent | 56ac72dba5d24a477d281b985797d5e62d3f5c2e (diff) |
ps3fb/vram: Extract common GPU stuff into <asm/ps3gpu.h>
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: linux-fbdev-devel@lists.sourceforge.net
Cc: Jim Paris <jim@jtan.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/video/ps3fb.c')
-rw-r--r-- | drivers/video/ps3fb.c | 72 |
1 files changed, 22 insertions, 50 deletions
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index a61c1d89bd87..13c876c6e32c 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -37,21 +37,11 @@ | |||
37 | #include <asm/ps3av.h> | 37 | #include <asm/ps3av.h> |
38 | #include <asm/ps3fb.h> | 38 | #include <asm/ps3fb.h> |
39 | #include <asm/ps3.h> | 39 | #include <asm/ps3.h> |
40 | #include <asm/ps3gpu.h> | ||
40 | 41 | ||
41 | 42 | ||
42 | #define DEVICE_NAME "ps3fb" | 43 | #define DEVICE_NAME "ps3fb" |
43 | 44 | ||
44 | #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC 0x101 | ||
45 | #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP 0x102 | ||
46 | #define L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP 0x600 | ||
47 | #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT 0x601 | ||
48 | #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT_SYNC 0x602 | ||
49 | |||
50 | #define L1GPU_FB_BLIT_WAIT_FOR_COMPLETION (1ULL << 32) | ||
51 | |||
52 | #define L1GPU_DISPLAY_SYNC_HSYNC 1 | ||
53 | #define L1GPU_DISPLAY_SYNC_VSYNC 2 | ||
54 | |||
55 | #define GPU_CMD_BUF_SIZE (2 * 1024 * 1024) | 45 | #define GPU_CMD_BUF_SIZE (2 * 1024 * 1024) |
56 | #define GPU_FB_START (64 * 1024) | 46 | #define GPU_FB_START (64 * 1024) |
57 | #define GPU_IOIF (0x0d000000UL) | 47 | #define GPU_IOIF (0x0d000000UL) |
@@ -463,33 +453,27 @@ static void ps3fb_sync_image(struct device *dev, u64 frame_offset, | |||
463 | src_offset += GPU_FB_START; | 453 | src_offset += GPU_FB_START; |
464 | 454 | ||
465 | mutex_lock(&ps3_gpu_mutex); | 455 | mutex_lock(&ps3_gpu_mutex); |
466 | status = lv1_gpu_context_attribute(ps3fb.context_handle, | 456 | status = lv1_gpu_fb_blit(ps3fb.context_handle, dst_offset, |
467 | L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, | 457 | GPU_IOIF + src_offset, |
468 | dst_offset, GPU_IOIF + src_offset, | 458 | L1GPU_FB_BLIT_WAIT_FOR_COMPLETION | |
469 | L1GPU_FB_BLIT_WAIT_FOR_COMPLETION | | 459 | (width << 16) | height, |
470 | (width << 16) | height, | 460 | line_length); |
471 | line_length); | ||
472 | mutex_unlock(&ps3_gpu_mutex); | 461 | mutex_unlock(&ps3_gpu_mutex); |
473 | 462 | ||
474 | if (status) | 463 | if (status) |
475 | dev_err(dev, | 464 | dev_err(dev, "%s: lv1_gpu_fb_blit failed: %d\n", __func__, |
476 | "%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n", | 465 | status); |
477 | __func__, status); | ||
478 | #ifdef HEAD_A | 466 | #ifdef HEAD_A |
479 | status = lv1_gpu_context_attribute(ps3fb.context_handle, | 467 | status = lv1_gpu_display_flip(ps3fb.context_handle, 0, frame_offset); |
480 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, | ||
481 | 0, frame_offset, 0, 0); | ||
482 | if (status) | 468 | if (status) |
483 | dev_err(dev, "%s: lv1_gpu_context_attribute FLIP failed: %d\n", | 469 | dev_err(dev, "%s: lv1_gpu_display_flip failed: %d\n", __func__, |
484 | __func__, status); | 470 | status); |
485 | #endif | 471 | #endif |
486 | #ifdef HEAD_B | 472 | #ifdef HEAD_B |
487 | status = lv1_gpu_context_attribute(ps3fb.context_handle, | 473 | status = lv1_gpu_display_flip(ps3fb.context_handle, 1, frame_offset); |
488 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, | ||
489 | 1, frame_offset, 0, 0); | ||
490 | if (status) | 474 | if (status) |
491 | dev_err(dev, "%s: lv1_gpu_context_attribute FLIP failed: %d\n", | 475 | dev_err(dev, "%s: lv1_gpu_display_flip failed: %d\n", __func__, |
492 | __func__, status); | 476 | status); |
493 | #endif | 477 | #endif |
494 | } | 478 | } |
495 | 479 | ||
@@ -1020,27 +1004,18 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1020 | init_waitqueue_head(&ps3fb.wait_vsync); | 1004 | init_waitqueue_head(&ps3fb.wait_vsync); |
1021 | 1005 | ||
1022 | #ifdef HEAD_A | 1006 | #ifdef HEAD_A |
1023 | status = lv1_gpu_context_attribute(0x0, | 1007 | status = lv1_gpu_display_sync(0x0, 0, L1GPU_DISPLAY_SYNC_VSYNC); |
1024 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC, | ||
1025 | 0, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0); | ||
1026 | if (status) { | 1008 | if (status) { |
1027 | dev_err(&dev->core, | 1009 | dev_err(&dev->core, "%s: lv1_gpu_display_sync failed: %d\n", |
1028 | "%s: lv1_gpu_context_attribute DISPLAY_SYNC failed: " | ||
1029 | "%d\n", | ||
1030 | __func__, status); | 1010 | __func__, status); |
1031 | retval = -ENODEV; | 1011 | retval = -ENODEV; |
1032 | goto err_close_device; | 1012 | goto err_close_device; |
1033 | } | 1013 | } |
1034 | #endif | 1014 | #endif |
1035 | #ifdef HEAD_B | 1015 | #ifdef HEAD_B |
1036 | status = lv1_gpu_context_attribute(0x0, | 1016 | status = lv1_gpu_display_sync(0x0, 1, L1GPU_DISPLAY_SYNC_VSYNC); |
1037 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC, | ||
1038 | 1, L1GPU_DISPLAY_SYNC_VSYNC, 0, 0); | ||
1039 | |||
1040 | if (status) { | 1017 | if (status) { |
1041 | dev_err(&dev->core, | 1018 | dev_err(&dev->core, "%s: lv1_gpu_display_sync failed: %d\n", |
1042 | "%s: lv1_gpu_context_attribute DISPLAY_SYNC failed: " | ||
1043 | "%d\n", | ||
1044 | __func__, status); | 1019 | __func__, status); |
1045 | retval = -ENODEV; | 1020 | retval = -ENODEV; |
1046 | goto err_close_device; | 1021 | goto err_close_device; |
@@ -1070,7 +1045,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1070 | &lpar_reports, &lpar_reports_size); | 1045 | &lpar_reports, &lpar_reports_size); |
1071 | if (status) { | 1046 | if (status) { |
1072 | dev_err(&dev->core, | 1047 | dev_err(&dev->core, |
1073 | "%s: lv1_gpu_context_attribute failed: %d\n", __func__, | 1048 | "%s: lv1_gpu_context_allocate failed: %d\n", __func__, |
1074 | status); | 1049 | status); |
1075 | goto err_gpu_memory_free; | 1050 | goto err_gpu_memory_free; |
1076 | } | 1051 | } |
@@ -1137,13 +1112,10 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1137 | ps3fb_videomemory.address, GPU_IOIF, xdr_lpar, | 1112 | ps3fb_videomemory.address, GPU_IOIF, xdr_lpar, |
1138 | ps3fb_videomemory.size); | 1113 | ps3fb_videomemory.size); |
1139 | 1114 | ||
1140 | status = lv1_gpu_context_attribute(ps3fb.context_handle, | 1115 | status = lv1_gpu_fb_setup(ps3fb.context_handle, xdr_lpar, |
1141 | L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP, | 1116 | GPU_CMD_BUF_SIZE, GPU_IOIF); |
1142 | xdr_lpar, GPU_CMD_BUF_SIZE, | ||
1143 | GPU_IOIF, 0); | ||
1144 | if (status) { | 1117 | if (status) { |
1145 | dev_err(&dev->core, | 1118 | dev_err(&dev->core, "%s: lv1_gpu_fb_setup failed: %d\n", |
1146 | "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", | ||
1147 | __func__, status); | 1119 | __func__, status); |
1148 | retval = -ENXIO; | 1120 | retval = -ENXIO; |
1149 | goto err_context_unmap; | 1121 | goto err_context_unmap; |