summaryrefslogtreecommitdiffstats
path: root/src/loader
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2017-06-22 09:24:34 +0200
committerThomas Hellstrom <[email protected]>2017-08-02 13:29:20 +0200
commit185ef06fd2db782d9d3d6046580f7cece02c4797 (patch)
tree0a9ca611a95b603533ee019aa0cfb7166fdbd333 /src/loader
parentdd4e817b7f10ffffdadccae3b954b4d4c69248a9 (diff)
dri3: Wait for all pending swapbuffers to be scheduled before touching the front
This implements a wait for glXWaitGL, glXCopySubBuffer, dri flush_front and creation of fake front until all pending SwapBuffers have been committed to hardware. Among other things this fixes piglit glx-copy-sub-buffers on dri3. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Cc: <[email protected]>
Diffstat (limited to 'src/loader')
-rw-r--r--src/loader/loader_dri3_helper.c18
-rw-r--r--src/loader/loader_dri3_helper.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index b3c36e23ae9..1f666fcb8d4 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -503,6 +503,7 @@ loader_dri3_copy_sub_buffer(struct loader_dri3_drawable *draw,
x, y, width, height, __BLIT_FLAG_FLUSH);
}
+ loader_dri3_swapbuffer_barrier(draw);
dri3_fence_reset(draw->conn, back);
dri3_copy_area(draw->conn,
dri3_back_buffer(draw)->pixmap,
@@ -594,6 +595,7 @@ loader_dri3_wait_gl(struct loader_dri3_drawable *draw)
front->height,
0, 0, front->width,
front->height, __BLIT_FLAG_FLUSH);
+ loader_dri3_swapbuffer_barrier(draw);
loader_dri3_copy_drawable(draw, draw->drawable, front->pixmap);
}
@@ -1257,6 +1259,7 @@ dri3_get_buffer(__DRIdrawable *driDrawable,
}
break;
case loader_dri3_buffer_front:
+ loader_dri3_swapbuffer_barrier(draw);
dri3_fence_reset(draw->conn, new_buffer);
dri3_copy_area(draw->conn,
draw->drawable,
@@ -1430,3 +1433,18 @@ loader_dri3_update_drawable_geometry(struct loader_dri3_drawable *draw)
free(geom_reply);
}
}
+
+
+/**
+ * Make sure the server has flushed all pending swap buffers to hardware
+ * for this drawable. Ideally we'd want to send an X protocol request to
+ * have the server block our connection until the swaps are complete. That
+ * would avoid the potential round-trip here.
+ */
+void
+loader_dri3_swapbuffer_barrier(struct loader_dri3_drawable *draw)
+{
+ int64_t ust, msc, sbc;
+
+ (void) loader_dri3_wait_for_sbc(draw, 0, &ust, &msc, &sbc);
+}
diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h
index 628b0f9f09e..90ee2007afb 100644
--- a/src/loader/loader_dri3_helper.h
+++ b/src/loader/loader_dri3_helper.h
@@ -240,4 +240,7 @@ loader_dri3_get_buffers(__DRIdrawable *driDrawable,
void
loader_dri3_update_drawable_geometry(struct loader_dri3_drawable *draw);
+
+void
+loader_dri3_swapbuffer_barrier(struct loader_dri3_drawable *draw);
#endif