wayland-dma-buf: Use alpha-less pixel formats where appropriate

The XRGB/XBGR pixel formats do not set the cogl alpha bit. This
allows for example `MetaShapedTexture` to use the fast opaque
path for rendering and `MetaCullable` to detect whether a
`MetaSurfaceActor` is opaque.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1733

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1810>
This commit is contained in:
Robert Mader 2021-04-02 11:08:54 +02:00 committed by Marge Bot
parent daace1aac5
commit 9ededb9b34

View File

@ -119,7 +119,7 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer,
cogl_format = COGL_PIXEL_FORMAT_ARGB_8888_PRE;
break;
case DRM_FORMAT_XRGB2101010:
cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010;
cogl_format = COGL_PIXEL_FORMAT_XRGB_2101010;
break;
case DRM_FORMAT_ARGB2101010:
cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010_PRE;
@ -131,10 +131,14 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer,
cogl_format = COGL_PIXEL_FORMAT_RGB_565;
break;
case DRM_FORMAT_XBGR16161616F:
cogl_format = COGL_PIXEL_FORMAT_XBGR_FP_16161616;
break;
case DRM_FORMAT_ABGR16161616F:
cogl_format = COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE;
break;
case DRM_FORMAT_XRGB16161616F:
cogl_format = COGL_PIXEL_FORMAT_XRGB_FP_16161616;
break;
case DRM_FORMAT_ARGB16161616F:
cogl_format = COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE;
break;