linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joshua Kwan <joshk@triplehelix.org>
To: adaplas@pol.net
Cc: linux-kernel mailing list <linux-kernel@vger.kernel.org>,
	linux-fbdev-devel@lists.sourceforge.net
Subject: Problem with current fb_get_color_depth function
Date: Sun, 10 Oct 2004 15:59:03 -0700	[thread overview]
Message-ID: <20041010225903.GA2418@darjeeling.triplehelix.org> (raw)

[-- 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 --]

             reply	other threads:[~2004-10-10 22:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-10 22:59 Joshua Kwan [this message]
2004-10-11  0:33 ` Problem with current fb_get_color_depth function 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

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=20041010225903.GA2418@darjeeling.triplehelix.org \
    --to=joshk@triplehelix.org \
    --cc=adaplas@pol.net \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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).