summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2019-04-30 17:50:15 +0200
committerMichel Dänzer <michel@daenzer.net>2019-04-30 17:50:15 +0200
commit4b17533fcb30842caf0035ba593b7d986520cc85 (patch)
treea5aa888e10eba1b9f90997ebfa0a1a18d3e15e1d
parentbf61e6d7ac1a5754b1026d7f80acf25ef622c491 (diff)
dri3: Always flush glamor before sharing pixmap storage with clients
Even if glamor_gbm_bo_from_pixmap / glamor_fd_from_pixmap themselves don't trigger any drawing, there could already be unflushed drawing to the pixmap whose storage we share with a client.
-rw-r--r--src/amdgpu_dri3.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/amdgpu_dri3.c b/src/amdgpu_dri3.c
index 7f1745e..ed1e2f9 100644
--- a/src/amdgpu_dri3.c
+++ b/src/amdgpu_dri3.c
@@ -221,29 +221,13 @@ static int amdgpu_dri3_fd_from_pixmap(ScreenPtr screen,
AMDGPUInfoPtr info = AMDGPUPTR(scrn);
if (info->use_glamor) {
- Bool need_flush = TRUE;
- int ret = -1;
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,19,99,904,0)
- struct gbm_bo *gbm_bo = glamor_gbm_bo_from_pixmap(screen, pixmap);
+ int ret = glamor_fd_from_pixmap(screen, pixmap, stride, size);
- if (gbm_bo) {
- ret = gbm_bo_get_fd(gbm_bo);
- gbm_bo_destroy(gbm_bo);
-
- if (ret >= 0)
- need_flush = FALSE;
- }
-#endif
-
- if (ret < 0)
- ret = glamor_fd_from_pixmap(screen, pixmap, stride, size);
-
- /* glamor might have needed to reallocate the pixmap storage and
- * copy the pixmap contents to the new storage. The copy
- * operation needs to be flushed to the kernel driver before the
- * client starts using the pixmap storage for direct rendering.
+ /* Any pending drawing operations need to be flushed to the
+ * kernel driver before the client starts using the pixmap
+ * storage for direct rendering.
*/
- if (ret >= 0 && need_flush)
+ if (ret >= 0)
amdgpu_glamor_flush(scrn);
return ret;