loader_dri3: Support GLX_SWAP_COPY_OML
authorThomas Hellstrom <thellstrom@vmware.com>
Thu, 10 Aug 2017 15:10:47 +0000 (17:10 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 17 Aug 2017 05:39:42 +0000 (07:39 +0200)
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@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/loader/loader_dri3_helper.c
src/loader/loader_dri3_helper.h

index bc7c57f2bb2288d3a81d45490228d83c19a2b6ed..2207b7543b96c799b13bf04fe49e34b02dcd04be 100644 (file)
@@ -311,6 +311,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.
@@ -777,7 +784,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);
index 165c3cc9e086a78c42e133bdc68e20929fea0acf..cd9e8286792f6e4970c9e56fe339b177dfe64812 100644 (file)
@@ -158,6 +158,8 @@ struct loader_dri3_drawable {
 
    struct loader_dri3_extensions *ext;
    const struct loader_dri3_vtable *vtable;
+
+   unsigned int swap_method;
 };
 
 void