[Mesa-dev] [PATCH v3 03/15] egl: introduce DMA_BUF_MAX_PLANES

Varad Gautam varadgautam at gmail.com
Wed May 10 17:45:30 UTC 2017


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

Rather than hardcoding 3, use a #define. Makes it easier to bump this
later to 4.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
Signed-off-by: Varad Gautam <varad.gautam at collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
 src/egl/drivers/dri2/egl_dri2.c | 8 ++++----
 src/egl/main/eglimage.h         | 8 +++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0be7132..c8044c2 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2054,7 +2054,7 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
     *  generated if any of the EGL_DMA_BUF_PLANE1_* or EGL_DMA_BUF_PLANE2_*
     *  attributes are specified."
     */
-   for (i = plane_n; i < 3; ++i) {
+   for (i = plane_n; i < DMA_BUF_MAX_PLANES; ++i) {
       if (attrs->DMABufPlaneFds[i].IsPresent ||
           attrs->DMABufPlaneOffsets[i].IsPresent ||
           attrs->DMABufPlanePitches[i].IsPresent) {
@@ -2087,9 +2087,9 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
    __DRIimage *dri_image;
    unsigned num_fds;
    unsigned i;
-   int fds[3];
-   int pitches[3];
-   int offsets[3];
+   int fds[DMA_BUF_MAX_PLANES];
+   int pitches[DMA_BUF_MAX_PLANES];
+   int offsets[DMA_BUF_MAX_PLANES];
    unsigned error;
 
    /**
diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h
index 0dd5e12..9a75d0c 100644
--- a/src/egl/main/eglimage.h
+++ b/src/egl/main/eglimage.h
@@ -46,6 +46,8 @@ struct _egl_image_attrib_int
    EGLBoolean IsPresent;
 };
 
+#define DMA_BUF_MAX_PLANES 3
+
 struct _egl_image_attribs
 {
    /* EGL_KHR_image_base */
@@ -67,9 +69,9 @@ struct _egl_image_attribs
 
    /* EGL_EXT_image_dma_buf_import */
    struct _egl_image_attrib_int DMABufFourCC;
-   struct _egl_image_attrib_int DMABufPlaneFds[3];
-   struct _egl_image_attrib_int DMABufPlaneOffsets[3];
-   struct _egl_image_attrib_int DMABufPlanePitches[3];
+   struct _egl_image_attrib_int DMABufPlaneFds[DMA_BUF_MAX_PLANES];
+   struct _egl_image_attrib_int DMABufPlaneOffsets[DMA_BUF_MAX_PLANES];
+   struct _egl_image_attrib_int DMABufPlanePitches[DMA_BUF_MAX_PLANES];
    struct _egl_image_attrib_int DMABufYuvColorSpaceHint;
    struct _egl_image_attrib_int DMABufSampleRangeHint;
    struct _egl_image_attrib_int DMABufChromaHorizontalSiting;
-- 
2.10.0



More information about the mesa-dev mailing list