From 00566261b2f102e0791cb2ffbaf850bb49975587 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 14 Dec 2023 09:13:39 +0100 Subject: [PATCH] dmabuf: Explode the DmabufFormatInfo array it's growing more and mroe, and it gets too wide and unreadable otherwise. --- gdk/gdkdmabuf.c | 861 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 738 insertions(+), 123 deletions(-) diff --git a/gdk/gdkdmabuf.c b/gdk/gdkdmabuf.c index 32af8d0146..bb2fa733d0 100644 --- a/gdk/gdkdmabuf.c +++ b/gdk/gdkdmabuf.c @@ -372,144 +372,759 @@ download_yuyv (guchar *dst_data, static const GdkDrmFormatInfo supported_formats[] = { #if 0 /* palette formats?! */ - { DRM_FORMAT_C1, GDK_MEMORY_, FALSE, NULL }, - { DRM_FORMAT_C2, GDK_MEMORY_, FALSE, NULL }, - { DRM_FORMAT_C4, GDK_MEMORY_, FALSE, NULL }, - { DRM_FORMAT_C8, GDK_MEMORY_, FALSE, NULL }, + { + .fourcc = DRM_FORMAT_C1, + .memory_format = GDK_MEMORY_, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_C2, + .memory_format = GDK_MEMORY_, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_C4, + .memory_format = GDK_MEMORY_, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_C8, + .memory_format = GDK_MEMORY_, + .is_yuv = FALSE, + .download = NULL, + }, #endif /* darkness */ - { DRM_FORMAT_D1, GDK_MEMORY_G8, FALSE, NULL }, - { DRM_FORMAT_D2, GDK_MEMORY_G8, FALSE, NULL }, - { DRM_FORMAT_D4, GDK_MEMORY_G8, FALSE, NULL }, - { DRM_FORMAT_D8, GDK_MEMORY_G8, FALSE, NULL }, + { + .fourcc = DRM_FORMAT_D1, + .memory_format = GDK_MEMORY_G8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_D2, + .memory_format = GDK_MEMORY_G8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_D4, + .memory_format = GDK_MEMORY_G8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_D8, + .memory_format = GDK_MEMORY_G8, + .is_yuv = FALSE, + .download = NULL, + }, /* red only - we treat this as gray */ - { DRM_FORMAT_R1, GDK_MEMORY_G8, FALSE, NULL }, - { DRM_FORMAT_R2, GDK_MEMORY_G8, FALSE, NULL }, - { DRM_FORMAT_R4, GDK_MEMORY_G8, FALSE, NULL }, - { DRM_FORMAT_R8, GDK_MEMORY_G8, FALSE, NULL }, - { DRM_FORMAT_R10, GDK_MEMORY_G16, FALSE, NULL }, - { DRM_FORMAT_R12, GDK_MEMORY_G16, FALSE, NULL }, - { DRM_FORMAT_R16, GDK_MEMORY_G16, FALSE, NULL }, + { + .fourcc = DRM_FORMAT_R1, + .memory_format = GDK_MEMORY_G8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_R2, + .memory_format = GDK_MEMORY_G8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_R4, + .memory_format = GDK_MEMORY_G8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_R8, + .memory_format = GDK_MEMORY_G8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_R10, + .memory_format = GDK_MEMORY_G16, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_R12, + .memory_format = GDK_MEMORY_G16, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_R16, + .memory_format = GDK_MEMORY_G16, + .is_yuv = FALSE, + .download = NULL, + }, /* 2 channels - FIXME: Should this be gray + alpha? */ - { DRM_FORMAT_RG88, GDK_MEMORY_R8G8B8, FALSE, NULL }, - { DRM_FORMAT_GR88, GDK_MEMORY_R8G8B8, FALSE, NULL }, - { DRM_FORMAT_RG1616, GDK_MEMORY_R16G16B16, FALSE, NULL }, - { DRM_FORMAT_GR1616, GDK_MEMORY_R16G16B16, FALSE, NULL }, + { + .fourcc = DRM_FORMAT_RG88, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_GR88, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_RG1616, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_GR1616, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = FALSE, + .download = NULL, + }, /* <8bit per channel RGB(A) */ - { DRM_FORMAT_RGB332, GDK_MEMORY_B8G8R8, FALSE, NULL }, - { DRM_FORMAT_BGR233, GDK_MEMORY_R8G8B8, FALSE, NULL }, - { DRM_FORMAT_XRGB4444, GDK_MEMORY_B8G8R8, FALSE, NULL }, - { DRM_FORMAT_XBGR4444, GDK_MEMORY_R8G8B8, FALSE, NULL }, - { DRM_FORMAT_RGBX4444, GDK_MEMORY_B8G8R8, FALSE, NULL }, - { DRM_FORMAT_BGRX4444, GDK_MEMORY_R8G8B8, FALSE, NULL }, - { DRM_FORMAT_ARGB4444, GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_ABGR4444, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_RGBA4444, GDK_MEMORY_A8B8G8R8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_BGRA4444, GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_XRGB1555, GDK_MEMORY_B8G8R8, FALSE, NULL }, - { DRM_FORMAT_XBGR1555, GDK_MEMORY_R8G8B8, FALSE, NULL }, - { DRM_FORMAT_RGBX5551, GDK_MEMORY_B8G8R8, FALSE, NULL }, - { DRM_FORMAT_BGRX5551, GDK_MEMORY_R8G8B8, FALSE, NULL }, - { DRM_FORMAT_ARGB1555, GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_ABGR1555, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_RGBA5551, GDK_MEMORY_A8B8G8R8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_BGRA5551, GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_RGB565, GDK_MEMORY_B8G8R8, FALSE, NULL }, - { DRM_FORMAT_BGR565, GDK_MEMORY_R8G8B8, FALSE, NULL }, + { + .fourcc = DRM_FORMAT_RGB332, + .memory_format = GDK_MEMORY_B8G8R8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGR233, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XRGB4444, + .memory_format = GDK_MEMORY_B8G8R8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XBGR4444, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_RGBX4444, + .memory_format = GDK_MEMORY_B8G8R8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGRX4444, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ARGB4444, + .memory_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ABGR4444, + .memory_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_RGBA4444, + .memory_format = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGRA4444, + .memory_format = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XRGB1555, + .memory_format = GDK_MEMORY_B8G8R8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XBGR1555, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_RGBX5551, + .memory_format = GDK_MEMORY_B8G8R8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGRX5551, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ARGB1555, + .memory_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ABGR1555, + .memory_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_RGBA5551, + .memory_format = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGRA5551, + .memory_format = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_RGB565, + .memory_format = GDK_MEMORY_B8G8R8, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGR565, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = FALSE, + .download = NULL, + }, /* 8bit RGB */ - { DRM_FORMAT_RGB888, GDK_MEMORY_R8G8B8, FALSE, download_memcpy }, - { DRM_FORMAT_BGR888, GDK_MEMORY_B8G8R8, FALSE, download_memcpy }, + { + .fourcc = DRM_FORMAT_RGB888, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = FALSE, + .download = download_memcpy, + }, + { + .fourcc = DRM_FORMAT_BGR888, + .memory_format = GDK_MEMORY_B8G8R8, + .is_yuv = FALSE, + .download = download_memcpy, + }, /* 8bit RGBA */ - { DRM_FORMAT_BGRA8888, GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, FALSE, download_memcpy }, - { DRM_FORMAT_ABGR8888, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, FALSE, download_memcpy }, - { DRM_FORMAT_ARGB8888, GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, FALSE, download_memcpy }, - { DRM_FORMAT_RGBA8888, GDK_MEMORY_A8B8G8R8_PREMULTIPLIED, FALSE, download_memcpy }, - { DRM_FORMAT_BGRX8888, GDK_MEMORY_X8R8G8B8, FALSE, download_memcpy }, - { DRM_FORMAT_XBGR8888, GDK_MEMORY_R8G8B8X8, FALSE, download_memcpy }, - { DRM_FORMAT_XRGB8888, GDK_MEMORY_B8G8R8X8, FALSE, download_memcpy }, - { DRM_FORMAT_RGBX8888, GDK_MEMORY_X8B8G8R8, FALSE, download_memcpy }, + { + .fourcc = DRM_FORMAT_BGRA8888, + .memory_format = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = download_memcpy, + }, + { + .fourcc = DRM_FORMAT_ABGR8888, + .memory_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = download_memcpy, + }, + { + .fourcc = DRM_FORMAT_ARGB8888, + .memory_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = download_memcpy, + }, + { + .fourcc = DRM_FORMAT_RGBA8888, + .memory_format = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = download_memcpy, + }, + { + .fourcc = DRM_FORMAT_BGRX8888, + .memory_format = GDK_MEMORY_X8R8G8B8, + .is_yuv = FALSE, + .download = download_memcpy, + }, + { + .fourcc = DRM_FORMAT_XBGR8888, + .memory_format = GDK_MEMORY_R8G8B8X8, + .is_yuv = FALSE, + .download = download_memcpy, + }, + { + .fourcc = DRM_FORMAT_XRGB8888, + .memory_format = GDK_MEMORY_B8G8R8X8, + .is_yuv = FALSE, + .download = download_memcpy, + }, + { + .fourcc = DRM_FORMAT_RGBX8888, + .memory_format = GDK_MEMORY_X8B8G8R8, + .is_yuv = FALSE, + .download = download_memcpy, + }, /* 10bit RGB(A) */ - { DRM_FORMAT_XRGB2101010, GDK_MEMORY_R16G16B16, FALSE, NULL }, - { DRM_FORMAT_XBGR2101010, GDK_MEMORY_R16G16B16, FALSE, NULL }, - { DRM_FORMAT_RGBX1010102, GDK_MEMORY_R16G16B16, FALSE, NULL }, - { DRM_FORMAT_BGRX1010102, GDK_MEMORY_R16G16B16, FALSE, NULL }, - { DRM_FORMAT_ARGB2101010, GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_ABGR2101010, GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_RGBA1010102, GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_BGRA1010102, GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, FALSE, NULL }, + { + .fourcc = DRM_FORMAT_XRGB2101010, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XBGR2101010, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_RGBX1010102, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGRX1010102, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ARGB2101010, + .memory_format = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ABGR2101010, + .memory_format = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_RGBA1010102, + .memory_format = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGRA1010102, + .memory_format = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, /* 16bit RGB(A) */ - { DRM_FORMAT_XRGB16161616, GDK_MEMORY_R16G16B16, FALSE, NULL }, - { DRM_FORMAT_XBGR16161616, GDK_MEMORY_R16G16B16, FALSE, NULL }, - { DRM_FORMAT_ARGB16161616, GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_ABGR16161616, GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_XRGB16161616F, GDK_MEMORY_R16G16B16_FLOAT, FALSE, NULL }, - { DRM_FORMAT_XBGR16161616F, GDK_MEMORY_R16G16B16_FLOAT, FALSE, NULL }, - { DRM_FORMAT_ARGB16161616F, GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_ABGR16161616F, GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED, FALSE, download_memcpy }, - { DRM_FORMAT_AXBXGXRX106106106106, GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, FALSE, NULL }, + { + .fourcc = DRM_FORMAT_XRGB16161616, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XBGR16161616, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ARGB16161616, + .memory_format = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ABGR16161616, + .memory_format = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XRGB16161616F, + .memory_format = GDK_MEMORY_R16G16B16_FLOAT, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XBGR16161616F, + .memory_format = GDK_MEMORY_R16G16B16_FLOAT, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ARGB16161616F, + .memory_format = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_ABGR16161616F, + .memory_format = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED, + .is_yuv = FALSE, + .download = download_memcpy, + }, + { + .fourcc = DRM_FORMAT_AXBXGXRX106106106106, + .memory_format = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, /* 1-plane YUV formats */ - { DRM_FORMAT_YUYV, GDK_MEMORY_R8G8B8, TRUE, download_yuyv }, - { DRM_FORMAT_YVYU, GDK_MEMORY_R8G8B8, TRUE, download_yuyv }, - { DRM_FORMAT_VYUY, GDK_MEMORY_R8G8B8, TRUE, download_yuyv }, - { DRM_FORMAT_UYVY, GDK_MEMORY_R8G8B8, TRUE, download_yuyv }, - { DRM_FORMAT_AYUV, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, TRUE, NULL }, - { DRM_FORMAT_AVUY8888, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, TRUE, NULL }, - { DRM_FORMAT_XYUV8888, GDK_MEMORY_R8G8B8, TRUE, NULL }, - { DRM_FORMAT_XVUY8888, GDK_MEMORY_R8G8B8, TRUE, NULL }, - { DRM_FORMAT_VUY888, GDK_MEMORY_R8G8B8, TRUE, NULL }, - { DRM_FORMAT_VUY101010, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_Y210, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_Y212, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_Y216, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_Y410, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_Y412, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_Y416, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_XVYU2101010, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_XVYU12_16161616, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_XVYU16161616, GDK_MEMORY_R16G16B16, TRUE, NULL }, + { + .fourcc = DRM_FORMAT_YUYV, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuyv, + }, + { + .fourcc = DRM_FORMAT_YVYU, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuyv, + }, + { + .fourcc = DRM_FORMAT_VYUY, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuyv, + }, + { + .fourcc = DRM_FORMAT_UYVY, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuyv, + }, + { + .fourcc = DRM_FORMAT_AYUV, + .memory_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_AVUY8888, + .memory_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XYUV8888, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XVUY8888, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_VUY888, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_VUY101010, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_Y210, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_Y212, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_Y216, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_Y410, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_Y412, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_Y416, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XVYU2101010, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XVYU12_16161616, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_XVYU16161616, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, /* tiled YUV */ - { DRM_FORMAT_Y0L0, GDK_MEMORY_R8G8B8, TRUE, NULL }, - { DRM_FORMAT_X0L0, GDK_MEMORY_R8G8B8, TRUE, NULL }, - { DRM_FORMAT_Y0L2, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_X0L2, GDK_MEMORY_R16G16B16, TRUE, NULL }, + { + .fourcc = DRM_FORMAT_Y0L0, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_X0L0, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_Y0L2, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_X0L2, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, /* non-linear YUV */ - { DRM_FORMAT_YUV420_8BIT, GDK_MEMORY_R8G8B8, TRUE, NULL }, - { DRM_FORMAT_YUV420_10BIT, GDK_MEMORY_R16G16B16, TRUE, NULL }, + { + .fourcc = DRM_FORMAT_YUV420_8BIT, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_YUV420_10BIT, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, /* 2 plane RGB + A */ - { DRM_FORMAT_BGRX8888_A8, GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, FALSE, download_memcpy_3_1 }, - { DRM_FORMAT_RGBX8888_A8, GDK_MEMORY_A8B8G8R8_PREMULTIPLIED, FALSE, download_memcpy_3_1 }, - { DRM_FORMAT_XBGR8888_A8, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, FALSE, download_memcpy_3_1 }, - { DRM_FORMAT_XRGB8888_A8, GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, FALSE, download_memcpy_3_1 }, - { DRM_FORMAT_RGB888_A8, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_BGR888_A8, GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_RGB565_A8, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, FALSE, NULL }, - { DRM_FORMAT_BGR565_A8, GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, FALSE, NULL }, + { + .fourcc = DRM_FORMAT_BGRX8888_A8, + .memory_format = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = download_memcpy_3_1, + }, + { + .fourcc = DRM_FORMAT_RGBX8888_A8, + .memory_format = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = download_memcpy_3_1, + }, + { + .fourcc = DRM_FORMAT_XBGR8888_A8, + .memory_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = download_memcpy_3_1, + }, + { + .fourcc = DRM_FORMAT_XRGB8888_A8, + .memory_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = download_memcpy_3_1, + }, + { + .fourcc = DRM_FORMAT_RGB888_A8, + .memory_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGR888_A8, + .memory_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_RGB565_A8, + .memory_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_BGR565_A8, + .memory_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, + .is_yuv = FALSE, + .download = NULL, + }, /* 2-plane YUV formats */ - { DRM_FORMAT_NV12, GDK_MEMORY_R8G8B8, TRUE, download_nv12 }, - { DRM_FORMAT_NV21, GDK_MEMORY_R8G8B8, TRUE, download_nv12 }, - { DRM_FORMAT_NV16, GDK_MEMORY_R8G8B8, TRUE, download_nv12 }, - { DRM_FORMAT_NV61, GDK_MEMORY_R8G8B8, TRUE, download_nv12 }, - { DRM_FORMAT_NV24, GDK_MEMORY_R8G8B8, TRUE, download_nv12 }, - { DRM_FORMAT_NV42, GDK_MEMORY_R8G8B8, TRUE, download_nv12 }, - { DRM_FORMAT_NV15, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_P210, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_P010, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_P012, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_P016, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_P030, GDK_MEMORY_R16G16B16, TRUE, NULL }, + { + .fourcc = DRM_FORMAT_NV12, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_nv12, + }, + { + .fourcc = DRM_FORMAT_NV21, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_nv12, + }, + { + .fourcc = DRM_FORMAT_NV16, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_nv12, + }, + { + .fourcc = DRM_FORMAT_NV61, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_nv12, + }, + { + .fourcc = DRM_FORMAT_NV24, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_nv12, + }, + { + .fourcc = DRM_FORMAT_NV42, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_nv12, + }, + { + .fourcc = DRM_FORMAT_NV15, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_P210, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_P010, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_P012, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_P016, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_P030, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, /* 3-plane YUV */ - { DRM_FORMAT_Q410, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_Q401, GDK_MEMORY_R16G16B16, TRUE, NULL }, - { DRM_FORMAT_YUV410, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, - { DRM_FORMAT_YVU410, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, - { DRM_FORMAT_YUV411, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, - { DRM_FORMAT_YVU411, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, - { DRM_FORMAT_YUV420, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, - { DRM_FORMAT_YVU420, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, - { DRM_FORMAT_YUV422, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, - { DRM_FORMAT_YVU422, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, - { DRM_FORMAT_YUV444, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, - { DRM_FORMAT_YVU444, GDK_MEMORY_R8G8B8, TRUE, download_yuv_3 }, + { + .fourcc = DRM_FORMAT_Q410, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_Q401, + .memory_format = GDK_MEMORY_R16G16B16, + .is_yuv = TRUE, + .download = NULL, + }, + { + .fourcc = DRM_FORMAT_YUV410, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, + { + .fourcc = DRM_FORMAT_YVU410, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, + { + .fourcc = DRM_FORMAT_YUV411, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, + { + .fourcc = DRM_FORMAT_YVU411, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, + { + .fourcc = DRM_FORMAT_YUV420, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, + { + .fourcc = DRM_FORMAT_YVU420, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, + { + .fourcc = DRM_FORMAT_YUV422, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, + { + .fourcc = DRM_FORMAT_YVU422, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, + { + .fourcc = DRM_FORMAT_YUV444, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, + { + .fourcc = DRM_FORMAT_YVU444, + .memory_format = GDK_MEMORY_R8G8B8, + .is_yuv = TRUE, + .download = download_yuv_3, + }, }; static const GdkDrmFormatInfo *