[Glamor] [PATCH 1/2] Don't call dixSetPrivate directly.

zhigang.gong at linux.intel.com zhigang.gong at linux.intel.com
Wed Feb 1 19:27:13 PST 2012


From: Zhigang Gong <zhigang.gong at linux.intel.com>

We may change the way to set/get those private data latter.
consolidate to glamor_set_pixmap/screen_private is better
than call those dixSetPrivate directly.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/glamor.c      |   16 +++++-----------
 src/glamor_priv.h |   20 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/src/glamor.c b/src/glamor.c
index e900a91..0245fda 100644
--- a/src/glamor.c
+++ b/src/glamor.c
@@ -70,8 +70,7 @@ glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
 	pixmap_priv = glamor_get_pixmap_private(pixmap);
 	if (pixmap_priv == NULL) {
 		pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
-		dixSetPrivate(&pixmap->devPrivates,
-			      glamor_pixmap_private_key, pixmap_priv);
+		glamor_set_pixmap_private(pixmap, pixmap_priv);
 		pixmap_priv->container = pixmap;
 		pixmap_priv->glamor_priv = glamor_priv;
 	}
@@ -151,9 +150,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 		return fbCreatePixmap(screen, w, h, depth, usage);
 	}
 
-	dixSetPrivate(&pixmap->devPrivates,
-		      glamor_pixmap_private_key,
-		      pixmap_priv);
+	glamor_set_pixmap_private(pixmap, pixmap_priv);
 
 	pixmap_priv->container = pixmap;
 	pixmap_priv->glamor_priv = glamor_priv;
@@ -269,8 +266,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 		goto fail;
 	}
 
-	dixSetPrivate(&screen->devPrivates, glamor_screen_private_key,
-		      glamor_priv);
+	glamor_set_screen_private(screen, glamor_priv);
 
 	if (!dixRegisterPrivateKey
 	    (glamor_pixmap_private_key, PRIVATE_PIXMAP, 0)) {
@@ -401,8 +397,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 
       fail:
 	free(glamor_priv);
-	dixSetPrivate(&screen->devPrivates, glamor_screen_private_key,
-		      NULL);
+	glamor_set_screen_private(screen, NULL);
 	return FALSE;
 }
 
@@ -423,8 +418,7 @@ glamor_release_screen_priv(ScreenPtr screen)
 	glamor_pixmap_fini(screen);
 	free(glamor_priv);
 
-	dixSetPrivate(&screen->devPrivates, glamor_screen_private_key,
-		      NULL);
+	glamor_set_screen_private(screen, NULL);
 }
 
 Bool
diff --git a/src/glamor_priv.h b/src/glamor_priv.h
index d8168a5..0b75588 100644
--- a/src/glamor_priv.h
+++ b/src/glamor_priv.h
@@ -310,6 +310,16 @@ glamor_get_screen_private(ScreenPtr screen)
 			     glamor_screen_private_key);
 }
 
+static inline void
+glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv)
+{
+	dixSetPrivate(&screen->devPrivates,
+		      glamor_screen_private_key,
+		      priv);
+}
+
+
+
 static inline glamor_pixmap_private *
 glamor_get_pixmap_private(PixmapPtr pixmap)
 {
@@ -317,6 +327,16 @@ glamor_get_pixmap_private(PixmapPtr pixmap)
 				glamor_pixmap_private_key);
 }
 
+static inline void
+glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv)
+{
+	dixSetPrivate(&pixmap->devPrivates,
+		      glamor_pixmap_private_key,
+		      priv);
+}
+
+
+
 
 /**
  * Returns TRUE if the given planemask covers all the significant bits in the
-- 
1.7.4.4



More information about the Glamor mailing list