[PATCH 3/4] dix: Move DestroyClip from GCFuncs to ScreenRec

Adam Jackson ajax at redhat.com
Mon Dec 5 10:56:16 PST 2011


Strictly this is more of a DDX than Screen method, but close enough.  fb
will fill this in for you, Xnest gets to roll its own.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 Xext/panoramiX.c                       |   11 +----------
 dix/gc.c                               |    2 +-
 exa/exa.c                              |   13 -------------
 fb/fbgc.c                              |    1 -
 fb/fbscreen.c                          |    1 +
 hw/dmx/dmx.h                           |    1 +
 hw/dmx/dmxgc.c                         |    7 +++----
 hw/dmx/dmxscrinit.c                    |    2 ++
 hw/xfree86/common/xf86VGAarbiter.c     |   10 +---------
 hw/xfree86/common/xf86VGAarbiterPriv.h |    1 -
 hw/xfree86/shadowfb/shadow.c           |   14 +-------------
 hw/xfree86/xaa/xaaGC.c                 |   11 +----------
 hw/xnest/GC.c                          |   21 +++------------------
 hw/xnest/Screen.c                      |    1 +
 hw/xwin/wingc.c                        |   15 ---------------
 include/gcstruct.h                     |    3 ---
 include/scrnintstr.h                   |    4 ++++
 mi/migc.c                              |    2 +-
 mi/miscrinit.c                         |    2 +-
 miext/cw/cw.c                          |   17 +----------------
 miext/damage/damage.c                  |   11 +----------
 miext/rootless/rootlessGC.c            |    9 ---------
 22 files changed, 24 insertions(+), 135 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index de4a38e..33e7a60 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -130,11 +130,10 @@ static void XineramaChangeGC(GCPtr, unsigned long);
 static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
 static void XineramaDestroyGC(GCPtr);
 static void XineramaChangeClip(GCPtr, int, pointer, int);
-static void XineramaDestroyClip(GCPtr);
 
 static GCFuncs XineramaGCFuncs = {
     XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
-    XineramaChangeClip, XineramaDestroyClip,
+    XineramaChangeClip,
 };
 
 #define Xinerama_GC_FUNC_PROLOGUE(pGC)\
@@ -310,14 +309,6 @@ XineramaChangeClip (
     Xinerama_GC_FUNC_EPILOGUE (pGC);
 }
 
