[Mesa-dev] [PATCH 3/4] dri: Add backbuffer use flag

Axel Davy axel.davy at ens.fr
Wed Oct 21 03:28:02 PDT 2015


Add __DRI_IMAGE_USE_BACKBUFFER to indicate the
image is going to be used as a backbuffer.

Backbuffers are going to be attached as
__DRI_BUFFER_BACK_LEFT or
__DRI_BUFFER_BACK_RIGHT.

This flag enables the driver to assume the
buffer will only be read by an external process after
a swapbuffer, in contrary to gbm buffers,
front buffers and fake front buffers, which could be
read after a flush.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 include/GL/internal/dri_interface.h     | 1 +
 src/egl/drivers/dri2/platform_wayland.c | 3 ++-
 src/glx/dri3_glx.c                      | 6 ++++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index a0f155a..555894a 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1091,6 +1091,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_USE_SCANOUT		0x0002
 #define __DRI_IMAGE_USE_CURSOR		0x0004 /* Depricated */
 #define __DRI_IMAGE_USE_LINEAR		0x0008
+#define __DRI_IMAGE_USE_BACKBUFFER	0x0010
 
 
 /**
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 92ff2af..1fbc271 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -352,7 +352,8 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
    if (dri2_surf->back == NULL)
       return -1;
 
-   use_flags = __DRI_IMAGE_USE_SHARE | __DRI_IMAGE_USE_SCANOUT;
+   use_flags = __DRI_IMAGE_USE_SHARE | __DRI_IMAGE_USE_SCANOUT |
+      __DRI_IMAGE_USE_BACKBUFFER;
 
    if (dri2_dpy->is_different_gpu &&
        dri2_surf->back->linear_copy == NULL) {
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 96f13e6..feee6e6 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -880,7 +880,8 @@ dri3_alloc_render_buffer(struct glx_screen *glx_screen, Drawable draw,
                                                   width, height,
                                                   format,
                                                   __DRI_IMAGE_USE_SHARE |
-                                                  __DRI_IMAGE_USE_SCANOUT,
+                                                  __DRI_IMAGE_USE_SCANOUT |
+                                                  __DRI_IMAGE_USE_BACKBUFFER,
                                                   buffer);
       pixmap_buffer = buffer->image;
 
@@ -904,7 +905,8 @@ dri3_alloc_render_buffer(struct glx_screen *glx_screen, Drawable draw,
                                                           width, height,
                                                           format,
                                                           __DRI_IMAGE_USE_SHARE |
-                                                          __DRI_IMAGE_USE_LINEAR,
+                                                          __DRI_IMAGE_USE_LINEAR |
+                                                          __DRI_IMAGE_USE_BACKBUFFER,
                                                           buffer);
       pixmap_buffer = buffer->linear_buffer;
 
-- 
2.6.1



More information about the mesa-dev mailing list