The offset should not always be 0. For example, if EGLImage is created from a 2D texture with EGL_GL_TEXTURE_LEVEL=1, then the offset should be the actual start of miplevel 1 in bo.
v2: Add version check of __DRIimageExtension implementation (Suggested by Axel Davy). Signed-off-by: Chuanbo Weng <chuanbo.w...@intel.com> --- src/egl/drivers/dri2/egl_dri2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 859612f..c529e55 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -2249,6 +2249,7 @@ dri2_export_dma_buf_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *im struct dri2_egl_image *dri2_img = dri2_egl_image(img); (void) drv; + EGLint img_offset = 0; /* rework later to provide multiple fds/strides/offsets */ if (fds) @@ -2259,8 +2260,14 @@ dri2_export_dma_buf_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *im dri2_dpy->image->queryImage(dri2_img->dri_image, __DRI_IMAGE_ATTRIB_STRIDE, strides); - if (offsets) + if (offsets){ offsets[0] = 0; + if(dri2_dpy->image->base.version >= 13){ + dri2_dpy->image->queryImage(dri2_img->dri_image, + __DRI_IMAGE_ATTRIB_OFFSET, &img_offset); + offsets[0] = img_offset; + } + } return EGL_TRUE; } -- 1.9.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev