native/cogl-utils: Add YUV formats

As well as required subformats. This makes the YUV formats available in
zwp_linux_dmabuf_v1.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2191>
This commit is contained in:
Robert Mader 2022-07-24 21:18:52 +02:00 committed by Marge Bot
parent 239912cc1f
commit 7f19739e6b

View File

@ -42,6 +42,8 @@ typedef struct _CoglDrmFormatMap
static const CoglDrmFormatMap meta_cogl_drm_format_map[] = { static const CoglDrmFormatMap meta_cogl_drm_format_map[] = {
/* DRM formats are defined as little-endian, not machine endian. */ /* DRM formats are defined as little-endian, not machine endian. */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN #if G_BYTE_ORDER == G_LITTLE_ENDIAN
{ DRM_FORMAT_R8, COGL_PIXEL_FORMAT_G_8, META_MULTI_TEXTURE_FORMAT_INVALID },
{ DRM_FORMAT_GR88, COGL_PIXEL_FORMAT_RG_88, META_MULTI_TEXTURE_FORMAT_INVALID },
{ DRM_FORMAT_RGB565, COGL_PIXEL_FORMAT_RGB_565, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_RGB565, COGL_PIXEL_FORMAT_RGB_565, META_MULTI_TEXTURE_FORMAT_SIMPLE },
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_XBGR_8888, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_XBGR_8888, META_MULTI_TEXTURE_FORMAT_SIMPLE },
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE },
@ -59,6 +61,9 @@ static const CoglDrmFormatMap meta_cogl_drm_format_map[] = {
{ DRM_FORMAT_ARGB16161616F, COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_ARGB16161616F, COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE },
{ DRM_FORMAT_XBGR16161616F, COGL_PIXEL_FORMAT_RGBX_FP_16161616, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_XBGR16161616F, COGL_PIXEL_FORMAT_RGBX_FP_16161616, META_MULTI_TEXTURE_FORMAT_SIMPLE },
{ DRM_FORMAT_ABGR16161616F, COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_ABGR16161616F, COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE },
{ DRM_FORMAT_YUYV, COGL_PIXEL_FORMAT_ANY, META_MULTI_TEXTURE_FORMAT_YUYV },
{ DRM_FORMAT_NV12, COGL_PIXEL_FORMAT_ANY, META_MULTI_TEXTURE_FORMAT_NV12 },
{ DRM_FORMAT_YUV420, COGL_PIXEL_FORMAT_ANY, META_MULTI_TEXTURE_FORMAT_YUV420 },
#elif G_BYTE_ORDER == G_BIG_ENDIAN #elif G_BYTE_ORDER == G_BIG_ENDIAN
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_RGBX_8888, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_RGBX_8888, META_MULTI_TEXTURE_FORMAT_SIMPLE },
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE },