Skip to content

Instantly share code, notes, and snippets.

@popcornmix
Created July 6, 2015 16:45
Show Gist options
  • Save popcornmix/e019aaac1b4292ce770c to your computer and use it in GitHub Desktop.
Save popcornmix/e019aaac1b4292ce770c to your computer and use it in GitHub Desktop.
diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c
index ee10b9e..98eb8b9 100644
--- a/drivers/video/fbdev/bcm2708_fb.c
+++ b/drivers/video/fbdev/bcm2708_fb.c
@@ -360,10 +360,10 @@ static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red,
/*print_debug("BCM2708FB: setcolreg %d:(%02x,%02x,%02x,%02x) %x\n", regno, red, green, blue, transp, fb->fb.fix.visual);*/
if (fb->fb.var.bits_per_pixel <= 8) {
if (regno < 256) {
- /* blue [0:4], green [5:10], red [11:15] */
- fb->gpu_cmap[regno] = ((red >> (16-5)) & 0x1f) << 11 |
- ((green >> (16-6)) & 0x3f) << 5 |
- ((blue >> (16-5)) & 0x1f) << 0;
+ /* blue [23:16], green [15:8], red [7:0] */
+ fb->gpu_cmap[regno] = ((red >> 8) & 0xff) << 0 |
+ ((green >> 8) & 0xff) << 8 |
+ ((blue >> 8) & 0xff) << 16;
}
/* 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 */
/* So just call it for what looks like the last colour in a list for now. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment