summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuanbo Weng <chuanbo.weng@intel.com>2016-09-14 01:07:10 +0800
committerEmil Velikov <emil.l.velikov@gmail.com>2016-09-21 12:19:19 +0100
commit9e8de866f749a26d57c315da8c37799acbbff091 (patch)
treedd8a26174d49ad87cd517a35d024f89f0f342165
parent1ceb775d5738365e82221773656c3b70e98bc1d3 (diff)
egl: return corresponding offset of EGLImage instead of 0.
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). v3: Don't add version check of __DRIimageExtension implementation. Set the offset only when queryImage() succeeds. (Suggested by Emil Velikov) Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> [Emil Velikov: coding style fixes] Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index bbc457c8bb..8e376e32d7 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2259,8 +2259,15 @@ 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) {
+ int img_offset;
+ bool ret = dri2_dpy->image->queryImage(dri2_img->dri_image,
+ __DRI_IMAGE_ATTRIB_OFFSET, &img_offset);
+ if (ret)
+ offsets[0] = img_offset;
+ else
+ offsets[0] = 0;
+ }
return EGL_TRUE;
}