Skip to content

Commit 14ad68c

Browse files
committed
Store palette info where GPU can see it, so 8bpp modes can work. Requires updated start.elf to work properly
1 parent 4f574f9 commit 14ad68c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/video/bcm2708_fb.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct fbinfo_s {
4848
u32 xoffset, yoffset;
4949
u32 base;
5050
u32 screen_size;
51+
u16 cmap[256];
5152
};
5253

5354
struct bcm2708_fb {
@@ -266,18 +267,31 @@ static inline u32 convert_bitfield(int val, struct fb_bitfield *bf)
266267
return (val >> (16 - bf->length) & mask) << bf->offset;
267268
}
268269

270+
269271
static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red,
270272
unsigned int green, unsigned int blue,
271273
unsigned int transp, struct fb_info *info)
272274
{
273275
struct bcm2708_fb *fb = to_bcm2708(info);
274276

277+
/*pr_info("BCM2708FB: setcolreg %d:(%02x,%02x,%02x,%02x) %x\n", regno, red, green, blue, transp, fb->fb.fix.visual);*/
275278
if (regno < 16)
276279
fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) |
277280
convert_bitfield(blue, &fb->fb.var.blue) |
278281
convert_bitfield(green, &fb->fb.var.green) |
279282
convert_bitfield(red, &fb->fb.var.red);
280283

284+
if (regno < 256) {
285+
/* blue [0:4], green [5:10], red [11:15] */
286+
fb->info->cmap[regno] = ((red >> (16-5)) & 0x1f) << 11 |
287+
((green >> (16-6)) & 0x3f) << 5 |
288+
((blue >> (16-5)) & 0x1f) << 0;
289+
}
290+
/* Hack: we need to tell GPU the palette has changed, but currently bcm2708_fb_set_par takes noticable time when called for every (256) colour */
291+
/* So just call it for what looks like the last colour in a list for now. */
292+
if (regno == 15 || regno == 255)
293+
bcm2708_fb_set_par(info);
294+
281295
return regno > 255;
282296
}
283297

0 commit comments

Comments
 (0)