Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] powerpc: Fix platinumfb for some modes

The platinumfb driver used only on some powermacs has an issue with some
video modes & limited VRAM. This patch fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Benjamin Herrenschmidt and committed by
Paul Mackerras
9cf84d7c f75225d0

+11 -5
+8 -4
drivers/video/platinumfb.c
··· 138 138 139 139 init = platinum_reg_init[pinfo->vmode-1]; 140 140 141 - if (pinfo->vmode == 13 && pinfo->cmode > 0) 142 - offset = 0x10; 141 + if ((pinfo->vmode == VMODE_832_624_75) && (pinfo->cmode > CMODE_8)) 142 + offset = 0x10; 143 + 143 144 info->screen_base = pinfo->frame_buffer + init->fb_offset + offset; 144 145 info->fix.smem_start = (pinfo->frame_buffer_phys) + init->fb_offset + offset; 145 146 info->fix.visual = (pinfo->cmode == CMODE_8) ? 146 147 FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; 147 - info->fix.line_length = vmode_attrs[pinfo->vmode-1].hres * (1<<pinfo->cmode) + offset; 148 + info->fix.line_length = vmode_attrs[pinfo->vmode-1].hres * (1<<pinfo->cmode) 149 + + offset; 148 150 printk("line_length: %x\n", info->fix.line_length); 149 151 return 0; 150 152 } ··· 223 221 static inline int platinum_vram_reqd(int video_mode, int color_mode) 224 222 { 225 223 return vmode_attrs[video_mode-1].vres * 226 - (vmode_attrs[video_mode-1].hres * (1<<color_mode) + 0x20) +0x1000; 224 + (vmode_attrs[video_mode-1].hres * (1<<color_mode) + 225 + ((video_mode == VMODE_832_624_75) && 226 + (color_mode > CMODE_8)) ? 0x10 : 0x20) + 0x1000; 227 227 } 228 228 229 229 #define STORE_D2(a, d) { \
+3 -1
drivers/video/platinumfb.h
··· 158 158 /* 832x624, 75Hz (13) */ 159 159 static struct platinum_regvals platinum_reg_init_13 = { 160 160 0x70, 161 - { 864, 1680, 3360 }, /* MacOS does 1680 instead of 1696 to fit 16bpp in 1MB */ 161 + { 864, 1680, 3344 }, /* MacOS does 1680 instead of 1696 to fit 16bpp in 1MB, 162 + * and we use 3344 instead of 3360 to fit in 2Mb 163 + */ 162 164 { 0xff0, 4, 0, 0, 0, 0, 0x299, 0, 163 165 0, 0x21e, 0x120, 0x10, 0x23f, 0x1f, 0x25, 0x37, 164 166 0x8a, 0x22a, 0x23e, 0x536, 0x534, 4, 9, 0x52,