diff options
author | Varad Gautam <[email protected]> | 2017-05-30 17:23:37 +0530 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2017-05-30 13:56:20 +0100 |
commit | 6f10e7c37a34570f61fa2db8fc1860553207b7e9 (patch) | |
tree | 005219e2144e17d1f687b52c2c8f58275fba96cf /src/egl/main | |
parent | c5929634a01eb0adcc0cc59c4c9b6304492d74f5 (diff) |
egl/dri2: Create EGLImages with dmabuf modifiers
Allow creating EGLImages with dmabuf format modifiers when target is
EGL_LINUX_DMA_BUF_EXT for EGL_EXT_image_dma_buf_import_modifiers.
v2:
- clear modifier assembling and error label name (Eric Engestrom)
v3:
- remove goto jumps within switch-case (Emil Velikov)
- treat zero as valid modifier (Daniel Stone)
- ensure same modifier across all dmabuf planes (Emil Velikov)
v4:
- allow modifiers to add extra planes (Louis-Francis Ratté-Boulianne)
v5:
- fix error checking, some cleanups (Jason Ekstrand)
- pass single copy of the modifier to createImageFromDmaBufs2
Signed-off-by: Pekka Paalanen <[email protected]>
Signed-off-by: Varad Gautam <[email protected]>
Signed-off-by: Louis-Francis Ratté-Boulianne <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Daniel Stone <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/main')
-rw-r--r-- | src/egl/main/eglimage.c | 48 | ||||
-rw-r--r-- | src/egl/main/eglimage.h | 2 |
2 files changed, 50 insertions, 0 deletions
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c index fed390a4982..c558f2f02b0 100644 --- a/src/egl/main/eglimage.c +++ b/src/egl/main/eglimage.c @@ -106,6 +106,18 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, attrs->DMABufPlanePitches[0].Value = val; attrs->DMABufPlanePitches[0].IsPresent = EGL_TRUE; break; + case EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT: + if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers) + err = EGL_BAD_PARAMETER; + attrs->DMABufPlaneModifiersLo[0].Value = val; + attrs->DMABufPlaneModifiersLo[0].IsPresent = EGL_TRUE; + break; + case EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT: + if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers) + err = EGL_BAD_PARAMETER; + attrs->DMABufPlaneModifiersHi[0].Value = val; + attrs->DMABufPlaneModifiersHi[0].IsPresent = EGL_TRUE; + break; case EGL_DMA_BUF_PLANE1_FD_EXT: attrs->DMABufPlaneFds[1].Value = val; attrs->DMABufPlaneFds[1].IsPresent = EGL_TRUE; @@ -118,6 +130,18 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, attrs->DMABufPlanePitches[1].Value = val; attrs->DMABufPlanePitches[1].IsPresent = EGL_TRUE; break; + case EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT: + if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers) + err = EGL_BAD_PARAMETER; + attrs->DMABufPlaneModifiersLo[1].Value = val; + attrs->DMABufPlaneModifiersLo[1].IsPresent = EGL_TRUE; + break; + case EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT: + if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers) + err = EGL_BAD_PARAMETER; + attrs->DMABufPlaneModifiersHi[1].Value = val; + attrs->DMABufPlaneModifiersHi[1].IsPresent = EGL_TRUE; + break; case EGL_DMA_BUF_PLANE2_FD_EXT: attrs->DMABufPlaneFds[2].Value = val; attrs->DMABufPlaneFds[2].IsPresent = EGL_TRUE; @@ -130,6 +154,18 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, attrs->DMABufPlanePitches[2].Value = val; attrs->DMABufPlanePitches[2].IsPresent = EGL_TRUE; break; + case EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT: + if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers) + err = EGL_BAD_PARAMETER; + attrs->DMABufPlaneModifiersLo[2].Value = val; + attrs->DMABufPlaneModifiersLo[2].IsPresent = EGL_TRUE; + break; + case EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT: + if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers) + err = EGL_BAD_PARAMETER; + attrs->DMABufPlaneModifiersHi[2].Value = val; + attrs->DMABufPlaneModifiersHi[2].IsPresent = EGL_TRUE; + break; case EGL_DMA_BUF_PLANE3_FD_EXT: if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers) err = EGL_BAD_PARAMETER; @@ -148,6 +184,18 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, attrs->DMABufPlanePitches[3].Value = val; attrs->DMABufPlanePitches[3].IsPresent = EGL_TRUE; break; + case EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT: + if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers) + err = EGL_BAD_PARAMETER; + attrs->DMABufPlaneModifiersLo[3].Value = val; + attrs->DMABufPlaneModifiersLo[3].IsPresent = EGL_TRUE; + break; + case EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT: + if (!dpy->Extensions.EXT_image_dma_buf_import_modifiers) + err = EGL_BAD_PARAMETER; + attrs->DMABufPlaneModifiersHi[3].Value = val; + attrs->DMABufPlaneModifiersHi[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 a909d9b5889..eb66280ff96 100644 --- a/src/egl/main/eglimage.h +++ b/src/egl/main/eglimage.h @@ -73,6 +73,8 @@ struct _egl_image_attribs 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 DMABufPlaneModifiersLo[DMA_BUF_MAX_PLANES]; + struct _egl_image_attrib_int DMABufPlaneModifiersHi[DMA_BUF_MAX_PLANES]; struct _egl_image_attrib_int DMABufYuvColorSpaceHint; struct _egl_image_attrib_int DMABufSampleRangeHint; struct _egl_image_attrib_int DMABufChromaHorizontalSiting; |