[Mesa-dev] [PATCH 07/11] loader_dri3: Support GLX_SWAP_COPY_OML

Thomas Hellstrom thellstrom at vmware.com
Fri Aug 11 14:14:16 UTC 2017


Support the GLX_SWAP_COPY_OML method. When this method is requested, we use
the same swapbuffer code path as EGL_BUFFER_PRESERVED.

Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
---
 src/loader/loader_dri3_helper.c | 9 ++++++++-
 src/loader/loader_dri3_helper.h | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 812adcc..774256f 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -301,6 +301,13 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
    draw->vtable->set_drawable_size(draw, draw->width, draw->height);
    free(reply);
 
+   draw->swap_method = __DRI_ATTRIB_SWAP_UNDEFINED;
+   if (draw->ext->core->base.version >= 2) {
+      (void )draw->ext->core->getConfigAttrib(dri_config,
+                                              __DRI_ATTRIB_SWAP_METHOD,
+                                              &draw->swap_method);
+   }
+
    /*
     * Make sure server has the same swap interval we do for the new
     * drawable.
@@ -767,7 +774,7 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable *draw,
     * The force_copy parameter is used by EGL to attempt to preserve
     * the back buffer across a call to this function.
     */
-   if (force_copy)
+   if (draw->swap_method == __DRI_ATTRIB_SWAP_COPY || force_copy)
       draw->cur_blit_source = LOADER_DRI3_BACK_ID(draw->cur_back);
 
    dri3_flush_present_events(draw);
diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h
index 82c5363..f7db45d 100644
--- a/src/loader/loader_dri3_helper.h
+++ b/src/loader/loader_dri3_helper.h
@@ -160,6 +160,7 @@ struct loader_dri3_drawable {
    const struct loader_dri3_vtable *vtable;
 
    bool have_image_blit;
+   unsigned int swap_method;
 };
 
 void
-- 
2.7.4



More information about the mesa-dev mailing list