xf86-video-amdgpu: Branch 'master' - 3 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 16 17:42:40 UTC 2019


 src/amdgpu_dri2.c   |    6 ++++++
 src/amdgpu_dri3.c   |   31 +++++++++++++++++++++++++++++--
 src/amdgpu_glamor.c |    2 +-
 3 files changed, 36 insertions(+), 3 deletions(-)

New commits:
commit bf326f2ea19daa6c8da23d6788ff301ae70b8e69
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Jan 10 18:33:04 2019 +0100

    glamor: Avoid glamor_create_pixmap for pixmaps backing windows
    
    If the compositing manager uses direct rendering (as is usually the case
    these days), the storage of a pixmap allocated by glamor_create_pixmap
    needs to be reallocated for sharing it with the compositing manager.
    Instead, allocate pixmap storage which can be shared directly.
    
    Acked-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 316870a..5b8d560 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -215,7 +215,7 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 
 			usage |= AMDGPU_CREATE_PIXMAP_LINEAR |
 				 AMDGPU_CREATE_PIXMAP_GTT;
-		} else {
+		} else if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP) {
 			pixmap = glamor_create_pixmap(screen, w, h, depth, usage);
 			if (pixmap)
 				return pixmap;
commit ebd32b1c07208f8dbe853e089f5e4b7c6a7a658a
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Jan 9 18:57:08 2019 +0100

    dri2: Flush in dri2_create_buffer2 after calling glamor_set_pixmap_bo
    
    To make sure the client can't use the shared pixmap storage for direct
    rendering first, which could produce garbage.
    
    Bugzilla: https://bugs.freedesktop.org/109235
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index ff1b94a..a6b76a1 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -171,6 +171,12 @@ amdgpu_dri2_create_buffer2(ScreenPtr pScreen,
 	if (is_glamor_pixmap) {
 		pixmap = amdgpu_glamor_set_pixmap_bo(drawable, pixmap);
 		pixmap->refcnt++;
+
+		/* The copy operation from amdgpu_glamor_set_pixmap_bo needs to
+		 * be flushed to the kernel driver before the client starts
+		 * using the pixmap storage for direct rendering.
+		 */
+		amdgpu_glamor_flush(pScrn);
 	}
 
 	if (!amdgpu_get_flink_name(pAMDGPUEnt, pixmap, &buffers->name))
commit d168532ee739f7e33a2798051e64ba445dd3859f
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Jan 9 17:24:11 2019 +0100

    dri3: Flush if necessary in dri3_fd_from_pixmap
    
    To make sure the client can't use the shared pixmap storage for direct
    rendering first, which could produce garbage.
    
    Bugzilla: https://bugs.freedesktop.org/109235
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_dri3.c b/src/amdgpu_dri3.c
index 84a03dc..7f1745e 100644
--- a/src/amdgpu_dri3.c
+++ b/src/amdgpu_dri3.c
@@ -37,6 +37,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <gbm.h>
 #include <errno.h>
 #include <libgen.h>
 
@@ -219,8 +220,34 @@ static int amdgpu_dri3_fd_from_pixmap(ScreenPtr screen,
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 	AMDGPUInfoPtr info = AMDGPUPTR(scrn);
 
-	if (info->use_glamor)
-		return glamor_fd_from_pixmap(screen, pixmap, stride, size);
+	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);
+
+		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.
+		 */
+		if (ret >= 0 && need_flush)
+			amdgpu_glamor_flush(scrn);
+
+		return ret;
+	}
 #endif
 
 	bo = amdgpu_get_pixmap_bo(pixmap);


More information about the xorg-commit mailing list