[PATCH v2 2/2] glamor: Fix test for creating shared pixmaps

Michel Dänzer michel at daenzer.net
Thu Apr 10 00:00:56 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>
---

v2: Properly test for RADEON_CREATE_PIXMAP_DRI2 vs tiling flags.

 src/radeon.h        |  7 +++++++
 src/radeon_glamor.c | 14 ++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/radeon.h b/src/radeon.h
index f364b67..61e254a 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -794,6 +794,13 @@ enum {
     RADEON_CREATE_PIXMAP_SZBUFFER		= 0x80000000, /* for eg */
 };
 
+#define RADEON_CREATE_PIXMAP_TILING_FLAGS	\
+    (RADEON_CREATE_PIXMAP_TILING_MICRO_SQUARE |	\
+     RADEON_CREATE_PIXMAP_TILING_MACRO |	\
+     RADEON_CREATE_PIXMAP_TILING_MICRO |	\
+     RADEON_CREATE_PIXMAP_DEPTH |		\
+     RADEON_CREATE_PIXMAP_SZBUFFER)
+    
 
 /* Compute log base 2 of val. */
 static __inline__ int
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index 7f1247c..4aea51d 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -172,12 +172,14 @@ 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_TILING_FLAGS) == 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 +188,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 +231,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