Skip to contentSkip to conversation

dri3: Always flush glamor before sharing pixmap storage with clients

PATCH In review Michel Dänzer 2 participants 2 messages May 9, 2019 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dri3: Always flush glamor before sharing pixmap storage with clients

From: Michel Dänzer <[email protected]>

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.

(Ported from amdgpu commit 4b17533fcb30842caf0035ba593b7d986520cc85)

---
 src/radeon_dri3.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
src/radeon_dri3.c +5 -21
index 73353bf51..f8f91c4b4 100644
@@ -220,29 +220,13 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
 	RADEONInfoPtr info = RADEONPTR(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)
 			radeon_cs_flush_indirect(scrn);
 
 		return ret;
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190509103820.3657-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Acked-by
#2 lore raw
Quoted 10 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

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.

(Ported from amdgpu commit 4b17533fcb30842caf0035ba593b7d986520cc85)

Quoted 46 lines
---
 src/radeon_dri3.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
src/radeon_dri3.c +5 -22
index 73353bf51..f8f91c4b4 100644
@@ -220,29 +220,13 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
        RADEONInfoPtr info = RADEONPTR(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)
                        radeon_cs_flush_indirect(scrn);
 
                return ret;
--

2.20.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx