mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Pierre Asselin <pa@panix.com>
Cc: Pierre Asselin <pa@panix.com>,
	Jocelyn Falempe <jfalempe@redhat.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Hans de Goede <hdegoede@redhat.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [PATCH] firmware/sysfb: Fix wrong stride when bits-per-pixel is calculated
Date: Wed, 12 Apr 2023 23:40:43 +0200	[thread overview]
Message-ID: <87cz48srs4.fsf@minerva.mail-host-address-is-not-set> (raw)
In-Reply-To: <87fs94stgw.fsf@minerva.mail-host-address-is-not-set>

Javier Martinez Canillas <javierm@redhat.com> writes:

[...]

>> ========== Bad after patch, typing blind to log in !==================
>> grub: gfxpayload=keep
>> [    0.003333] Console: colour dummy device 128x48
>> [    0.003333] printk: console [tty0] enabled
>> [    0.423925] fbcon: Taking over console
>> [    0.520030] pci 0000:01:05.0: vgaarb: setting as boot VGA device
>> [    0.520061] pci 0000:01:05.0: vgaarb: bridge control possible
>> [    0.520085] pci 0000:01:05.0: vgaarb: VGA device added:
>> decodes=io+mem,owns=io+mem,locks=none
>> [    0.520120] vgaarb: loaded
>> [    3.290444] simple-framebuffer simple-framebuffer.0: framebuffer at
>> 0xd8000000, 0x240000 bytes
>> [    3.290483] simple-framebuffer simple-framebuffer.0: format=r8g8b8,
>> mode=1024x768x24, linelength=3072
>
> Now, this is the part where things start to break I believe. Because you
> mentioned before that gfxpayload=keep used to set the format to xr8g8b8
> but now after my patch (and also after the original commit f35cd3fa7729)
> it is set to r8g8b8 instead.
>

I still don't understand why this particular configuration didn't work...

The framebuffer starts at 0xd8000000 and has a size of 0x240000 bytes, so
a r8g8b8 pixel format with resolution 1024x768 should be correct. Since is
1024 * 768 * (24 / 8) = 2359296 = 0x240000.

In any case, it seems that there is something wrong on how the screen_info
is reported to sysfb since you mentioned that gfxpayload=1024x768x32 leads
to a format=r8g8b8 and mode=1024x768x24, instead of the format=xr8g8b8 and
mode=1024x768x32 that is expected.

Could you please apply the following diff that will print all the relevant
fields from the screen_info that are used to calculate the bpp and stride.

My guess is that the rsvd_size and rsvd_pos are not correct and that's why
the bpp is set to 24 instead of 32.

diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_simplefb.c
index 5dc23e57089f..6678ac6ff5b1 100644
--- a/drivers/firmware/sysfb_simplefb.c
+++ b/drivers/firmware/sysfb_simplefb.c
@@ -58,6 +58,13 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
         * If a calculated bits_per_pixel is used instead of lfb_depth,
         * then also ignore lfb_linelength and calculate the stride.
         */
+
+       printk("sysfb: si->lfb_depth %u si->lfb_width %u\n", si->lfb_depth, si->lfb_width);
+       printk("sysfb: si->red_size %u si->red_pos %u\n", si->red_size, si->red_pos);
+       printk("sysfb: si->green_size %u si->green_pos %u\n", si->green_size, si->green_pos);
+       printk("sysfb: si->blue_size %u si->blue_pos %u\n", si->blue_size, si->blue_pos);
+       printk("sysfb: si->rsvd_size %u si->rsvd_pos %u\n", si->rsvd_size, si->rsvd_pos);
+
        if (si->lfb_depth > 8) {
                bits_per_pixel = max(max3(si->red_size + si->red_pos,
                                          si->green_size + si->green_pos,
@@ -69,6 +76,9 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
                stride = si->lfb_linelength;
        }
 
+       printk("sysfb: bits_per_pixel %u si->lfb_linelength %u\n", bits_per_pixel, si->lfb_linelength);
+       printk("sysfb: stride %u\n", stride);
+
        for (i = 0; i < ARRAY_SIZE(formats); ++i) {
                const struct simplefb_format *f = &formats[i];
 
@@ -86,6 +96,7 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
                        mode->width = si->lfb_width;
                        mode->height = si->lfb_height;
                        mode->stride = stride;
+                       printk("sysfb: format %s\n", f->name);
                        return true;
                }
        }

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


  reply	other threads:[~2023-04-12 21:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 15:02 Javier Martinez Canillas
2023-04-12 16:18 ` Pierre Asselin
2023-04-12 17:31   ` Javier Martinez Canillas
2023-04-12 18:12     ` Pierre Asselin
2023-04-12 18:24       ` Javier Martinez Canillas
2023-04-12 18:51         ` Pierre Asselin
2023-04-12 21:04           ` Javier Martinez Canillas
2023-04-12 21:40             ` Javier Martinez Canillas [this message]
2023-04-12 21:53               ` Pierre Asselin
2023-04-12 22:09                 ` Javier Martinez Canillas
2023-04-12 23:13                   ` Pierre Asselin
2023-04-13  1:13                     ` Pierre Asselin
2023-04-13  1:34                       ` Pierre Asselin
2023-04-17  8:15                         ` Thomas Zimmermann
2023-04-17  8:58                           ` Javier Martinez Canillas
2023-04-17  9:15                             ` Thomas Zimmermann
2023-04-17  9:29                               ` Javier Martinez Canillas
2023-04-13  7:08                       ` Javier Martinez Canillas
2023-04-13 16:24                         ` Pierre Asselin
2023-04-13 16:34                           ` Javier Martinez Canillas
2023-04-13 17:17                         ` Pierre Asselin
2023-04-13 18:04                           ` Javier Martinez Canillas
2023-04-13  6:54                     ` Javier Martinez Canillas

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=87cz48srs4.fsf@minerva.mail-host-address-is-not-set \
    --to=javierm@redhat.com \
    --cc=ardb@kernel.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=jfalempe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pa@panix.com \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®