[Mesa-dev] [PATCH 04/13] egl/main: add support for fourth plane tokens

Varad Gautam varadgautam at gmail.com
Tue Nov 15 14:24:25 UTC 2016


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

The EGL_EXT_dma_buf_import_modifiers extension adds support for a
fourth plane, just like DRM KMS API does.

Bump maximum dma_buf plane count to four.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
Signed-off-by: Varad Gautam <varad.gautam at collabora.com>
---
 src/egl/drivers/dri2/egl_dri2.c |  2 +-
 src/egl/main/eglimage.c         | 12 ++++++++++++
 src/egl/main/eglimage.h         |  2 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 9a41ad0..58d16e1 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2038,7 +2038,7 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
     * "If <target> is EGL_LINUX_DMA_BUF_EXT, and the EGL_LINUX_DRM_FOURCC_EXT
     *  attribute indicates a single-plane format, EGL_BAD_ATTRIBUTE is
     *  generated if any of the EGL_DMA_BUF_PLANE1_* or EGL_DMA_BUF_PLANE2_*
-    *  attributes are specified."
+    *  or EGL_DMA_BUF_PLANE3_* attributes are specified."
     */
    for (i = plane_n; i < DMA_BUF_MAX_PLANES; ++i) {
       if (attrs->DMABufPlaneFds[i].IsPresent ||
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 411d1ca..cd170c6 100644
--- a/src/egl/main/eglimage.c
+++ b/src/egl/main/eglimage.c
@@ -133,6 +133,18 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
          attrs->DMABufPlanePitches[2].Value = val;
          attrs->DMABufPlanePitches[2].IsPresent = EGL_TRUE;
          break;
+      case EGL_DMA_BUF_PLANE3_FD_EXT:
+         attrs->DMABufPlaneFds[3].Value = val;
+         attrs->DMABufPlaneFds[3].IsPresent = EGL_TRUE;
+         break;
+      case EGL_DMA_BUF_PLANE3_OFFSET_EXT:
+         attrs->DMABufPlaneOffsets[3].Value = val;
+         attrs->DMABufPlaneOffsets[3].IsPresent = EGL_TRUE;
+         break;
+      case EGL_DMA_BUF_PLANE3_PITCH_EXT:
+         attrs->DMABufPlanePitches[3].Value = val;
+         attrs->DMABufPlanePitches[3].IsPresent = EGL_TRUE;
+         break;
       case EGL_YUV_COLOR_SPACE_HINT_EXT:
          if (val != EGL_ITU_REC601_EXT && val != EGL_ITU_REC709_EXT &&
              val != EGL_ITU_REC2020_EXT) {
diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h
index 9a75d0c..2c110c7 100644
--- a/src/egl/main/eglimage.h
+++ b/src/egl/main/eglimage.h
@@ -46,7 +46,7 @@ struct _egl_image_attrib_int
    EGLBoolean IsPresent;
 };
 
-#define DMA_BUF_MAX_PLANES 3
+#define DMA_BUF_MAX_PLANES 4
 
 struct _egl_image_attribs
 {
-- 
2.6.2



More information about the mesa-dev mailing list