-static void
-XineramaDestroyClip(GCPtr pGC)
-{
-    Xinerama_GC_FUNC_PROLOGUE (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    Xinerama_GC_FUNC_EPILOGUE (pGC);
-}
-
 int
 XineramaDeleteResource(pointer data, XID id)
 {
diff --git a/dix/gc.c b/dix/gc.c
index 693669b..f46ee13 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -794,7 +794,7 @@ FreeGC(pointer value, XID gid)
     GCPtr pGC = (GCPtr)value;
 
     CloseFont(pGC->font, (Font)0);
-    (* pGC->funcs->DestroyClip)(pGC);
+    (* pGC->pScreen->DestroyClip)(pGC);
 
     if (!pGC->tileIsPixel)
 	(* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
diff --git a/exa/exa.c b/exa/exa.c
index beb3795..afc4063 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -486,16 +486,12 @@ exaChangeClip (GCPtr pGC,
 		pointer pvalue,
 		int nrects);
 
-static void
-exaDestroyClip(GCPtr pGC);
-
 const GCFuncs exaGCFuncs = {
     exaValidateGC,
     exaChangeGC,
     exaCopyGC,
     exaDestroyGC,
     exaChangeClip,
-    exaDestroyClip,
 };
 
 static void
@@ -595,15 +591,6 @@ exaChangeClip (GCPtr pGC,
     swap(pExaGC, pGC, funcs);
 }
 
-static void
-exaDestroyClip(GCPtr pGC)
-{
-    ExaGCPriv(pGC);
-    swap(pExaGC, pGC, funcs);
-    (*pGC->funcs->DestroyClip)(pGC);
-    swap(pExaGC, pGC, funcs);
-}
-
 /**
  * exaCreateGC makes a new GC and hooks up its funcs handler, so that
  * exaValidateGC() will get called.
diff --git a/fb/fbgc.c b/fb/fbgc.c
index 4f646cb..f772a84 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -34,7 +34,6 @@ const GCFuncs fbGCFuncs = {
     miCopyGC,
     miDestroyGC,
     miChangeClip,
-    miDestroyClip,
 };
 
 const GCOps	fbGCOps = {
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 9e6ecf5..9610a84 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -121,6 +121,7 @@ fbSetupScreen(ScreenPtr	pScreen,
     pScreen->RealizeFont = fbRealizeFont;
     pScreen->UnrealizeFont = fbUnrealizeFont;
     pScreen->CreateGC = fbCreateGC;
+    pScreen->DestroyClip = miDestroyClip;
     pScreen->CreateColormap = fbInitializeColormap;
     pScreen->DestroyColormap = (void (*)(ColormapPtr))NoopDDA;
     pScreen->InstallColormap = fbInstallColormap;
diff --git a/hw/dmx/dmx.h b/hw/dmx/dmx.h
index c320032..a593efe 100644
--- a/hw/dmx/dmx.h
+++ b/hw/dmx/dmx.h
@@ -192,6 +192,7 @@ typedef struct _DMXScreenInfo {
     SaveScreenProcPtr              SaveScreen;
 
     CreateGCProcPtr                CreateGC;
+    DestroyClipProcPtr             DestroyClip;
 
     CreateWindowProcPtr            CreateWindow;
     DestroyWindowProcPtr           DestroyWindow;
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index a8830bd..86d96cd 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -55,7 +55,6 @@ static GCFuncs dmxGCFuncs = {
     dmxCopyGC,
     dmxDestroyGC,
     dmxChangeClip,
-    dmxDestroyClip,
 };
 
 static GCOps dmxGCOps = {
@@ -396,12 +395,12 @@ void dmxDestroyClip(GCPtr pGC)
     DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
     dmxGCPrivPtr   pGCPriv = DMX_GET_GC_PRIV(pGC);
 
-    DMX_GC_FUNC_PROLOGUE(pGC);
-    pGC->funcs->DestroyClip(pGC);
+    DMX_UNWRAP(DestroyClip, dmxScreen, pScreen);
+    pScreen->DestroyClip(pGC);
 
     /* Set the client clip on the back-end server to None */
     if (dmxScreen->beDisplay)
 	XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
 
-    DMX_GC_FUNC_EPILOGUE(pGC);
+    DMX_WRAP(DestroyClip, dmxDestroyClip, dmxScreen, pScreen);
 }
diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index 57dc8d0..f992ae2 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -266,6 +266,7 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
 
     /* Wrap GC functions */
     DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
+    DMX_WRAP(DestroyClip, dmxDestroyClip, dmxScreen, pScreen);
 
     /* Wrap Window functions */
     DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
@@ -387,6 +388,7 @@ Bool dmxCloseScreen(int idx, ScreenPtr pScreen)
 
     /* Unwrap the pScreen functions */
     DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
+    DMX_UNWRAP(DestroyClip, dmxScreen, pScreen);
 
     DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
     DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index 2d1781a..6989db2 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -39,7 +39,7 @@
 
 static GCFuncs VGAarbiterGCFuncs = {
     VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC,
-    VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip,
+    VGAarbiterDestroyGC, VGAarbiterChangeClip,
 };
 
 static GCOps VGAarbiterGCOps = {
@@ -632,14 +632,6 @@ VGAarbiterChangeClip (
     GC_WRAP (pGC);
 }
 
-static void
-VGAarbiterDestroyClip(GCPtr pGC)
-{
-    GC_UNWRAP (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    GC_WRAP (pGC);
-}
-
 /* GC Ops */
 static void
 VGAarbiterFillSpans(
diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index f4995fc..cfead9a 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -184,7 +184,6 @@ static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void VGAarbiterDestroyGC(GCPtr pGC);
 static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue,
     int nrects);
-static void VGAarbiterDestroyClip(GCPtr pGC);
 
 /* GC ops */
 static void VGAarbiterFillSpans( DrawablePtr pDraw, GC *pGC, int nInit,
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index acf41df..65a6e85 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -360,11 +360,10 @@ static void ShadowChangeGC(GCPtr, unsigned long);
 static void ShadowCopyGC(GCPtr, unsigned long, GCPtr);
 static void ShadowDestroyGC(GCPtr);
 static void ShadowChangeClip(GCPtr, int, pointer, int);
-static void ShadowDestroyClip(GCPtr);
 
 GCFuncs ShadowGCFuncs = {
     ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC,
-    ShadowChangeClip, ShadowDestroyClip,
+    ShadowChangeClip,
 };
 
 
@@ -447,17 +446,6 @@ ShadowChangeClip (
     SHADOW_GC_FUNC_EPILOGUE (pGC);
 }
 
-static void
-ShadowDestroyClip(GCPtr pGC)
-{
-    SHADOW_GC_FUNC_PROLOGUE (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    SHADOW_GC_FUNC_EPILOGUE (pGC);
-}
-
-
-
-
 /**********************************************************/
 
 
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index 384324c..5baa80b 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -24,11 +24,10 @@ static void XAAChangeGC(GCPtr pGC, unsigned long mask);
 static void XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void XAADestroyGC(GCPtr pGC);
 static void XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
-static void XAADestroyClip(GCPtr pGC);
 
 GCFuncs XAAGCFuncs = {
     XAAValidateGC, XAAChangeGC, XAACopyGC, XAADestroyGC,
-    XAAChangeClip, XAADestroyClip,
+    XAAChangeClip,
 };
 
 extern GCOps XAAPixmapOps;
@@ -290,14 +289,6 @@ XAAChangeClip (
     (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
     XAA_GC_FUNC_EPILOGUE (pGC);
 }
-
-static void
-XAADestroyClip(GCPtr pGC)
-{
-    XAA_GC_FUNC_PROLOGUE (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    XAA_GC_FUNC_EPILOGUE (pGC);
-}
  
 /**** Pixmap Wrappers ****/
 
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index b22d8c6..312294f 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -23,6 +23,7 @@ is" without express or implied warranty.
 #include "pixmapstr.h"
 #include "scrnintstr.h"
 #include <X11/fonts/fontstruct.h>
+#include "migc.h"
 #include "mistruct.h"
 #include "region.h"
 
@@ -43,7 +44,6 @@ static GCFuncs xnestFuncs = {
   xnestCopyGC,
   xnestDestroyGC,
   xnestChangeClip,
-  xnestDestroyClip,
 };
 
 static GCOps xnestOps = {
@@ -193,7 +193,7 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
   BoxPtr pBox;
   XRectangle *pRects;
 
-  xnestDestroyClipHelper(pGC);
+  miDestroyClip(pGC);
 
   switch(type) 
     {
@@ -285,25 +285,10 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
 void
 xnestDestroyClip(GCPtr pGC)
 {
-  xnestDestroyClipHelper(pGC);
+  miDestroyClip(pGC);
 
   XSetClipMask(xnestDisplay, xnestGC(pGC), None);
  
   pGC->clientClipType = CT_NONE;
   pGC->clientClip = NULL;
 }
-
-void
-xnestDestroyClipHelper(GCPtr pGC)
-{
-  switch (pGC->clientClipType)
-    {
-    default:
-    case CT_NONE:
-      break;
-      
-    case CT_REGION:
-      RegionDestroy(pGC->clientClip);
-      break;
-    }
-}
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index d0c7fc8..14a901a 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -290,6 +290,7 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
   /* GC procedures */
   
   pScreen->CreateGC = xnestCreateGC;
+  pScreen->DestroyClip = xnestDestroyClip;
 
   /* Colormap procedures */
 
diff --git a/hw/xwin/wingc.c b/hw/xwin/wingc.c
index 3737ec3..f5939fb 100644
--- a/hw/xwin/wingc.c
+++ b/hw/xwin/wingc.c
@@ -62,9 +62,6 @@ winDestroyGCNativeGDI (GCPtr pGC);
 #if 0
 static void
 winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects);
-
-static void
-winDestroyClipNativeGDI (GCPtr pGC);
 #endif
 
 #if 0
@@ -75,7 +72,6 @@ const GCFuncs winGCFuncs = {
   winCopyGCNativeGDI,
   winDestroyGCNativeGDI,
   winChangeClipNativeGDI,
-  winDestroyClipNativeGDI,
 };
 #else
 const GCFuncs winGCFuncs = {
@@ -84,7 +80,6 @@ const GCFuncs winGCFuncs = {
   miCopyGC,
   winDestroyGCNativeGDI,
   miChangeClip,
-  miDestroyClip,
 };
 #endif
 
@@ -227,14 +222,4 @@ winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects)
 {
 
 }
-
-
-/* See Porting Layer Definition - p. 47 */
-static void
-winDestroyClipNativeGDI (GCPtr pGC)
-{
-
-}
-
-
 #endif
diff --git a/include/gcstruct.h b/include/gcstruct.h
index 9e96778..02341bf 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -88,9 +88,6 @@ typedef struct _GCFuncs {
 		int /*type*/,
 		pointer /*pvalue*/,
 		int /*nrects*/);
-
-    void	(* DestroyClip)(
-		GCPtr /*pGC*/);
 } GCFuncs;
 
 /*
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 132a671..12ef071 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -264,6 +264,9 @@ typedef    Bool (* SetCursorPositionProcPtr)(
 typedef    Bool (* CreateGCProcPtr)(
 	GCPtr /*pGC*/);
 
+typedef    void (* DestroyClipProcPtr)(
+	GCPtr /*pGC*/);
+
 typedef    Bool (* CreateColormapProcPtr)(
 	ColormapPtr /*pColormap*/);
 
@@ -483,6 +486,7 @@ typedef struct _Screen {
     /* GC procedures */
 
     CreateGCProcPtr		CreateGC;
+    DestroyClipProcPtr		DestroyClip;
 
     /* Colormap procedures */
 
diff --git a/mi/migc.c b/mi/migc.c
index e9cb512..f6e8979 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -77,7 +77,7 @@ miDestroyClip(GCPtr pGC)
 void
 miChangeClip( GCPtr pGC, int type, pointer pvalue, int nrects)
 {
-    (*pGC->funcs->DestroyClip) (pGC);
+    (*pGC->pScreen->DestroyClip) (pGC);
     if (type == CT_PIXMAP)
     {
 	/* convert the pixmap to a region */
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index fb01c68..7499194 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -258,7 +258,7 @@ miScreenInit(
     pScreen->RestackWindow = (RestackWindowProcPtr) 0;
     /* CreatePixmap, DestroyPixmap */
     /* RealizeFont, UnrealizeFont */
-    /* CreateGC */
+    /* CreateGC, DestroyClip */
     /* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */
     /* ListInstalledColormaps, StoreColors, ResolveColor */
     /* BitmapToRegion */
diff --git a/miext/cw/cw.c b/miext/cw/cw.c
index fd6bc1b..9c0a08b 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -63,8 +63,6 @@ static void
 cwDestroyGC(GCPtr pGC);
 static void
 cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
-static void
-cwDestroyClip(GCPtr pGC);
 
 GCFuncs cwGCFuncs = {
     cwValidateGC,
@@ -72,7 +70,6 @@ GCFuncs cwGCFuncs = {
     cwCopyGC,
     cwDestroyGC,
     cwChangeClip,
-    cwDestroyClip,
 };
 
 /* Find the real drawable to draw to, and provide offsets that will translate
@@ -279,18 +276,6 @@ cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
     FUNC_EPILOGUE(pGC, pPriv);
 }
 
-static void
-cwDestroyClip(GCPtr pGC)
-{
-    cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
-
-    FUNC_PROLOGUE(pGC, pPriv);
-
-    (*pGC->funcs->DestroyClip)(pGC);
-
-    FUNC_EPILOGUE(pGC, pPriv);
-}
-
 /*
  * Screen wrappers.
  */
@@ -417,7 +402,7 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 			       &pBackingPixmap->drawable, pGC,
 			       src_x, src_y, w, h, dst_x, dst_y);
 
-	(*pGC->funcs->DestroyClip) (pGC);
+	(*pScreen->DestroyClip) (pGC);
 
 	FreeScratchGC(pGC);
     }
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index b88e7d0..dcd7491 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -384,11 +384,10 @@ static void damageChangeGC(GCPtr, unsigned long);
 static void damageCopyGC(GCPtr, unsigned long, GCPtr);
 static void damageDestroyGC(GCPtr);
 static void damageChangeClip(GCPtr, int, pointer, int);
-static void damageDestroyClip(GCPtr);
 
 static GCFuncs damageGCFuncs = {
     damageValidateGC, damageChangeGC, damageCopyGC, damageDestroyGC,
-    damageChangeClip, damageDestroyClip,
+    damageChangeClip,
 };
 
 static GCOps damageGCOps;
@@ -480,14 +479,6 @@ damageChangeClip (GCPtr	    pGC,
     DAMAGE_GC_FUNC_EPILOGUE (pGC);
 }
 
-static void
-damageDestroyClip(GCPtr pGC)
-{
-    DAMAGE_GC_FUNC_PROLOGUE (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    DAMAGE_GC_FUNC_EPILOGUE (pGC);
-}
-
 #define TRIM_BOX(box, pGC) if (pGC->pCompositeClip) { \
     BoxPtr extents = &pGC->pCompositeClip->extents;\
     if(box.x1 < extents->x1) box.x1 = extents->x1; \
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index e5885c1..850f76f 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -58,7 +58,6 @@ static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void RootlessDestroyGC(GCPtr pGC);
 static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue,
                                int nrects);
-static void RootlessDestroyClip(GCPtr pGC);
 
 Bool RootlessCreateGC(GCPtr pGC);
 
@@ -68,7 +67,6 @@ GCFuncs rootlessGCFuncs = {
     RootlessCopyGC,
     RootlessDestroyGC,
     RootlessChangeClip,
-    RootlessDestroyClip,
 };
 
 // GC operations
@@ -376,13 +374,6 @@ static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
     GCFUNC_WRAP(pGC);
 }
 
-static void RootlessDestroyClip(GCPtr pGC)
-{
-    GCFUNC_UNWRAP(pGC);
-    pGC->funcs->DestroyClip(pGC);
-    GCFUNC_WRAP(pGC);
-}
-
 /*
  * GC ops
  *
-- 
1.7.6.4



More information about the xorg-devel mailing list