wayland-dma-buf: Fix 32bpp channel order inversion
Apparently my understanding of Cogl pixel formats, or at least their use, was somewhat shaky. Un-invert the inversion of the DRM FourCC -> Cogl pixel format mapping when creating dmabufs from clients, fixing inverted channel ordering seen from GL clients, e.g. gold highlights in gtk4-demo when using the GSK GL backend when they should be blue. https://bugzilla.gnome.org/show_bug.cgi?id=786677
This commit is contained in:
parent
c248feb3c1
commit
06d0989014
@ -83,16 +83,13 @@ meta_wayland_dma_buf_buffer_attach (MetaWaylandBuffer *buffer,
|
|||||||
if (buffer->texture)
|
if (buffer->texture)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* DRM_FORMAT_* enums consider the entire pixel as a single packed quantity,
|
|
||||||
* with little-endian ordering. COGL_PIXEL_FORMAT_* is in byte order when
|
|
||||||
* each channel is an 8-byte unit. Hence these have order swapped. */
|
|
||||||
switch (dma_buf->drm_format)
|
switch (dma_buf->drm_format)
|
||||||
{
|
{
|
||||||
case DRM_FORMAT_XRGB8888:
|
case DRM_FORMAT_XRGB8888:
|
||||||
cogl_format = COGL_PIXEL_FORMAT_BGR_888;
|
cogl_format = COGL_PIXEL_FORMAT_RGB_888;
|
||||||
break;
|
break;
|
||||||
case DRM_FORMAT_ARGB8888:
|
case DRM_FORMAT_ARGB8888:
|
||||||
cogl_format = COGL_PIXEL_FORMAT_BGRA_8888_PRE;
|
cogl_format = COGL_PIXEL_FORMAT_ARGB_8888_PRE;
|
||||||
break;
|
break;
|
||||||
case DRM_FORMAT_ARGB2101010:
|
case DRM_FORMAT_ARGB2101010:
|
||||||
cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010_PRE;
|
cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010_PRE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user