Skip to contentSkip to conversation

Framebuffer: Fix 16bpp colour output in Dreamcast pvr2fb

PATCH In review Adrian McMenamin 1 participant 2 messages Jul 28, 2007 1 message not in the archive Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Framebuffer: Fix 16bpp colour output in Dreamcast pvr2fb

Tony,

This patch - on top of your others - fixes the colour output for 16bpp RGB565 output in the Dreamcast - it was a simple out by one error in the bit shift.

Still looking at the 24bpp and 32bpp issues.

Signed-off by: Adrian McMenamin <[email protected]>

drivers/video/pvr2fb.c +1 -1
index 3ac32f3..383e87e 100644
@@ -330,27 +331,28 @@ static int pvr2fb_setcolreg(unsigned int regno, unsigned int red,
 	    case 16: /* RGB 565 */
 		tmp =  (red   & 0xf800)       |
 		      ((green & 0xfc00) >> 5) |
-		      ((blue  & 0xf800) >> 11);
+		      ((blue  & 0xf800) >> 10);
 
 		pvr2fb_set_pal_entry(par, regno, tmp);
#2 lore raw
In reply to a message not in the archive
Quoted 7 lines · Ondrej Zajicek
Quoted 5 lines · Adrian McMenamin

Tony,

This patch - on top of your others - fixes the colour output for 16bpp RGB565 output in the Dreamcast - it was a simple out by one error in the bit shift.

Quoted 11 lines

drivers/video/pvr2fb.c static int pvr2fb_setcolreg(unsigned int regno, unsigned int red, · line 334

Quoted 6 lines
drivers/video/pvr2fb.c +1 -1
@@ -330,27 +331,28 @@ static int pvr2fb_setcolreg(unsigned int regno, unsigned int red,
          case 16: /* RGB 565 */
              tmp =  (red   & 0xf800)       |
                    ((green & 0xfc00) >> 5) |
-                   ((blue  & 0xf800) >> 11);
+                   ((blue  & 0xf800) >> 10);

This mixes lsb of green with msb of blue. If you want RGB 565, then >> 11 is correct. If you want RGB 555, green should be anded with 0xf800.

You are, of course, quite right, which makes it all the more the strange that it appeared to fix the problem. Back to the drawing board then.