Mesa (master): egl: Add support for DRM_FORMAT_R8, RG88, and GR88

Chad Versace chadversary at kemper.freedesktop.org
Tue Jul 28 18:46:05 UTC 2015


Module: Mesa
Branch: master
Commit: fd865d56d2229d8c5d7ea893ac1dba525d88e647
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd865d56d2229d8c5d7ea893ac1dba525d88e647

Author: Chad Versace <chad.versace at intel.com>
Date:   Tue Jun 23 15:48:17 2015 -0700

egl: Add support for DRM_FORMAT_R8, RG88, and GR88

The Kodi/XBMC developers want to transcode NV12 to RGB with OpenGL shaders,
importing the two source planes through EGL_EXT_image_dma_buf_import. That
requires importing the Y plane as an R8 EGLImage and the UV plane as either an
RG88 or GR88 EGLImage.

This patch teaches the driver-independent part of EGL about the new
formats. Real driver support is left for follow-up patches.

The new formats landed in airlied's kernel branch 'drm-next' on July 24.

Tested-by: Peter Frühberger <peter.fruehberger at gmail.com>
Signed-off-by: Chad Versace <chad.versace at intel.com>

---

 src/egl/drivers/dri2/egl_dri2.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index e5aa396..e3afab4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -54,6 +54,22 @@
 #include "egl_dri2.h"
 #include "../util/u_atomic.h"
 
+/* The kernel header drm_fourcc.h defines the DRM formats below.  We duplicate
+ * some of the definitions here so that building Mesa won't bleeding-edge
+ * kernel headers.
+ */
+#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 little 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
+
 const __DRIuseInvalidateExtension use_invalidate = {
    .base = { __DRI_USE_INVALIDATE, 1 }
 };
@@ -1727,6 +1743,9 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
    unsigned i, plane_n;
 
    switch (attrs->DMABufFourCC.Value) {
+   case DRM_FORMAT_R8:
+   case DRM_FORMAT_RG88:
+   case DRM_FORMAT_GR88:
    case DRM_FORMAT_RGB332:
    case DRM_FORMAT_BGR233:
    case DRM_FORMAT_XRGB4444:




More information about the mesa-commit mailing list