diff options
author | Daniel Stone <[email protected]> | 2017-07-31 18:34:57 +0100 |
---|---|---|
committer | Daniel Stone <[email protected]> | 2017-08-11 10:25:53 +0100 |
commit | 7d26a52a7a29b2361164b241ba3ae61b46b4fc69 (patch) | |
tree | bbdb2b07a966b3dbcdc2bd780345009e4da86955 /src/egl | |
parent | 81615ad444ba970d144eeffbe60a7f70adc30b5b (diff) |
egl/dri2: Allow modifiers to add FDs to imports
When using dmabuf import, make sure that the modifier is actually
allowed to add planes to the base format, as implied by the comment.
Signed-off-by: Daniel Stone <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Reviewed-by: Philipp Zabel <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index f584740751a..975d39d1e49 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -2155,6 +2155,24 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs) return 0; } + for (unsigned i = plane_n; i < DMA_BUF_MAX_PLANES; i++) { + /** + * The modifiers extension spec says: + * + * "Modifiers may modify any attribute of a buffer import, including + * but not limited to adding extra planes to a format which + * otherwise does not have those planes. As an example, a modifier + * may add a plane for an external compression buffer to a + * single-plane format. The exact meaning and effect of any + * modifier is canonically defined by drm_fourcc.h, not as part of + * this extension." + */ + if (attrs->DMABufPlaneModifiersLo[i].IsPresent && + attrs->DMABufPlaneModifiersHi[i].IsPresent) { + plane_n = i + 1; + } + } + /** * The spec says: * @@ -2181,25 +2199,7 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs) for (unsigned i = plane_n; i < DMA_BUF_MAX_PLANES; ++i) { if (attrs->DMABufPlaneFds[i].IsPresent || attrs->DMABufPlaneOffsets[i].IsPresent || - attrs->DMABufPlanePitches[i].IsPresent || - attrs->DMABufPlaneModifiersLo[i].IsPresent || - attrs->DMABufPlaneModifiersHi[i].IsPresent) { - - /** - * The modifiers extension spec says: - * - * "Modifiers may modify any attribute of a buffer import, including - * but not limited to adding extra planes to a format which - * otherwise does not have those planes. As an example, a modifier - * may add a plane for an external compression buffer to a - * single-plane format. The exact meaning and effect of any - * modifier is canonically defined by drm_fourcc.h, not as part of - * this extension." - */ - if (attrs->DMABufPlaneModifiersLo[i].IsPresent && - attrs->DMABufPlaneModifiersHi[i].IsPresent) - continue; - + attrs->DMABufPlanePitches[i].IsPresent) { _eglError(EGL_BAD_ATTRIBUTE, "too many plane attributes"); return 0; } |