aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2009-06-10 00:38:48 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-06-14 23:26:20 -0400
commitd3352c9f1e8e2f2989d9686c8aa8acb4842fe75e (patch)
treeea8a18d573a45f913d9e0669a17a0b39835e55ff /drivers
parent56ac72dba5d24a477d281b985797d5e62d3f5c2e (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')
-rw-r--r--drivers/block/ps3vram.c21
-rw-r--r--drivers/ps3/ps3av_cmd.c3
-rw-r--r--drivers/video/ps3fb.c72
3 files changed, 31 insertions, 65 deletions
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index 83c14533aea5..2c2ea9cb207b 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -17,6 +17,7 @@
17#include <asm/iommu.h> 17#include <asm/iommu.h>
18#include <asm/lv1call.h> 18#include <asm/lv1call.h>
19#include <asm/ps3.h> 19#include <asm/ps3.h>
20#include <asm/ps3gpu.h>
20 21
21 22
22#define DEVICE_NAME "ps3vram" 23#define DEVICE_NAME "ps3vram"
@@ -46,8 +47,6 @@
46#define NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN 0x0000030c 47#define NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN 0x0000030c
47#define NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000104 48#define NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000104
48 49
49#define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT 0x601
50
51#define CACHE_PAGE_PRESENT 1 50#define CACHE_PAGE_PRESENT 1
52#define CACHE_PAGE_DIRTY 2 51#define CACHE_PAGE_DIRTY 2
53 52
@@ -184,13 +183,10 @@ static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev)
184 priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET; 183 priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET;
185 184
186 /* asking the HV for a blit will kick the FIFO */ 185 /* asking the HV for a blit will kick the FIFO */
187 status = lv1_gpu_context_attribute(priv->context_handle, 186 status = lv1_gpu_fb_blit(priv->context_handle, 0, 0, 0, 0);
188 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, 0,
189 0, 0, 0);
190 if (status) 187 if (status)
191 dev_err(&dev->core, 188 dev_err(&dev->core, "%s: lv1_gpu_fb_blit failed %d\n",
192 "%s: lv1_gpu_context_attribute failed %d\n", __func__, 189 __func__, status);
193 status);
194 190
195 priv->fifo_ptr = priv->fifo_base; 191 priv->fifo_ptr = priv->fifo_base;
196} 192}
@@ -206,13 +202,10 @@ static void ps3vram_fire_ring(struct ps3_system_bus_device *dev)
206 (priv->fifo_ptr - priv->fifo_base) * sizeof(u32); 202 (priv->fifo_ptr - priv->fifo_base) * sizeof(u32);
207 203
208 /* asking the HV for a blit will kick the FIFO */ 204 /* asking the HV for a blit will kick the FIFO */
209 status = lv1_gpu_context_attribute(priv->context_handle, 205 status = lv1_gpu_fb_blit(priv->context_handle, 0, 0, 0, 0);
210 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, 0,
211 0, 0, 0);
212 if (status) 206 if (status)
213 dev_err(&dev->core, 207 dev_err(&dev->core, "%s: lv1_gpu_fb_blit failed %d\n",
214 "%s: lv1_gpu_context_attribute failed %d\n", __func__, 208 __func__, status);
215 status);
216 209
217 if ((priv->fifo_ptr - priv->fifo_base) * sizeof(u32) > 210 if ((priv->fifo_ptr - priv->fifo_base) * sizeof(u32) >
218 FIFO_SIZE - 1024) { 211 FIFO_SIZE - 1024) {
diff --git a/drivers/ps3/ps3av_cmd.c b/drivers/ps3/ps3av_cmd.c
index 716596e8e5b0..f555fedd5073 100644
--- a/drivers/ps3/ps3av_cmd.c
+++ b/drivers/ps3/ps3av_cmd.c
@@ -21,9 +21,10 @@
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24
24#include <asm/ps3av.h> 25#include <asm/ps3av.h>
25#include <asm/ps3fb.h>
26#include <asm/ps3.h> 26#include <asm/ps3.h>
27#include <asm/ps3gpu.h>
27 28
28#include "vuart.h" 29#include "vuart.h"
29 30
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;