[Mesa-dev] [PATCH 2/3] egl: return corresponding offset of EGLImage instead of 0.
Chuanbo Weng
chuanbo.weng at intel.com
Tue Sep 6 09:06:46 UTC 2016
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.
Signed-off-by: Chuanbo Weng <chuanbo.weng at intel.com>
---
src/egl/drivers/dri2/egl_dri2.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 859612f..8ef0acd 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2249,6 +2249,8 @@ dri2_export_dma_buf_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *im
struct dri2_egl_image *dri2_img = dri2_egl_image(img);
(void) drv;
+ EGLBoolean ret = EGL_TRUE;
+ EGLint img_offset = 0;
/* rework later to provide multiple fds/strides/offsets */
if (fds)
@@ -2259,10 +2261,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)
- offsets[0] = 0;
+ if (offsets){
+ ret = dri2_dpy->image->queryImage(dri2_img->dri_image,
+ __DRI_IMAGE_ATTRIB_OFFSET, &img_offset);
+ if(ret == EGL_TRUE)
+ offsets[0] = img_offset;
+ }
- return EGL_TRUE;
+ return ret;
}
#endif
--
1.9.1
More information about the mesa-dev
mailing list