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
--- 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
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to