[PATCH 3/9] exa: add GC private

Maarten Maathuis madman2003 at gmail.com
Tue Feb 3 15:25:27 PST 2009


---
 exa/exa.c      |   11 +++++++++++
 exa/exa_priv.h |   12 +++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/exa/exa.c b/exa/exa.c
index ba063bb..496b898 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -41,6 +41,8 @@ static int exaScreenPrivateKeyIndex;
 DevPrivateKey exaScreenPrivateKey = &exaScreenPrivateKeyIndex;
 static int exaPixmapPrivateKeyIndex;
 DevPrivateKey exaPixmapPrivateKey = &exaPixmapPrivateKeyIndex;
+static int exaGCPrivateKeyIndex;
+DevPrivateKey exaGCPrivateKey = &exaGCPrivateKeyIndex;
 
 #ifdef MITSHM
 static ShmFuncs exaShmFuncs = { NULL, NULL };
@@ -661,6 +663,8 @@ static GCFuncs	exaGCFuncs = {
 static int
 exaCreateGC (GCPtr pGC)
 {
+    ExaGCPriv(pGC);
+
     if (!fbCreateGC (pGC))
 	return FALSE;
 
@@ -890,6 +894,13 @@ exaDriverInit (ScreenPtr		pScreen,
 
     exaDDXDriverInit(pScreen);
 
+    if (!dixRequestPrivate(exaGCPrivateKey, sizeof(ExaGCPrivRec))) {
+	LogMessage(X_WARNING,
+	       "EXA(%d): Failed to allocate GC private\n",
+	       pScreen->myNum);
+	return FALSE;
+    }
+
     /*
      * Replace various fb screen functions
      */
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index cc789c6..3b58948 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -173,9 +173,13 @@ typedef struct {
 
 extern DevPrivateKey exaScreenPrivateKey;
 extern DevPrivateKey exaPixmapPrivateKey;
+extern DevPrivateKey exaGCPrivateKey;
 #define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixLookupPrivate(&(s)->devPrivates, exaScreenPrivateKey))
 #define ExaScreenPriv(s)	ExaScreenPrivPtr    pExaScr = ExaGetScreenPriv(s)
 
+#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixLookupPrivate(&(gc)->devPrivates, exaGCPrivateKey))
+#define ExaGCPriv(gc) ExaGCPrivPtr pExaGC = ExaGetGCPriv(gc)
+
 /** Align an offset to an arbitrary alignment */
 #define EXA_ALIGN(offset, align) (((offset) + (align) - 1) - \
 	(((offset) + (align) - 1) % (align)))
@@ -236,7 +240,13 @@ typedef struct {
      */
     void *driverPriv;
 } ExaPixmapPrivRec, *ExaPixmapPrivPtr;
- 
+
+typedef struct {
+    /* GC values from the layer below. */
+    GCOps *ops;
+    GCFuncs *funcs;
+} ExaGCPrivRec, *ExaGCPrivPtr;
+
 typedef struct _ExaMigrationRec {
     Bool as_dst;
     Bool as_src;
-- 
1.6.1.1




More information about the xorg mailing list