ps3fb: Update for firmware 2.10

ps3fb: Update for firmware 2.10

As of PS3 firmware version 2.10, the GPU command buffer size must be at least 2
MiB large. Since we use only a small part of the GPU command buffer and don't
want to waste precious XDR memory, move the GPU command buffer back to the
start of the XDR memory reserved for ps3fb and let the unused part overlap with
the actual frame buffer.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Geert Uytterhoeven and committed by Linus Torvalds 9ac67a35 c7eeae73

+18 -6
+18 -6
drivers/video/ps3fb.c
··· 51 #define L1GPU_DISPLAY_SYNC_HSYNC 1 52 #define L1GPU_DISPLAY_SYNC_VSYNC 2 53 54 - #define GPU_CMD_BUF_SIZE (64 * 1024) 55 #define GPU_IOIF (0x0d000000UL) 56 #define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) 57 #define GPU_MAX_LINE_LENGTH (65536 - 64) ··· 407 if (src_line_length != dst_line_length) 408 line_length |= (u64)src_line_length << 32; 409 410 status = lv1_gpu_context_attribute(ps3fb.context_handle, 411 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, 412 dst_offset, GPU_IOIF + src_offset, ··· 978 979 status = lv1_gpu_context_attribute(ps3fb.context_handle, 980 L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP, 981 - xdr_lpar + ps3fb.xdr_size, 982 - GPU_CMD_BUF_SIZE, 983 - GPU_IOIF + ps3fb.xdr_size, 0); 984 if (status) { 985 dev_err(dev, 986 "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", ··· 1062 struct task_struct *task; 1063 unsigned long max_ps3fb_size; 1064 1065 status = ps3_open_hv_device(dev); 1066 if (status) { 1067 dev_err(&dev->core, "%s: ps3_open_hv_device failed\n", ··· 1137 /* Clear memory to prevent kernel info leakage into userspace */ 1138 memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size); 1139 1140 - /* The GPU command buffer is at the end of video memory */ 1141 - ps3fb.xdr_size = ps3fb_videomemory.size - GPU_CMD_BUF_SIZE; 1142 1143 retval = ps3fb_xdr_settings(xdr_lpar, &dev->core); 1144 if (retval)
··· 51 #define L1GPU_DISPLAY_SYNC_HSYNC 1 52 #define L1GPU_DISPLAY_SYNC_VSYNC 2 53 54 + #define GPU_CMD_BUF_SIZE (2 * 1024 * 1024) 55 + #define GPU_FB_START (64 * 1024) 56 #define GPU_IOIF (0x0d000000UL) 57 #define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) 58 #define GPU_MAX_LINE_LENGTH (65536 - 64) ··· 406 if (src_line_length != dst_line_length) 407 line_length |= (u64)src_line_length << 32; 408 409 + src_offset += GPU_FB_START; 410 status = lv1_gpu_context_attribute(ps3fb.context_handle, 411 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, 412 dst_offset, GPU_IOIF + src_offset, ··· 976 977 status = lv1_gpu_context_attribute(ps3fb.context_handle, 978 L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP, 979 + xdr_lpar, GPU_CMD_BUF_SIZE, 980 + GPU_IOIF, 0); 981 if (status) { 982 dev_err(dev, 983 "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", ··· 1061 struct task_struct *task; 1062 unsigned long max_ps3fb_size; 1063 1064 + if (ps3fb_videomemory.size < GPU_CMD_BUF_SIZE) { 1065 + dev_err(&dev->core, "%s: Not enough video memory\n", __func__); 1066 + return -ENOMEM; 1067 + } 1068 + 1069 status = ps3_open_hv_device(dev); 1070 if (status) { 1071 dev_err(&dev->core, "%s: ps3_open_hv_device failed\n", ··· 1131 /* Clear memory to prevent kernel info leakage into userspace */ 1132 memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size); 1133 1134 + /* 1135 + * The GPU command buffer is at the start of video memory 1136 + * As we don't use the full command buffer, we can put the actual 1137 + * frame buffer at offset GPU_FB_START and save some precious XDR 1138 + * memory 1139 + */ 1140 + ps3fb.xdr_ea += GPU_FB_START; 1141 + ps3fb.xdr_size = ps3fb_videomemory.size - GPU_FB_START; 1142 1143 retval = ps3fb_xdr_settings(xdr_lpar, &dev->core); 1144 if (retval)