1
0
Fork 0

wayland-dma-buf: Add support for DRM_FORMAT_ABGR2101010

It seems to be the preferred format of the Mesa V3D driver on
Raspberry Pi 4. If the compositor doesn't advertise it then Mesa will
fallback from `zwp_linux_dmabuf_v1` to `wl_drm`, incorrectly. Meaning
it will keep using a buffer with modifiers on an interface that does
not have modifiers.

Add support for `DRM_FORMAT_ABGR2101010`. It works, and prevents Mesa
from taking its broken fallback path.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1520
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1798>
This commit is contained in:
Daniel van Vugt 2021-03-23 11:59:59 +08:00 committed by Marge Bot
parent dc74d4d429
commit 3555f65b75

View file

@ -124,6 +124,9 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer,
case DRM_FORMAT_ARGB2101010:
cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010_PRE;
break;
case DRM_FORMAT_ABGR2101010:
cogl_format = COGL_PIXEL_FORMAT_ABGR_2101010_PRE;
break;
case DRM_FORMAT_RGB565:
cogl_format = COGL_PIXEL_FORMAT_RGB_565;
break;
@ -701,6 +704,7 @@ dma_buf_bind (struct wl_client *client,
send_modifiers (resource, DRM_FORMAT_ARGB8888);
send_modifiers (resource, DRM_FORMAT_XRGB8888);
send_modifiers (resource, DRM_FORMAT_ARGB2101010);
send_modifiers (resource, DRM_FORMAT_ABGR2101010);
send_modifiers (resource, DRM_FORMAT_XRGB2101010);
send_modifiers (resource, DRM_FORMAT_RGB565);
send_modifiers (resource, DRM_FORMAT_ABGR16161616F);