Skip to contentSkip to conversation

Colour management

Question Alexander Kern 1 participant 1 message Jul 31, 2004 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

Hello,

here is a very good patch, that correct fbi with 16 bpp(565) mode. Tested on Mach64. Please commit it.

Regards
Alex Kern

---------- Weitergeleitete Nachricht ----------

Subject: [Linux-fbdev-devel] Re: [Question] Colour management
Date: Sonntag, 1. August 2004 00:10
From: Ville Syrjälä <[email protected]>
To: [email protected]

Quoted 8 lines · Alexander Kern

Hallo Tony,

can you explain the deep mining of fb_setcolreg. Background, I observe wrong palette using in 15 and 16 bpp modes, but can not understand, what is the right approach. In both cases from penguin logo I can see only contour in honey yellow and blue vertical string jsimmons, pretty scury ;-) The rest is black! The simple text or ncurses applications have always right colours. Additionally and only by 16bpp fbi shows blurry images.

I just had a look at the fbi code and it's wrong. It was initializing the clut to 555. The attached patch fixes the problem.

I think the boot logo code is broken. No, I haven't actually looked at it but everything else works... Or does it work on some other directcolor hw?

--
Ville Syrjälä
[email protected]
http://www.sci.fi/~syrjala/

-------------------------------------------------------

fbi.c +17 -8
@@ -760,12 +760,19 @@
 }
 
 static void
-linear_palette(int bit)
+linear_palette(int r, int g, int b)
 {
-    int i, size = 256 >> (8 - bit);
-    
+    int i, size;
+
+    size = 256 >> (8 - r);
+    for (i = 0; i < size; i++)
+	red[i] = calc_gamma(i,size);
+    size = 256 >> (8 - g);
     for (i = 0; i < size; i++)
-        red[i] = green[i] = blue[i] = calc_gamma(i,size);
+	green[i] = calc_gamma(i,size);
+    size = 256 >> (8 - b);
+    for (i = 0; i < size; i++)
+	blue[i] = calc_gamma(i,size);
 }
 
 static void
@@ -1391,21 +1398,23 @@
 	break;
     case 15:
     case 16:
-        if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
-            linear_palette(5);
 	if (fb_var.green.length == 5) {
+	    if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
+		linear_palette(5,5,5);
 	    lut_init(15);
 	} else {
+	    if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
+		linear_palette(5,6,5);
 	    lut_init(16);
 	}
 	break;
     case 24:
         if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
-            linear_palette(8);
+            linear_palette(8,8,8);
 	break;
     case 32:
         if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
-            linear_palette(8);
+            linear_palette(8,8,8);
 	lut_init(24);
 	break;
     default: