[Mesa-dev] [PATCH v2 2/3] egl: return corresponding offset of EGLImage instead of 0.

Emil Velikov emil.l.velikov at gmail.com
Mon Sep 12 11:19:04 UTC 2016


On 9 September 2016 at 22:03, Axel Davy <axel.davy at ens.fr> wrote:
> I'm not sure calling queryImage with an unsupported attribute is legal, thus
> I think a small check doesn't hurt.
>
> It'd give
>
> if (offsets) {
>    offsets[0] = 0;
>    if (dri2_dpy->image->base.version >= 13) {
>       EGLint img_offset = 0;
>       bool ret = dri2_dpy->image->queryImage(dri2_img->dri_image,
>                                      __DRI_IMAGE_ATTRIB_OFFSET,
> &img_offset);
>       if (ret)
>          offsets[0] = img_offset;
>    }
> }
> return EGL_TRUE;
>
As said - with or w/o the version check things will be just fine.

> or alternatively, if you think not being able to give the offset indicates
> an error,
>
> if (offsets) {
>    offsets[0] = 0;
>    if (dri2_dpy->image->base.version >= 13) {
>       EGLint img_offset = 0;
>       bool ret = dri2_dpy->image->queryImage(dri2_img->dri_image,
>                                      __DRI_IMAGE_ATTRIB_OFFSET,
> &img_offset);
>       if (!ret)
>          return EGL_FALSE;
>       offsets[0] = img_offset;
>    }
> }
> return EGL_TRUE;
>
Unless you/Chuanbo/others volunteer to write/implement the query for
all the drivers, don't do this !!!
It will break as driver X uses a v13+ vfunc, yet does not handle the
offset query.

That said, queryImage() returns GLboolean - let's use that.

Thanks
Emil


More information about the mesa-dev mailing list