[Mesa-dev] Allow linear texture allocation for eglCreateDRMImageMESA

Eric Engestrom eric.engestrom at imgtec.com
Fri Feb 10 17:30:23 UTC 2017


On Friday, 2017-02-10 09:27:51 +0100, Volker Vogelhuber wrote:
> Hi,
> I'm currently try to stream video data to an OpenGL texture.
> While using the EGL_DRM_BUFFER_USE_SCANOUT_MESA flag
> when creating the memory for the texture makes it at least
> a bit easier (only X-tiling instead of Y-tiling on my intel GPU), it
> is still tricky to compensate the tiling in the shader. I wonder why
> there is no export of the __DRI_IMAGE_USE_LINEAR flag for
> calling dri2_create_drm_image_mesa. Attached is a patch that
> would do that and works so far without any problem (tested with
> an AMD G-Series and Intel Bay- and Cherry-Trail).
> 
> Regards,
>    Volker

This would require a change in the spec [1]. I suggest you have a look
at it and see if you can suggest a change there as well, to explain your
reasoning.

Your suggestion seems reasonable enough, but I personally don't know
enough about this particular subject to have an opinion either way.
I hope you'll find someone more knowledgeable to help you :)

(A couple nits: your new #define should go in eglmesaext.h, as eglext.h is
the synced down header from Khronos [2], and it should have the _MESA suffix
as it is a Mesa extension.)

BTW, you should send your patches inlined, for easier reviewing. You can
do that using `git send-email` for instance.
See the docs on our website [3] for more information.

Cheers,
  Eric

[1] docs/specs/MESA_drm_image.spec
[2] https://www.khronos.org/registry/EGL/api/EGL/eglext.h
[3] https://www.mesa3d.org/submittingpatches.html#mailing

> --- a/src/egl/drivers/dri2/egl_dri2.c	2017-02-03 19:52:00.278361176 +0100
> +++ b/src/egl/drivers/dri2/egl_dri2.c	2017-02-06 16:51:02.831727768 +0100
> @@ -2186,7 +2186,8 @@
>     valid_mask =
>        EGL_DRM_BUFFER_USE_SCANOUT_MESA |
>        EGL_DRM_BUFFER_USE_SHARE_MESA |
> -      EGL_DRM_BUFFER_USE_CURSOR_MESA;
> +      EGL_DRM_BUFFER_USE_CURSOR_MESA |
> +      EGL_DRM_BUFFER_USE_LINEAR;
>     if (attrs.DRMBufferUseMESA & ~valid_mask) {
>        _eglLog(_EGL_WARNING, "bad image use bit 0x%04x",
>              attrs.DRMBufferUseMESA & ~valid_mask);
> @@ -2200,6 +2201,8 @@
>        dri_use |= __DRI_IMAGE_USE_SCANOUT;
>     if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_CURSOR_MESA)
>        dri_use |= __DRI_IMAGE_USE_CURSOR;
> +   if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_LINEAR)
> +      dri_use |= __DRI_IMAGE_USE_LINEAR;
>  
>     dri2_img->dri_image =
>        dri2_dpy->image->createImage(dri2_dpy->dri_screen,
> --- a/include/EGL/eglext.h	2017-02-03 19:52:00.278361176 +0100
> +++ b/include/EGL/eglext.h	2017-02-06 16:54:58.436899101 +0100
> @@ -780,6 +780,7 @@
>  #define EGL_DRM_BUFFER_STRIDE_MESA        0x31D4
>  #define EGL_DRM_BUFFER_USE_SCANOUT_MESA   0x00000001
>  #define EGL_DRM_BUFFER_USE_SHARE_MESA     0x00000002
> +#define EGL_DRM_BUFFER_USE_LINEAR         0x00000008
>  typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
>  typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
>  #ifdef EGL_EGLEXT_PROTOTYPES


More information about the mesa-dev mailing list