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>,
	tzimmermann@suse.de, linux-kernel@vger.kernel.org,
	jfalempe@redhat.com, hdegoede@redhat.com,
	dri-devel@lists.freedesktop.org, daniel.vetter@ffwll.ch,
	ardb@kernel.org
Subject: Re: [PATCH] firmware/sysfb: Fix wrong stride when bits-per-pixel is calculated
Date: Thu, 13 Apr 2023 18:34:40 +0200	[thread overview]
Message-ID: <87jzyfrba7.fsf@minerva.mail-host-address-is-not-set> (raw)
In-Reply-To: <ae5f6784c72e1b31cdf7766d3c6dbe0c.squirrel@mail.panix.com>

"Pierre Asselin" <pa@panix.com> writes:

>> pa@panix.com (Pierre Asselin) writes:

[...]

>>> -		bits_per_pixel = max(max3(si->red_size + si->red_pos,
>>> +		bits_per_pixel = max3(max3(si->red_size + si->red_pos,
>>>  					  si->green_size + si->green_pos,
>>>  					  si->blue_size + si->blue_pos),
>>> -				     si->rsvd_size + si->rsvd_pos);
>>> +				     si->rsvd_size + si->rsvd_pos,
>>> +				     si->lfb_depth);
>
>
>> I would defer to Thomas but personally I don't like it. Seems to me that
>> this is getting too complicated just to workaround buggy BIOS that are not
>> reporting consistent information about their firmware-provided
>> framebuffer.
>
> Okay, but remember, this is a regression.  The buggy BIOSes were there

Yes, I agree that is a regression and has to be fixed. I'm just arguing
against this particular fix.

> the whole time and the old code that matched f->bits_per_pixel against
> si->lfb_depth used to work against these buggy BIOSes.
>
> And is it a bug, or is it an underspecified standard ?  "These bits aren't
> reserved, we just ignore them" or some such.
>
> My reading of Thomas' comments in the code was that sometimes lfb_depth
> was reported too small but never too large ?  But I'm not sure.  It's
> true in my two cases.
>

I (mis?)understood that it could be too small as well. But that's why I
prefer Thomas to chime in before agreeing on any path forward. But he is
in vacation this week I believe.

>> I would either trust the pixel channel information (what Thomas patch did)
>> + my patch to calculate the stride (since we can't trust the line lenght
>> which is based on the reported depth) + a DMI table for broken machines.
>
>> But that will only work if your systems are the exception and not a common
>> issue, otherwise then Thomas' approach won't work if there are too many
>> buggy BIOS out there.
>
> The laptop is ancient but the Dell tower is maybe 4 years old.  The
> BIOS is 09/11/2019 according to dmidecode, and the most recent for
> this box.
>

I see.

>> Another option is to do the opposite, not calculate a BPP using the pixel
>> and then use that value to calculate a new stride, but instead assume that
>> the lfb_linelength is correct and use that to calculate the BPP.
>
> Or reject (some) inconsistencies in the struct screen_info and return
> false, so the kernel falls back to e.g. vesa ?
>

That a reasonable approach too. But better if we can make simpledrm work
too since many distros have dropped all the fbdev drivers in favor of it.

>> Something like the following patch, which should also fix your regression
>> and may be enough to address Thomas' concerns of inconsistent depths too?
>
> I'll try that patch.
>

Thanks for all your information and testing with this bug!

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


  reply	other threads:[~2023-04-13 16:35 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
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 [this message]
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=87jzyfrba7.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®