From: Thomas Zimmermann <tzimmermann@suse.de>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: mairacanal@riseup.net, javierm@redhat.com,
dri-devel@lists.freedesktop.org, jose.exposito89@gmail.com
Subject: Re: [PATCH v3 11/13] drm/fb-helper: Fix single-probe color-format selection
Date: Mon, 15 May 2023 10:42:20 +0200 [thread overview]
Message-ID: <1dfbcb14-8efa-e9f3-7d82-301fa08771dc@suse.de> (raw)
In-Reply-To: <ZGHqeLcWw5tEL3Fy@phenom.ffwll.local>
[-- Attachment #1.1: Type: text/plain, Size: 4339 bytes --]
Hi
Am 15.05.23 um 10:16 schrieb Daniel Vetter:
> On Fri, May 12, 2023 at 04:11:48PM +0200, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 12.05.23 um 15:20 schrieb Linus Walleij:
>>> Sorry for late regression detection but this patch regresses
>>> the Integrator AB IMPD-1 graphics, I bisected down to this
>>> patch.
>> [...]
>>> This is the driver:
>>> drivers/gpu/drm/pl111/pl111_versatile.c
>>> with the pl110_impd1 variant, so these are the supported modes:
>>>
>>> /* PL110 pixel formats for Integrator, vanilla PL110 */
>>> static const u32 pl110_integrator_pixel_formats[] = {
>>> DRM_FORMAT_ABGR8888,
>>> DRM_FORMAT_XBGR8888,
>>> DRM_FORMAT_ARGB8888,
>>> DRM_FORMAT_XRGB8888,
>>> DRM_FORMAT_ABGR1555,
>>> DRM_FORMAT_XBGR1555,
>>> DRM_FORMAT_ARGB1555,
>>> DRM_FORMAT_XRGB1555,
>>> };
>>> (...)
>>> /*
>>> * The IM-PD1 variant is a PL110 with a bunch of broken, or not
>>> * yet implemented features
>>> */
>>> static const struct pl111_variant_data pl110_impd1 = {
>>> .name = "PL110 IM-PD1",
>>> .is_pl110 = true,
>>> .broken_clockdivider = true,
>>> .broken_vblank = true,
>>> .formats = pl110_integrator_pixel_formats,
>>> .nformats = ARRAY_SIZE(pl110_integrator_pixel_formats),
>>> .fb_bpp = 16,
>>> };
>>>
>>> Notice the absence of RGB565!
>>> Then we initialized the frambuffer like this:
>>>
>>> drm_fbdev_dma_setup(drm, priv->variant->fb_bpp);
>>>
>>> And as you see priv->variant->fb_bpp will be 16, so we want some
>>> 16bpp mode however the only supported depth is 15 (the 1555 modes)
>>> so it would use that by scaling back depth to 15.
>>>
>>> However after this patch that doesn't work anymore.
>>>
>>> Any hints on how we can fix this?
>>
>> According to a quick grep for fb_bpp, it's only used for the call to
>> drm_fbdev_dma_setup(), right? In this case, you should set it to 15 for the
>> models without rgb565. The switch at [1] should then pick the correct
>> values.
>>
>> The preferred_bpp parameter had a change in semantics. It used to be the
>> number of bits per pixel. But that makes it hard to select between RGB1555
>> and RGB565. So it's now a special color-mode value that works like the
>> kernel's video= parameter. Values of 15 and 32 are different from the rest.
>> That switch at [1] explains it. Maybe you should rename fb_bpp to color_mode
>> for clarity.
>>
>> Let me know if this helps.
>
> Shouldn't the helpers try to do this automatically? I think they kinda did
> that in the past in some limited circumstances like this ...
That was the intention, but it never really worked at all. IIRC the
color-format selection mixed up depth and bpp values freely. Factor in
the command-line override (video=@bpp) and some odd case has always been
broken.
So fbdev emulation now mostly uses the color-mode value that works as on
the command line. The current semantics is:
* select the user-given color mode, if non-zero
* select the driver-given color mode, if non-zero
* otherwise select a color mode of 32 by default (that's XRGB8888)
And later during fb_probe:
* try the selected color mode
* otherwise try to auto-detect if the selected color mode doesn't work,
* otherwise use XRGB8888 as a last resort
That nicely splits the code into color-mode selection and color-format
selection. And all the public interfaces (command line,
drm_fbdev_{}_setup(), etc) use the same semantics, which is the color mode.
Best regards
Thomas
> -Daniel
>
>>
>> Best regards
>> Thomas
>>
>> [1] https://elixir.bootlin.com/linux/v6.4-rc1/source/drivers/gpu/drm/drm_fb_helper.c#L1827
>>
>>>
>>> Yours,
>>> Linus Walleij
>>
>> --
>> Thomas Zimmermann
>> Graphics Driver Developer
>> SUSE Software Solutions Germany GmbH
>> Frankenstrasse 146, 90461 Nuernberg, Germany
>> GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
>> HRB 36809 (AG Nuernberg)
>
>
>
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2023-05-15 8:42 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-02 11:29 [PATCH v3 00/13] drm: Fix color-format selection in fbdev emulation Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 01/13] firmware/sysfb: Fix EFI/VESA format selection Thomas Zimmermann
2023-04-06 15:45 ` Pierre Asselin
2023-04-08 11:26 ` Linux regression tracking #adding (Thorsten Leemhuis)
2023-04-16 12:06 ` Linux regression tracking #update (Thorsten Leemhuis)
2023-04-08 16:10 ` Pierre Asselin
2023-04-11 15:56 ` Javier Martinez Canillas
2023-04-11 19:39 ` Pierre Asselin
2023-04-12 11:22 ` Javier Martinez Canillas
2023-04-17 7:34 ` Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 02/13] drm/format-helper: Comment on RGB888 byte order Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 03/13] drm/format-helper: Fix test-input format conversion Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 04/13] drm/format-helper: Store RGB565 in little-endian order Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 05/13] drm/format-helper: Type fixes in format-helper tests Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 06/13] drm/format-helper: Flip src/dst-format branches in blit helper Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 07/13] drm/format-helper: Add conversion from XRGB8888 to ARGB8888 Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 08/13] drm/format-helper: Add conversion from XRGB8888 to ARGB2101010 Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 09/13] drm/format-helper: Add conversion from XRGB8888 to 15-bit RGB555 formats Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 10/13] drm/fh-helper: Split fbdev single-probe helper Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 11/13] drm/fb-helper: Fix single-probe color-format selection Thomas Zimmermann
2023-01-03 21:18 ` Maíra Canal
2023-01-04 8:14 ` Thomas Zimmermann
2023-01-04 10:34 ` Maíra Canal
2023-05-12 13:20 ` Linus Walleij
2023-05-12 14:11 ` Thomas Zimmermann
2023-05-15 8:01 ` Linus Walleij
2023-05-15 8:17 ` Thomas Zimmermann
2023-05-15 8:59 ` Linus Walleij
2023-05-15 9:26 ` Thomas Zimmermann
2023-05-15 9:30 ` Linus Walleij
2023-05-15 8:16 ` Daniel Vetter
2023-05-15 8:42 ` Thomas Zimmermann [this message]
2023-05-14 12:10 ` Linux regression tracking #adding (Thorsten Leemhuis)
2023-05-26 12:22 ` Linux regression tracking #update (Thorsten Leemhuis)
2023-01-02 11:29 ` [PATCH v3 12/13] drm/format-helper: Simplify drm_fb_build_fourcc_list() Thomas Zimmermann
2023-01-02 11:29 ` [PATCH v3 13/13] drm/format-helper: Remove unnecessary conversion helpers Thomas Zimmermann
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=1dfbcb14-8efa-e9f3-7d82-301fa08771dc@suse.de \
--to=tzimmermann@suse.de \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jose.exposito89@gmail.com \
--cc=mairacanal@riseup.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