diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/ps3fb.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 9c56c492a693..614586557cd4 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -51,7 +51,8 @@ | |||
51 | #define L1GPU_DISPLAY_SYNC_HSYNC 1 | 51 | #define L1GPU_DISPLAY_SYNC_HSYNC 1 |
52 | #define L1GPU_DISPLAY_SYNC_VSYNC 2 | 52 | #define L1GPU_DISPLAY_SYNC_VSYNC 2 |
53 | 53 | ||
54 | #define GPU_CMD_BUF_SIZE (64 * 1024) | 54 | #define GPU_CMD_BUF_SIZE (2 * 1024 * 1024) |
55 | #define GPU_FB_START (64 * 1024) | ||
55 | #define GPU_IOIF (0x0d000000UL) | 56 | #define GPU_IOIF (0x0d000000UL) |
56 | #define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) | 57 | #define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) |
57 | #define GPU_MAX_LINE_LENGTH (65536 - 64) | 58 | #define GPU_MAX_LINE_LENGTH (65536 - 64) |
@@ -406,6 +407,7 @@ static void ps3fb_sync_image(struct device *dev, u64 frame_offset, | |||
406 | if (src_line_length != dst_line_length) | 407 | if (src_line_length != dst_line_length) |
407 | line_length |= (u64)src_line_length << 32; | 408 | line_length |= (u64)src_line_length << 32; |
408 | 409 | ||
410 | src_offset += GPU_FB_START; | ||
409 | status = lv1_gpu_context_attribute(ps3fb.context_handle, | 411 | status = lv1_gpu_context_attribute(ps3fb.context_handle, |
410 | L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, | 412 | L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, |
411 | dst_offset, GPU_IOIF + src_offset, | 413 | dst_offset, GPU_IOIF + src_offset, |
@@ -976,9 +978,8 @@ static int ps3fb_xdr_settings(u64 xdr_lpar, struct device *dev) | |||
976 | 978 | ||
977 | status = lv1_gpu_context_attribute(ps3fb.context_handle, | 979 | status = lv1_gpu_context_attribute(ps3fb.context_handle, |
978 | L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP, | 980 | L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP, |
979 | xdr_lpar + ps3fb.xdr_size, | 981 | xdr_lpar, GPU_CMD_BUF_SIZE, |
980 | GPU_CMD_BUF_SIZE, | 982 | GPU_IOIF, 0); |
981 | GPU_IOIF + ps3fb.xdr_size, 0); | ||
982 | if (status) { | 983 | if (status) { |
983 | dev_err(dev, | 984 | dev_err(dev, |
984 | "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", | 985 | "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", |
@@ -1061,6 +1062,11 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1061 | struct task_struct *task; | 1062 | struct task_struct *task; |
1062 | unsigned long max_ps3fb_size; | 1063 | unsigned long max_ps3fb_size; |
1063 | 1064 | ||
1065 | if (ps3fb_videomemory.size < GPU_CMD_BUF_SIZE) { | ||
1066 | dev_err(&dev->core, "%s: Not enough video memory\n", __func__); | ||
1067 | return -ENOMEM; | ||
1068 | } | ||
1069 | |||
1064 | status = ps3_open_hv_device(dev); | 1070 | status = ps3_open_hv_device(dev); |
1065 | if (status) { | 1071 | if (status) { |
1066 | dev_err(&dev->core, "%s: ps3_open_hv_device failed\n", | 1072 | dev_err(&dev->core, "%s: ps3_open_hv_device failed\n", |
@@ -1131,8 +1137,14 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1131 | /* Clear memory to prevent kernel info leakage into userspace */ | 1137 | /* Clear memory to prevent kernel info leakage into userspace */ |
1132 | memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size); | 1138 | memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size); |
1133 | 1139 | ||
1134 | /* The GPU command buffer is at the end of video memory */ | 1140 | /* |
1135 | ps3fb.xdr_size = ps3fb_videomemory.size - GPU_CMD_BUF_SIZE; | 1141 | * The GPU command buffer is at the start of video memory |
1142 | * As we don't use the full command buffer, we can put the actual | ||
1143 | * frame buffer at offset GPU_FB_START and save some precious XDR | ||
1144 | * memory | ||
1145 | */ | ||
1146 | ps3fb.xdr_ea += GPU_FB_START; | ||
1147 | ps3fb.xdr_size = ps3fb_videomemory.size - GPU_FB_START; | ||
1136 | 1148 | ||
1137 | retval = ps3fb_xdr_settings(xdr_lpar, &dev->core); | 1149 | retval = ps3fb_xdr_settings(xdr_lpar, &dev->core); |
1138 | if (retval) | 1150 | if (retval) |