[Mesa-dev] [PATCH] egl/dri: fix error value with unknown drm format
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Wed Nov 14 11:37:32 UTC 2018
On 14/11/2018 11:04, Eric Engestrom wrote:
> On Tuesday, 2018-11-13 14:10:45 +0000, Lionel Landwerlin wrote:
>> According to the EGL_EXT_image_dma_buf_import spec, creating an EGL
>> image with a DRM format not supported should yield the BAD_MATCH
>> error :
>>
>> "
>> * If <target> is EGL_LINUX_DMA_BUF_EXT, and the EGL_LINUX_DRM_FOURCC_EXT
>> attribute is set to a format not supported by the EGL, EGL_BAD_MATCH
>> is generated.
>> "
>>
>> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
>> Fixes: 20de7f9f226401 ("egl/dri2: support for creating images out of dma buffers")
> That matches the spec, so:
> Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
>
> That said, Topi specifically wrote this, in his commit (20de7f9f226401):
>> v4 (Chad):
>> - in case of invalid format report EGL_BAD_ATTRIBUTE instead
>> of EGL_BAD_MATCH
> So cc'ing them both so they can mention if they had a need for this?
Yep, it's a bit annoying because :
1. The spec doesn't say anything about FORMAT_INVALID
2. Because new formats can be added, how do we find a format that isn't
supported? (sounds like we could with eglQueryDmaBufFormatsEXT from
EGL_EXT_image_dma_buf_import_modifiers but then that wouldn't work
everywhere...)
>
>> ---
>> src/egl/drivers/dri2/egl_dri2.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
>> index 3b63aebbf9a..198ba73247f 100644
>> --- a/src/egl/drivers/dri2/egl_dri2.c
>> +++ b/src/egl/drivers/dri2/egl_dri2.c
>> @@ -2310,7 +2310,7 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
>> {
>> unsigned plane_n = dri2_num_fourcc_format_planes(attrs->DMABufFourCC.Value);
>> if (plane_n == 0) {
>> - _eglError(EGL_BAD_ATTRIBUTE, "invalid format");
>> + _eglError(EGL_BAD_MATCH, "unknown drm fourcc format");
>> return 0;
>> }
>>
>> --
>> 2.19.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list