Fbdev issue after the drm updates 'drm-next-2023-10-31-1'

Christian Zigotzky chzigotzky at xenosoft.de
Tue Nov 14 00:12:03 AEDT 2023


On 13 November 2023 at 01:48 pm, Geert Uytterhoeven wrote:
> Hi Christian,
>
> On Sun, Nov 12, 2023 at 3:23 PM Christian Zigotzky
> <chzigotzky at xenosoft.de> wrote:
>> On 07 November 2023 at 09:36 am, Christian Zigotzky wrote:
>>> I have found out that fbdev no longer works with virtio-gpu-pci and
>>> virtio-vga. It is not a problem with the penguin logos.
>>>
>>> Could you please check fbdev in QEMU virtual machines with
>>> virtio-gpu-pci and virtio-vga graphics?
>>> On 02 November 2023 at 03:45 pm, Christian Zigotzky wrote:
>>>> There is a fbdev issue with the virtio-gpu-pci and virtio-vga. (The
>>>> penguins are not displayed at boot time)
>>>>
>>>> Error message:  [    0.889302] virtio-pci 0000:00:02.0: [drm] *ERROR*
>>>> fbdev: Failed to setup generic emulation (ret=-2)
>>>>
>>>> The kernel 6.6 final doesn't have this issue.
>>>>
>>>> Please check the fbdev changes in the drm updates
>>>> 'drm-next-2023-10-31-1'.
> Thanks for your report!
>
> I can confirm there is no graphics output with m68k/virt, and
> bisected this to my own commit 6ae2ff23aa43a0c4 ("drm/client: Convert
> drm_client_buffer_addfb() to drm_mode_addfb2()"), ouch...
>
> It turns out the old call to drm_mode_addfb() caused a translation
> from a fourcc to a bpp/depth pair to a _different_ fourcc, due to the
> quirk processing in drm_driver_legacy_fb_format().
> I.e. on m68k/virt, the original requested format was XR24, which was
> translated to BX24. The former doesn't work, the latter works.
>
> The following (gmail-whitespace-damaged) patch fixed the issue for me:
>
> --- a/drivers/gpu/drm/drm_client.c
> +++ b/drivers/gpu/drm/drm_client.c
> @@ -400,6 +400,16 @@ static int drm_client_buffer_addfb(struct
> drm_client_buffer *buffer,
>
>          fb_req.width = width;
>          fb_req.height = height;
> +       if (client->dev->mode_config.quirk_addfb_prefer_host_byte_order) {
> +               if (format == DRM_FORMAT_XRGB8888)
> +                       format = DRM_FORMAT_HOST_XRGB8888;
> +               if (format == DRM_FORMAT_ARGB8888)
> +                       format = DRM_FORMAT_HOST_ARGB8888;
> +               if (format == DRM_FORMAT_RGB565)
> +                       format = DRM_FORMAT_HOST_RGB565;
> +               if (format == DRM_FORMAT_XRGB1555)
> +                       format = DRM_FORMAT_HOST_XRGB1555;
> +       }
>          fb_req.pixel_format = format;
>          fb_req.handles[0] = handle;
>          fb_req.pitches[0] = buffer->pitch;
>
> However, I don't think we want to sprinkle more of these
> translations around... So perhaps we should (re)add a call to
> drm_driver_legacy_fb_format() to drm_client_buffer_addfb()?
>
> Second, as I doubt you are using a big-endian system, you are probably
> running into a slightly different issue.
>
> Oh wait, you did CC linuxppc-dev, so perhaps you are running on a
> big-endian machine?
>
> If not, please add
>
>      pr_info("%s: format = %p4cc\n", __func__, &format);
>
> to drivers/gpu/drm/drm_client.c:drm_client_buffer_addfb(), and,
> after reverting commit 6ae2ff23aa43a0c4, add
>
>      pr_info("%s: bpp %u/depth %u => r.pixel_format = %p4cc\n",
> __func__, or->bpp, or->depth, &r.pixel_format);
>
> to drivers/gpu/drm/drm_framebuffer.c:drm_mode_addfb(), so we know the
> translation in your case?
>
> Thanks!
>
> Gr{oetje,eeting}s,
>
>                          Geert
>
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds
Hi Geert,

Thanks for your answer! I use a big-endian system.

Cheers,
Christian


More information about the Linuxppc-dev mailing list