linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem with current fb_get_color_depth function
@ 2004-10-10 22:59 Joshua Kwan
  2004-10-11  0:33 ` Antonino A. Daplas
  0 siblings, 1 reply; 7+ messages in thread
From: Joshua Kwan @ 2004-10-10 22:59 UTC (permalink / raw)
  To: adaplas; +Cc: linux-kernel mailing list, linux-fbdev-devel

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

Hi Antonino, lists, etc.,

I noticed that after 2.6.9-rc1 or so my framebuffer logo stopped
appearing. Well, I dove into the fb layer code, noticed this change from
you:

int fb_get_color_depth(struct fb_info *info)
{
    struct fb_var_screeninfo *var = &info->var;

    if (var->green.length == var->blue.length &&
        var->green.length == var->red.length &&
        !var->green.offset && !var->blue.offset &&
        !var->red.offset)
        return var->green.length;
    else
        return (var->green.length + var->red.length +
            var->blue.length);
}

That was interesting, because here's what radeonfb does:

        switch (var_to_depth(&v)) {
[...]
                case 16:
                        nom = 2;
                        den = 1;
                        v.red.offset = 11;
                        v.green.offset = 5;
                        v.blue.offset = 0;
                        v.red.length = 5;
                        v.green.length = 6;
                        v.blue.length = 5;
                        v.transp.offset = v.transp.length = 0;
                        break;
[...]

So somehow that first conditional was firing, although I'm not sure how,
because a printk showed that the depth returned was 6. (fb_get_color_depth
should have jumped to the return (R + G + B) part right after it noticed
blue length was not equal to green length. Creepy.)

Well, whatever. The 224-color logo was ignored. This is what I did to
fix it:

--- a/drivers/video/fbmem.c	2004/09/23 01:19:45	1.102
+++ b/drivers/video/fbmem.c	2004/10/10 22:47:14
@@ -65,10 +65,8 @@
 {
 	struct fb_var_screeninfo *var = &info->var;
 
-	if (var->green.length == var->blue.length &&
-	    var->green.length == var->red.length &&
-	    !var->green.offset && !var->blue.offset &&
-	    !var->red.offset)
+	/* If grayscale, all values will be equal */
+	if (var->grayscale)
 		return var->green.length;
 	else
 		return (var->green.length + var->red.length +

because on advice from Andrew Suffield and Matthew Garrett the first
conditional was a roundabout way to check for grayscale displays, where
you can't actually have 24 bits (8 + 8 + 8) of gray. So it is suitable
to just return one of the values arbitrarily. But I noticed there was
also a grayscale variable, so I substituted that for the conditional
and my logo reappeared again :)

So is radeonfb or fb_get_color_depth at fault here? Or was the logo
never appropriate for my display in the first place? (Unlikely, the
CLUT224 linux logo always displayed perfectly for me until now.)

Thanks.

-- 
Joshua Kwan

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 881 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-11-11  8:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-10 22:59 Problem with current fb_get_color_depth function Joshua Kwan
2004-10-11  0:33 ` Antonino A. Daplas
2004-11-02  5:55   ` Joshua Kwan
2004-11-02 12:04     ` [Linux-fbdev-devel] " Antonino A. Daplas
2004-11-02 12:19     ` Geert Uytterhoeven
2004-11-02 22:10     ` Antonino A. Daplas
2004-11-11  8:27       ` [Linux-fbdev-devel] " Joshua Kwan

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).