The current handling of the 16bpp mode hardcodes the bit arrangement for 16bpp mode to be of the RGB565 type, but my system (ARM PL110 on the Integrator/CP) has RGBA5551 arrangement and will give wrong colors. This patch makes the code actually respect the bit sizes and offset arrangement from the screen configuration (in turn read from the modes configuration file and set by fbset).
Signed-off-by: Linus Walleij <[email protected]> --- miscutils/fbsplash.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c index 988439b..a9581a8 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c @@ -166,10 +166,17 @@ static unsigned fb_pixel_value(unsigned r, unsigned g, unsigned b) return r + g + b; } if (G.bytes_per_pixel == 2) { - r = (r & 0xf8) << 8; // 5-bit red - g = (g & 0xfc) << 3; // 6-bit green - b = b >> 3; // 5-bit blue - return r + g + b; + /* First shift out unused bits */ + r &= 0xff; + g &= 0xff; + b &= 0xff; + r >>= (8 - G.scr_var.red.length); + g >>= (8 - G.scr_var.green.length); + b >>= (8 - G.scr_var.blue.length); + /* Then shift the remaining bits to their offset */ + return (r << G.scr_var.red.offset) + + (g << G.scr_var.green.offset) + + (b << G.scr_var.blue.offset); } // RGB 888 return b + (g << 8) + (r << 16); -- 1.7.10.4 _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
