linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <syrjala@sci.fi>
To: linux-fbdev-devel@lists.sourceforge.net
Subject: Re: [Question] Colour management
Date: Sun, 1 Aug 2004 01:10:14 +0300	[thread overview]
Message-ID: <20040731221014.GA17669@sci.fi> (raw)
In-Reply-To: <200407302012.36325.alex.kern@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

On Fri, Jul 30, 2004 at 08:12:36PM +0200, Alexander Kern wrote:
> 
> 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ä
syrjala@sci.fi
http://www.sci.fi/~syrjala/

[-- Attachment #2: fbi_directcolor_565_fix.patch --]
[-- Type: text/plain, Size: 1345 bytes --]

--- fbi-1.31/fbi.c	2004-02-22 14:24:29.000000000 +0200
+++ fbi-1.31/fbi.c	2004-08-01 00:57:45.375251160 +0300
@@ -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:

  parent reply	other threads:[~2004-07-31 22:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-22 18:49 [PATCH] atyfb: vblank irq support Ville Syrjälä
2004-07-24 23:12 ` Alexander Kern
2004-07-25  0:03   ` Antonino A. Daplas
2004-07-25 18:36     ` Alexander Kern
2004-07-25 22:47       ` Antonino A. Daplas
2004-07-30 18:12         ` [Question] Colour management Alexander Kern
2004-07-31 10:26           ` Antonino A. Daplas
2004-07-31 13:31             ` Ville Syrjälä
2004-07-31 21:19               ` Antonino A. Daplas
2004-07-31 22:19                 ` Alexander Kern
2004-07-31 23:37                   ` Antonino A. Daplas
2004-07-31 22:18             ` Ville Syrjälä
2004-07-31 23:47               ` Antonino A. Daplas
2004-07-31 22:10           ` Ville Syrjälä [this message]
2004-08-01  1:03             ` Antonino A. Daplas
2004-07-25 10:16   ` [PATCH] atyfb: vblank irq support Ville Syrjälä
2004-07-25 18:29     ` Alexander Kern
2004-07-25 23:36       ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040731221014.GA17669@sci.fi \
    --to=syrjala@sci.fi \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).