[PATCH xf86-video-amdgpu 2/2] glamor: Deal with glamor_egl_destroy_textured_pixmap being removed

Michel Dänzer michel at daenzer.net
Thu Nov 19 01:05:26 PST 2015


From: Michel Dänzer <michel.daenzer at amd.com>

When it's not available, it's safe to call down to the glamor
DestroyPixmap hook instead.

(ported from radeon commit 10b7c3def58bb34acc38f076bc230e25b454ab79)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 configure.ac        |  6 ++++++
 src/amdgpu_glamor.c | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/configure.ac b/configure.ac
index 3955b68..a884882 100644
--- a/configure.ac
+++ b/configure.ac
@@ -133,6 +133,12 @@ if test "x$GLAMOR" != "xno"; then
 					 [Have glamor_glyphs_init API])], [],
 			      [#include "xorg-server.h"
 			       #include "glamor.h"])
+
+		AC_CHECK_DECL(glamor_egl_destroy_textured_pixmap,
+			      [AC_DEFINE(HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP, 1,
+					 [Have glamor_egl_destroy_textured_pixmap API])], [],
+			      [#include "xorg-server.h"
+			       #include "glamor.h"])
 	fi
 
 	PKG_CHECK_MODULES(LIBGL, [gl])
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index a745555..b11ee10 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -241,6 +241,12 @@ fallback_pixmap:
 
 static Bool amdgpu_glamor_destroy_pixmap(PixmapPtr pixmap)
 {
+#ifndef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
+	ScreenPtr screen = pixmap->drawable.pScreen;
+	AMDGPUInfoPtr info = AMDGPUPTR(xf86ScreenToScrn(screen));
+	Bool ret;
+#endif
+
 	if (pixmap->refcnt == 1) {
 		if (pixmap->devPrivate.ptr) {
 			struct amdgpu_buffer *bo = amdgpu_get_pixmap_bo(pixmap);
@@ -249,11 +255,23 @@ static Bool amdgpu_glamor_destroy_pixmap(PixmapPtr pixmap)
 				amdgpu_bo_unmap(bo);
 		}
 
+#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
 		glamor_egl_destroy_textured_pixmap(pixmap);
+#endif
 		amdgpu_set_pixmap_bo(pixmap, NULL);
 	}
+
+#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
 	fbDestroyPixmap(pixmap);
 	return TRUE;
+#else
+	screen->DestroyPixmap = info->glamor.SavedDestroyPixmap;
+	ret = screen->DestroyPixmap(pixmap);
+	info->glamor.SavedDestroyPixmap = screen->DestroyPixmap;
+	screen->DestroyPixmap = amdgpu_glamor_destroy_pixmap;
+
+	return ret;
+#endif
 }
 
 #ifdef AMDGPU_PIXMAP_SHARING
-- 
2.6.2



More information about the xorg-driver-ati mailing list