[Mesa-dev] [PATCH] Return corresponding offset of EGLImage instead of 0.

Weng, Chuanbo chuanbo.weng at intel.com
Thu Aug 18 02:59:25 UTC 2016


Hi Dave and all,
	(Since Dave implemented this extension EGL_MESA_image_dma_buf_export, so I also send this email to you.)
	Could you please review this patch and push it if it looks good to you? Thanks!

Thanks,
Chuanbo Weng

-----Original Message-----
From: mesa-dev [mailto:mesa-dev-bounces at lists.freedesktop.org] On Behalf Of Eric Engestrom
Sent: Monday, August 15, 2016 10:16 PM
To: Weng, Chuanbo <chuanbo.weng at intel.com>
Cc: mesa-dev at lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] Return corresponding offset of EGLImage instead of 0.

On Mon, Aug 15, 2016 at 08:48:56PM +0800, Chuanbo Weng wrote:
> 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 drm bo.
> 
> Signed-off-by: Chuanbo Weng <chuanbo.weng at intel.com>

LGTM :)
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

> ---
>  include/GL/internal/dri_interface.h      | 2 ++
>  src/egl/drivers/dri2/egl_dri2.c          | 3 ++-
>  src/mesa/drivers/dri/i965/intel_screen.c | 3 +++
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/include/GL/internal/dri_interface.h 
> b/include/GL/internal/dri_interface.h
> index 1c73cce..3d15596 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -1208,6 +1208,8 @@ struct __DRIdri2ExtensionRec {
>  #define __DRI_IMAGE_ATTRIB_FOURCC       0x2008 /* available in versions 11 */
>  #define __DRI_IMAGE_ATTRIB_NUM_PLANES   0x2009 /* available in versions 11 */
>  
> +#define __DRI_IMAGE_ATTRIB_OFFSET 0x200A
> +
>  enum __DRIYUVColorSpace {
>     __DRI_YUV_COLOR_SPACE_UNDEFINED = 0,
>     __DRI_YUV_COLOR_SPACE_ITU_REC601 = 0x327F, diff --git 
> a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c 
> index 3205a36..abedafa 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -2267,7 +2267,8 @@ dri2_export_dma_buf_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *im
>  				  __DRI_IMAGE_ATTRIB_STRIDE, strides);
>  
>     if (offsets)
> -      offsets[0] = 0;
> +      dri2_dpy->image->queryImage(dri2_img->dri_image,
> +				  __DRI_IMAGE_ATTRIB_OFFSET, offsets);
>  
>     return EGL_TRUE;
>  }
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
> b/src/mesa/drivers/dri/i965/intel_screen.c
> index ae51c40..d20e463 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -613,6 +613,9 @@ intel_query_image(__DRIimage *image, int attrib, int *value)
>     case __DRI_IMAGE_ATTRIB_NUM_PLANES:
>        *value = 1;
>        return true;
> +   case __DRI_IMAGE_ATTRIB_OFFSET:
> +      *value = image->offset;
> +      return true;
>  
>    default:
>        return false;
> --
> 1.9.1
_______________________________________________
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