loader/dri3: Also wait for front buffer fence if we triggered it
authorMichel Dänzer <michel.daenzer@amd.com>
Mon, 1 Oct 2018 16:43:46 +0000 (18:43 +0200)
committerMichel Dänzer <michel@daenzer.net>
Thu, 18 Oct 2018 14:52:06 +0000 (16:52 +0200)
In that case, we have to wait for the fence to synchronize with the
corresponding drawing we triggered in the X server.

Fixes incorrect display with the i965 driver and some applications, e.g.
solvespace.

Bugzilla: https://bugs.freedesktop.org/108097
Fixes: aefac10fecc9 "loader/dri3: Only wait for back buffer fences in
                     dri3_get_buffer"
Tested-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
src/loader/loader_dri3_helper.c

index f641a34e6d1e036de73dbaaa2c3aeec49a742851..1981b5f05151765a1c8991ba9fd51349e2962c56 100644 (file)
@@ -1736,6 +1736,7 @@ dri3_get_buffer(__DRIdrawable *driDrawable,
                 struct loader_dri3_drawable *draw)
 {
    struct loader_dri3_buffer *buffer;
+   bool fence_await = buffer_type == loader_dri3_buffer_back;
    int buf_id;
 
    if (buffer_type == loader_dri3_buffer_back) {
@@ -1791,6 +1792,7 @@ dri3_get_buffer(__DRIdrawable *driDrawable,
                            0, 0, 0, 0,
                            draw->width, draw->height);
             dri3_fence_trigger(draw->conn, new_buffer);
+            fence_await = true;
          }
          dri3_free_render_buffer(draw, buffer);
       } else if (buffer_type == loader_dri3_buffer_front) {
@@ -1812,13 +1814,14 @@ dri3_get_buffer(__DRIdrawable *driDrawable,
                                           new_buffer->linear_buffer,
                                           0, 0, draw->width, draw->height,
                                           0, 0, 0);
-         }
+         } else
+            fence_await = true;
       }
       buffer = new_buffer;
       draw->buffers[buf_id] = buffer;
    }
 
-   if (buffer_type == loader_dri3_buffer_back)
+   if (fence_await)
       dri3_fence_await(draw->conn, draw, buffer);
 
    /*