Thread (149 messages) flat view 149 messages, 20 authors, 2025-11-13

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

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2023-11-16 13:13:49
Also in: dri-devel, virtualization

Hi Gerd,

On Wed, Nov 15, 2023 at 10:22 AM Gerd Hoffmann [off-list ref] wrote:
On Wed, Nov 15, 2023 at 09:33:28AM +0100, Geert Uytterhoeven wrote:
quoted
On Tue, Nov 14, 2023 at 10:45 AM Christian Zigotzky
[off-list ref] wrote:
quoted
On 13 November 2023 at 01:48 pm, Geert Uytterhoeven wrote:
quoted
I can confirm there is no graphics output with m68k/virt, and
Before the error message you reported:

    virtio-mmio virtio-mmio.125: [drm] *ERROR* fbdev: Failed to setup
generic emulation (ret=-2)

it also prints:

    virtio-mmio virtio-mmio.125: [drm] bpp/depth value of 32/24 not supported
    virtio-mmio virtio-mmio.125: [drm] No compatible format found

Upon closer look, it turns out virtgpu is special in that its main
plane supports only a single format: DRM_FORMAT_HOST_XRGB8888, which
is XR24 on little-endian, and BX24 on big-endian.  I.e. on big-endian,
virtgpu does not support XR24.
Driver and device support both XR24 and BX24 on both little endian and
big endian just fine.
OK.
quoted hunk ↗ jump to hunk
Problem is both fbdev interfaces and the ADDFB ioctl specify the format
using bpp instead of fourcc, and advertising only one framebuffer format
-- in native byte order -- used to worked best, especially on bigendian
machines.

That was years ago though, IIRC predating the generic fbdev emulation,
so maybe it's time to revisit that.  Changing it should be as simple as
updating the format arrays:
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -30,11 +30,13 @@
 #include "virtgpu_drv.h"

 static const uint32_t virtio_gpu_formats[] = {
-       DRM_FORMAT_HOST_XRGB8888,
+       DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_BGRX8888,
 };

 static const uint32_t virtio_gpu_cursor_formats[] = {
-       DRM_FORMAT_HOST_ARGB8888,
+       DRM_FORMAT_ARGB8888,
+       DRM_FORMAT_BGRA8888,
 };

 uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc)
Thanks!
Almost there, the check in virtio_gpu_user_framebuffer_create()
must be extended, too.

I have submitted a patch
https://lore.kernel.org/r/282a31154172a78165912c832a09f6502515d139.1700140178.git.geert@linux-m68k.org/ (local)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help