[Mesa-dev] [PATCH 1/2] dri: add initial support for R8 and {RG, GR}88 image formats.

Gwenole Beauchesne gb.devel at gmail.com
Mon Mar 10 09:35:59 PDT 2014


In order to support mapping of planar YUV surfaces on a per-plane basis,
it looks convenient to consider those planes as a buffer of red (8-bit),
resp. red/green (16-bit), components.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 include/GL/internal/dri_interface.h |    4 ++++
 src/egl/drivers/dri2/egl_dri2.c     |   15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index d028d05..3a946c3 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1060,6 +1060,8 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FOURCC_NV12		0x3231564e
 #define __DRI_IMAGE_FOURCC_NV16		0x3631564e
 #define __DRI_IMAGE_FOURCC_YUYV		0x56595559
+#define __DRI_IMAGE_FOURCC_R8		0x20203852
+#define __DRI_IMAGE_FOURCC_RG88		0x38384752
 
 
 /**
@@ -1080,6 +1082,8 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_COMPONENTS_Y_U_V	0x3003
 #define __DRI_IMAGE_COMPONENTS_Y_UV	0x3004
 #define __DRI_IMAGE_COMPONENTS_Y_XUXV	0x3005
+#define __DRI_IMAGE_COMPONENTS_R	0x3006
+#define __DRI_IMAGE_COMPONENTS_RG	0x3007
 
 
 /**
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 892f1f4..7f389f6 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1430,6 +1430,16 @@ dri2_check_dma_buf_attribs(const _EGLImageAttribs *attrs)
    return EGL_TRUE;
 }
 
+#ifndef DRM_FORMAT_R8
+#define DRM_FORMAT_R8   fourcc_code('R','8',' ',' ') /* [7:0] R */
+#endif
+#ifndef DRM_FORMAT_RG88
+#define DRM_FORMAT_RG88 fourcc_code('R','G','8','8') /* [15:0] R:G 8:8 litte endian */
+#endif
+#ifndef DRM_FORMAT_GR88
+#define DRM_FORMAT_GR88 fourcc_code('G','R','8','8') /* [15:0] G:R 8:8 little endian */
+#endif
+
 /* Returns the total number of file descriptors. Zero indicates an error. */
 static unsigned
 dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
@@ -1499,6 +1509,11 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
    case DRM_FORMAT_YVU444:
       plane_n = 3;
       break;
+   case DRM_FORMAT_R8:
+   case DRM_FORMAT_RG88:
+   case DRM_FORMAT_GR88:
+      plane_n = 1;
+      break;
    default:
       _eglError(EGL_BAD_ATTRIBUTE, "invalid format");
       return 0;
-- 
1.7.9.5



More information about the mesa-dev mailing list