[PATCH 2/2] glamor: Deal with glamor_egl_destroy_textured_pixmap being removed

Michel Dänzer michel at daenzer.net
Tue Nov 10 00:41:36 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.

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

diff --git a/configure.ac b/configure.ac
index c371829..ccaf15e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,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
 
 	if test "x$GLAMOR_XSERVER" != xyes; then
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index 8fb3a1e..86db4e2 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -252,6 +252,12 @@ fallback_pixmap:
 
 static Bool radeon_glamor_destroy_pixmap(PixmapPtr pixmap)
 {
+#ifndef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
+	ScreenPtr screen = pixmap->drawable.pScreen;
+	RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(screen));
+	Bool ret;
+#endif
+
 	if (pixmap->refcnt == 1) {
 		if (pixmap->devPrivate.ptr) {
 			struct radeon_bo *bo = radeon_get_pixmap_bo(pixmap);
@@ -260,11 +266,23 @@ static Bool radeon_glamor_destroy_pixmap(PixmapPtr pixmap)
 				radeon_bo_unmap(bo);
 		}
 
+#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
 		glamor_egl_destroy_textured_pixmap(pixmap);
+#endif
 		radeon_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 = radeon_glamor_destroy_pixmap;
+
+	return ret;
+#endif
 }
 
 #ifdef RADEON_PIXMAP_SHARING
-- 
2.6.2



More information about the xorg-driver-ati mailing list