[PATCH] glamor: Fix test for creating shared pixmaps

Michel Dänzer michel at daenzer.net
Wed Apr 9 19:44:20 PDT 2014


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

The pixmap usage hint is not a bitmask. The previous tests were incorrectly
taking the shared pixmap path for a glamor internal usage hint being added
in the xserver tree.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/radeon_glamor.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index 7f1247c..0ae14f4 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -172,12 +172,13 @@ Bool radeon_glamor_pixmap_is_offscreen(PixmapPtr pixmap)
 	return priv && priv->bo;
 }
 
-#ifdef CREATE_PIXMAP_USAGE_SHARED
-#define RADEON_CREATE_PIXMAP_SHARED (CREATE_PIXMAP_USAGE_SHARED | RADEON_CREATE_PIXMAP_DRI2)
-#else
-#define RADEON_CREATE_PIXMAP_SHARED RADEON_CREATE_PIXMAP_DRI2
+#ifndef CREATE_PIXMAP_USAGE_SHARED
+#define CREATE_PIXMAP_USAGE_SHARED RADEON_CREATE_PIXMAP_DRI2
 #endif
 
+#define RADEON_CREATE_PIXMAP_SHARED(usage) \
+	(usage == RADEON_CREATE_PIXMAP_DRI2 || usage == CREATE_PIXMAP_USAGE_SHARED)
+
 static PixmapPtr
 radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 			unsigned usage)
@@ -186,7 +187,7 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 	struct radeon_pixmap *priv;
 	PixmapPtr pixmap, new_pixmap = NULL;
 
-	if (!(usage & RADEON_CREATE_PIXMAP_SHARED)) {
+	if (!RADEON_CREATE_PIXMAP_SHARED(usage)) {
 		pixmap = glamor_create_pixmap(screen, w, h, depth, usage);
 		if (pixmap)
 			return pixmap;
@@ -229,7 +230,7 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 	return pixmap;
 
 fallback_glamor:
-	if (usage & RADEON_CREATE_PIXMAP_SHARED) {
+	if (RADEON_CREATE_PIXMAP_SHARED(usage)) {
 	/* XXX need further work to handle the DRI2 failure case.
 	 * Glamor don't know how to handle a BO only pixmap. Put
 	 * a warning indicator here.
-- 
1.9.0



More information about the xorg-driver-ati mailing list