[PATCH xserver] dix: Move {Change, Copy, Destroy}Clip from GCFuncs to Screen

Adam Jackson ajax at redhat.com
Thu Feb 16 20:31:57 UTC 2017


There are only two behaviors here. Xnest and Xdmx forward the clip list
to the backing server, other DDXes use mi. But a layer like damage has
to wrap everything in the GCFuncs vtable even though it really only
cares about ValidateGC.

Since none of this varies within a screen, we can move the clip
management funcs up to the ScreenRec and eliminate the empty wrappers.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 Xext/panoramiX.c                       | 28 ------------------------
 dix/gc.c                               | 12 +++++------
 doc/Xserver-spec.xml                   | 19 +++++++----------
 exa/exa.c                              | 39 ----------------------------------
 fb/fbgc.c                              |  3 ---
 glamor/glamor_core.c                   |  3 ---
 hw/dmx/dmx.h                           |  2 ++
 hw/dmx/dmxgc.c                         | 24 ++++++---------------
 hw/dmx/dmxscrinit.c                    |  4 ++++
 hw/xfree86/common/xf86VGAarbiter.c     | 27 +----------------------
 hw/xfree86/common/xf86VGAarbiterPriv.h |  4 ----
 hw/xfree86/drivers/modesetting/dri2.c  |  2 +-
 hw/xnest/GC.c                          |  3 ---
 hw/xnest/Screen.c                      |  3 +++
 include/gcstruct.h                     | 10 ---------
 include/scrnintstr.h                   |  6 ++++++
 mi/mibitblt.c                          |  4 ++--
 mi/migc.c                              |  6 +++---
 mi/miscrinit.c                         |  4 ++++
 miext/damage/damage.c                  | 28 ------------------------
 miext/rootless/rootlessGC.c            | 30 --------------------------
 present/present.c                      |  4 ++--
 render/mirect.c                        |  2 +-
 xfixes/region.c                        |  3 +--
 24 files changed, 50 insertions(+), 220 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 209df29..edd916d 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -130,13 +130,9 @@ static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
 static void XineramaChangeGC(GCPtr, unsigned long);
 static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
 static void XineramaDestroyGC(GCPtr);
-static void XineramaChangeClip(GCPtr, int, void *, int);
-static void XineramaDestroyClip(GCPtr);
-static void XineramaCopyClip(GCPtr, GCPtr);
 
 static const GCFuncs XineramaGCFuncs = {
     XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
-    XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
 };
 
 #define Xinerama_GC_FUNC_PROLOGUE(pGC)\
@@ -293,30 +289,6 @@ XineramaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
     Xinerama_GC_FUNC_EPILOGUE(pGCDst);
 }
 
-static void
-XineramaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
-{
-    Xinerama_GC_FUNC_PROLOGUE(pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    Xinerama_GC_FUNC_EPILOGUE(pGC);
-}
-
-static void
-XineramaCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    Xinerama_GC_FUNC_PROLOGUE(pgcDst);
-    (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
-    Xinerama_GC_FUNC_EPILOGUE(pgcDst);
-}
-
-static void
-XineramaDestroyClip(GCPtr pGC)
-{
-    Xinerama_GC_FUNC_PROLOGUE(pGC);
-    (*pGC->funcs->DestroyClip) (pGC);
-    Xinerama_GC_FUNC_EPILOGUE(pGC);
-}
-
 int
 XineramaDeleteResource(void *data, XID id)
 {
diff --git a/dix/gc.c b/dix/gc.c
index cb8db85..f8435f1 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -340,8 +340,8 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion)
                 }
                 pPixmap->refcnt++;
             }
-            (*pGC->funcs->ChangeClip) (pGC, pPixmap ? CT_PIXMAP : CT_NONE,
-                                       (void *) pPixmap, 0);
+            pGC->pScreen->ChangeClip(pGC, pPixmap ? CT_PIXMAP : CT_NONE,
+                                     pPixmap, 0);
             break;
         case GCDashOffset:
             NEXTVAL(INT16, pGC->dashOffset);
@@ -712,7 +712,7 @@ CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask)
             pgcDst->clipOrg.y = pgcSrc->clipOrg.y;
             break;
         case GCClipMask:
-            (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
+            pgcDst->pScreen->CopyClip(pgcDst, pgcSrc);
             break;
         case GCDashOffset:
             pgcDst->dashOffset = pgcSrc->dashOffset;
@@ -770,7 +770,7 @@ FreeGC(void *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);
@@ -1022,7 +1022,7 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
 
     if (size)
         memmove((char *) prectsNew, (char *) prects, size);
-    (*pGC->funcs->ChangeClip) (pGC, newct, (void *) prectsNew, nrects);
+    pGC->pScreen->ChangeClip(pGC, newct, prectsNew, nrects);
     if (pGC->funcs->ChangeGC)
         (*pGC->funcs->ChangeGC) (pGC,
                                  GCClipXOrigin | GCClipYOrigin | GCClipMask);
@@ -1065,7 +1065,7 @@ GetScratchGC(unsigned depth, ScreenPtr pScreen)
             pGC->clipOrg.x = 0;
             pGC->clipOrg.y = 0;
             if (pGC->clientClip)
-                (*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
+                pGC->pScreen->ChangeClip(pGC, CT_NONE, NULL, 0);
             pGC->stateChanges = GCAllBits;
             return pGC;
         }
diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index 7867544..a5bab27 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -3847,18 +3847,15 @@ This routine is responsible for freeing any auxiliary storage allocated.</para>
   <title>GC Clip Region Routines</title>
 <para>
 The GC clientClip field requires three procedures to manage it.  These
-procedures are in the GC funcs vector.  The underlying principle is that dix
-knows nothing about the internals of the clipping information, (except when
-it has come from the client), and so calls ddX whenever it needs to copy,
-set, or destroy such information.  It could have been possible for dix not
-to allow ddX to touch the field in the GC, and require it to keep its own
-copy in devPriv, but since clip masks can be very large, this seems like a
-bad idea.  Thus, the server allows ddX to do whatever it wants to the
-clientClip field of the GC, but requires it to do all manipulation itself.</para>
+procedures are in the ScreenRec. The DIX layer assumes that the client clip
+is stored as a region; these routines allow the DDX to keep a more
+convenient representation if it wants to. These routines typically do not
+distinguish among types of GCs, and most DDXes simply use the mi routines.
+</para>
 <para>
 <blockquote><programlisting>
 
-	void pGC->funcs->ChangeClip(pGC, type, pValue, nrects)
+	void pScreen->ChangeClip(pGC, type, pValue, nrects)
 		GCPtr pGC;
 		int type;
 		char *pValue;
@@ -3891,7 +3888,7 @@ at a composite clip region before any drawing is done.)</para>
 <para>
 <blockquote><programlisting>
 
-	void pGC->funcs->DestroyClip(pGC)
+	void pScreen->DestroyClip(pGC)
 		GCPtr pGC;
 
 </programlisting></blockquote>
@@ -3904,7 +3901,7 @@ by this routine after destroying the region, so that other software
 <para>
 <blockquote><programlisting>
 
-	void pGC->funcs->CopyClip(pgcDst, pgcSrc)
+	void pScreen->CopyClip(pgcDst, pgcSrc)
 		GCPtr pgcDst, pgcSrc;
 
 </programlisting></blockquote>
diff --git a/exa/exa.c b/exa/exa.c
index 7266b71..af9c106 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -474,23 +474,11 @@ static void
 static void
  exaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 
-static void
- exaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects);
-
-static void
- exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
-
-static void
- exaDestroyClip(GCPtr pGC);
-
 const GCFuncs exaGCFuncs = {
     exaValidateGC,
     exaChangeGC,
     exaCopyGC,
     exaDestroyGC,
-    exaChangeClip,
-    exaDestroyClip,
-    exaCopyClip
 };
 
 static void
@@ -578,33 +566,6 @@ exaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
     swap(pExaGC, pGCDst, funcs);
 }
 
-static void
-exaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
-{
-    ExaGCPriv(pGC);
-    swap(pExaGC, pGC, funcs);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    swap(pExaGC, pGC, funcs);
-}
-
-static void
-exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
-{
-    ExaGCPriv(pGCDst);
-    swap(pExaGC, pGCDst, funcs);
-    (*pGCDst->funcs->CopyClip) (pGCDst, pGCSrc);
-    swap(pExaGC, pGCDst, 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 19c6131..9424061 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -33,9 +33,6 @@ const GCFuncs fbGCFuncs = {
     miChangeGC,
     miCopyGC,
     miDestroyGC,
-    miChangeClip,
-    miDestroyClip,
-    miCopyClip,
 };
 
 const GCOps fbGCOps = {
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index 7b2b396..493b2cf 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -307,9 +307,6 @@ static GCFuncs glamor_gc_funcs = {
     miChangeGC,
     miCopyGC,
     glamor_destroy_gc,
-    miChangeClip,
-    miDestroyClip,
-    miCopyClip
 };
 
 /**
diff --git a/hw/dmx/dmx.h b/hw/dmx/dmx.h
index 7242e43..dbd5879 100644
--- a/hw/dmx/dmx.h
+++ b/hw/dmx/dmx.h
@@ -198,6 +198,8 @@ typedef struct _DMXScreenInfo {
     SaveScreenProcPtr SaveScreen;
 
     CreateGCProcPtr CreateGC;
+    ChangeClipProcPtr ChangeClip;
+    DestroyClipProcPtr DestroyClip;
 
     CreateWindowProcPtr CreateWindow;
     DestroyWindowProcPtr DestroyWindow;
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index c4789a6..453954a 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -54,9 +54,6 @@ static const GCFuncs dmxGCFuncs = {
     dmxChangeGC,
     dmxCopyGC,
     dmxDestroyGC,
-    dmxChangeClip,
-    dmxDestroyClip,
-    dmxCopyClip,
 };
 
 static const GCOps dmxGCOps = {
@@ -387,8 +384,8 @@ dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
     BoxPtr pBox;
     int i, nRects;
 
-    DMX_GC_FUNC_PROLOGUE(pGC);
-    pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
+    DMX_UNWRAP(ChangeClip, dmxScreen, pScreen);
+    pGC->pScreen->ChangeClip(pGC, type, pvalue, nrects);
 
     /* Set the client clip on the back-end server */
     if (!pGC->clientClip) {
@@ -415,7 +412,7 @@ dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
         }
     }
 
-    DMX_GC_FUNC_EPILOGUE(pGC);
+    DMX_WRAP(ChangeClip, dmxChangeClip, dmxScreen, pScreen);
 }
 
 /** Destroy a GC's clip rects. */
@@ -426,21 +423,12 @@ 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);
+    pGC->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);
-}
-
-/** Copy a GC's clip rects. */
-void
-dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
-{
-    DMX_GC_FUNC_PROLOGUE(pGCDst);
-    pGCDst->funcs->CopyClip(pGCDst, pGCSrc);
-    DMX_GC_FUNC_EPILOGUE(pGCDst);
+    DMX_WRAP(DestroyClip, dmxDestroyClip, dmxScreen, pScreen);
 }
diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index e441dce..8c54885 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -269,6 +269,8 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[])
 
     /* Wrap GC functions */
     DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
+    DMX_WRAP(ChangeClip, dmxChangeClip, dmxScreen, pScreen);
+    DMX_WRAP(DestroyClip, dmxDestroyClip, dmxScreen, pScreen);
 
     /* Wrap Window functions */
     DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
@@ -392,6 +394,8 @@ dmxCloseScreen(ScreenPtr pScreen)
 
     /* Unwrap the pScreen functions */
     DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
+    DMX_UNWRAP(ChangeClip, 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 40f241a..9a58734 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -38,8 +38,7 @@
 
 static GCFuncs VGAarbiterGCFuncs = {
     VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC,
-    VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip,
-    VGAarbiterCopyClip
+    VGAarbiterDestroyGC
 };
 
 static GCOps VGAarbiterGCOps = {
@@ -583,30 +582,6 @@ VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
     GC_WRAP(pGCDst);
 }
 
-static void
-VGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
-{
-    GC_UNWRAP(pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    GC_UNWRAP(pgcDst);
-    (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
-    GC_WRAP(pgcDst);
-}
-
-static void
-VGAarbiterDestroyClip(GCPtr pGC)
-{
-    GC_UNWRAP(pGC);
-    (*pGC->funcs->DestroyClip) (pGC);
-    GC_WRAP(pGC);
-}
-
 /* GC Ops */
 static void
 VGAarbiterFillSpans(DrawablePtr pDraw,
diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index 09be10a..6bd6529 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -190,10 +190,6 @@ static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
 static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
 static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void VGAarbiterDestroyGC(GCPtr pGC);
-static void VGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue,
-                                 int nrects);
-static void VGAarbiterDestroyClip(GCPtr pGC);
-static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 
 /* GC ops */
 static void VGAarbiterFillSpans(DrawablePtr pDraw, GC * pGC, int nInit,
diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c
index 8944ef1..7c50ac3 100644
--- a/hw/xfree86/drivers/modesetting/dri2.c
+++ b/hw/xfree86/drivers/modesetting/dri2.c
@@ -303,7 +303,7 @@ ms_dri2_copy_region2(ScreenPtr screen, DrawablePtr drawable, RegionPtr pRegion,
     REGION_COPY(screen, pCopyClip, pRegion);
     if (translate)
         REGION_TRANSLATE(screen, pCopyClip, off_x, off_y);
-    (*gc->funcs->ChangeClip) (gc, CT_REGION, pCopyClip, 0);
+    screen->ChangeClip(gc, CT_REGION, pCopyClip, 0);
     ValidateGC(dst, gc);
 
     /* It's important that this copy gets submitted before the direct
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index ecfa61e..ba39d25 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -42,9 +42,6 @@ static GCFuncs xnestFuncs = {
     xnestChangeGC,
     xnestCopyGC,
     xnestDestroyGC,
-    xnestChangeClip,
-    xnestDestroyClip,
-    xnestCopyClip,
 };
 
 static GCOps xnestOps = {
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 30c6a46..7c0b1db 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -292,6 +292,9 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
     /* GC procedures */
 
     pScreen->CreateGC = xnestCreateGC;
+    pScreen->ChangeClip = xnestChangeClip;
+    pScreen->DestroyClip = xnestDestroyClip;
+    pScreen->CopyClip = xnestCopyClip;
 
     /* Colormap procedures */
 
diff --git a/include/gcstruct.h b/include/gcstruct.h
index e48d610..0a88f28 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -75,16 +75,6 @@ typedef struct _GCFuncs {
                     GCPtr /*pGCDst */ );
 
     void (*DestroyGC) (GCPtr /*pGC */ );
-
-    void (*ChangeClip) (GCPtr pGC,
-                        int type,
-                        void *pvalue,
-                        int nrects);
-
-    void (*DestroyClip) (GCPtr /*pGC */ );
-
-    void (*CopyClip) (GCPtr /*pgcDst */ ,
-                      GCPtr /*pgcSrc */ );
 } GCFuncs;
 
 /*
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index f174549..e9be532 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -246,6 +246,9 @@ typedef void (*CurserConfinedToProcPtr) (DeviceIntPtr /* pDev */ ,
                                          WindowPtr /*pWindow */ );
 
 typedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ );
+typedef void (*ChangeClipProcPtr)(GCPtr pGC, int type, void *value, int nrects);
+typedef void (*DestroyClipProcPtr)(GCPtr pGC);
+typedef void (*CopyClipProcPtr)(GCPtr pgcDst, GCPtr pgcSrc);
 
 typedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ );
 
@@ -570,6 +573,9 @@ typedef struct _Screen {
     /* GC procedures */
 
     CreateGCProcPtr CreateGC;
+    ChangeClipProcPtr ChangeClip;
+    DestroyClipProcPtr DestroyClip;
+    CopyClipProcPtr CopyClip;
 
     /* Colormap procedures */
 
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 28296a4..b675fc9 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -414,7 +414,7 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
     prgnSrcClip = RegionCreate(NULL, 0);
     RegionCopy(prgnSrcClip, prgnSrc);
     RegionTranslate(prgnSrcClip, srcx, 0);
-    (*pGCT->funcs->ChangeClip) (pGCT, CT_REGION, prgnSrcClip, 0);
+    pGCT->pScreen->ChangeClip(pGCT, CT_REGION, prgnSrcClip, 0);
     ValidateGC((DrawablePtr) pPixmap, pGCT);
 
     /* Since we know pDraw is always a pixmap, we never need to think
@@ -497,7 +497,7 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
 
     ValidateGC(pDraw, pGC);
     /* put what we hope is a smaller clip region back in the scratch gc */
-    (*pGCT->funcs->ChangeClip) (pGCT, CT_NONE, NULL, 0);
+    pGCT->pScreen->ChangeClip(pGCT, CT_NONE, NULL, 0);
     FreeScratchGC(pGCT);
     (*pDraw->pScreen->DestroyPixmap) (pPixmap);
 
diff --git a/mi/migc.c b/mi/migc.c
index 8fdd481..bb581ff 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -63,7 +63,7 @@ miDestroyClip(GCPtr pGC)
 void
 miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
 {
-    (*pGC->funcs->DestroyClip) (pGC);
+    pGC->pScreen->DestroyClip(pGC);
     if (type == CT_PIXMAP) {
         /* convert the pixmap to a region */
         pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue);
@@ -86,9 +86,9 @@ miCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
     if (pgcSrc->clientClip) {
         RegionPtr prgnNew = RegionCreate(NULL, 1);
         RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
-        (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, prgnNew, 0);
+        (*pgcDst->pScreen->ChangeClip) (pgcDst, CT_REGION, prgnNew, 0);
     } else {
-        (*pgcDst->funcs->ChangeClip) (pgcDst, CT_NONE, NULL, 0);
+        (*pgcDst->pScreen->ChangeClip) (pgcDst, CT_NONE, NULL, 0);
     }
 }
 
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 9c6af0d..2464b0c 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -34,6 +34,7 @@ from The Open Group.
 #include "servermd.h"
 #include "misc.h"
 #include "mi.h"
+#include "migc.h"
 #include "scrnintstr.h"
 #include "pixmapstr.h"
 #include "dix.h"
@@ -273,6 +274,9 @@ miScreenInit(ScreenPtr pScreen, void *pbits,  /* pointer to screen bits */
     pScreen->SetShape = miSetShape;
     pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow;
     pScreen->XYToWindow = miXYToWindow;
+    pScreen->ChangeClip = miChangeClip;
+    pScreen->CopyClip = miCopyClip;
+    pScreen->DestroyClip = miDestroyClip;
 
     miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS);
 
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 2fae03f..19fa67c 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -328,13 +328,9 @@ static void damageValidateGC(GCPtr, unsigned long, DrawablePtr);
 static void damageChangeGC(GCPtr, unsigned long);
 static void damageCopyGC(GCPtr, unsigned long, GCPtr);
 static void damageDestroyGC(GCPtr);
-static void damageChangeClip(GCPtr, int, void *, int);
-static void damageDestroyClip(GCPtr);
-static void damageCopyClip(GCPtr, GCPtr);
 
 static GCFuncs damageGCFuncs = {
     damageValidateGC, damageChangeGC, damageCopyGC, damageDestroyGC,
-    damageChangeClip, damageDestroyClip, damageCopyClip
 };
 
 static GCOps damageGCOps;
@@ -411,30 +407,6 @@ damageCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
     DAMAGE_GC_FUNC_EPILOGUE(pGCDst);
 }
 
-static void
-damageChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
-{
-    DAMAGE_GC_FUNC_PROLOGUE(pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    DAMAGE_GC_FUNC_EPILOGUE(pGC);
-}
-
-static void
-damageCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    DAMAGE_GC_FUNC_PROLOGUE(pgcDst);
-    (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
-    DAMAGE_GC_FUNC_EPILOGUE(pgcDst);
-}
-
-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 235b3ab..beafb71 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -55,9 +55,6 @@ static void RootlessValidateGC(GCPtr pGC, unsigned long changes,
 static void RootlessChangeGC(GCPtr pGC, unsigned long mask);
 static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void RootlessDestroyGC(GCPtr pGC);
-static void RootlessChangeClip(GCPtr pGC, int type, void *pvalue, int nrects);
-static void RootlessDestroyClip(GCPtr pGC);
-static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 
 Bool RootlessCreateGC(GCPtr pGC);
 
@@ -66,9 +63,6 @@ GCFuncs rootlessGCFuncs = {
     RootlessChangeGC,
     RootlessCopyGC,
     RootlessDestroyGC,
-    RootlessChangeClip,
-    RootlessDestroyClip,
-    RootlessCopyClip,
 };
 
 // GC operations
@@ -367,30 +361,6 @@ RootlessDestroyGC(GCPtr pGC)
     GCFUNC_WRAP(pGC);
 }
 
-static void
-RootlessChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
-{
-    GCFUNC_UNWRAP(pGC);
-    pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
-    GCFUNC_WRAP(pGC);
-}
-
-static void
-RootlessDestroyClip(GCPtr pGC)
-{
-    GCFUNC_UNWRAP(pGC);
-    pGC->funcs->DestroyClip(pGC);
-    GCFUNC_WRAP(pGC);
-}
-
-static void
-RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    GCFUNC_UNWRAP(pgcDst);
-    pgcDst->funcs->CopyClip(pgcDst, pgcSrc);
-    GCFUNC_WRAP(pgcDst);
-}
-
 /*
  * GC ops
  *
diff --git a/present/present.c b/present/present.c
index aa9c041..c110712 100644
--- a/present/present.c
+++ b/present/present.c
@@ -89,7 +89,7 @@ present_copy_region(DrawablePtr drawable,
         ChangeGC(serverClient, gc,
                  GCClipXOrigin|GCClipYOrigin,
                  changes);
-        (*gc->funcs->ChangeClip)(gc, CT_REGION, update, 0);
+        screen->ChangeClip(gc, CT_REGION, update, 0);
     }
     ValidateGC(drawable, gc);
     (*gc->ops->CopyArea)(&pixmap->drawable,
@@ -99,7 +99,7 @@ present_copy_region(DrawablePtr drawable,
                          pixmap->drawable.width, pixmap->drawable.height,
                          x_off, y_off);
     if (update)
-        (*gc->funcs->ChangeClip)(gc, CT_NONE, NULL, 0);
+        screen->ChangeClip(gc, CT_NONE, NULL, 0);
     FreeScratchGC(gc);
 }
 
diff --git a/render/mirect.c b/render/mirect.c
index a36d1d6..4c4b3f8 100644
--- a/render/mirect.c
+++ b/render/mirect.c
@@ -61,7 +61,7 @@ miColorRects(PicturePtr pDst,
 
         pClip = RegionCreate(NULL, 1);
         RegionCopy(pClip, (RegionPtr) pClipPict->clientClip);
-        (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
+        pGC->pScreen->ChangeClip(pGC, CT_REGION, pClip, 0);
     }
 
     ChangeGC(NullClient, pGC, mask, tmpval);
diff --git a/xfixes/region.c b/xfixes/region.c
index dd74d7f..cd8d431 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -616,8 +616,7 @@ ProcXFixesSetGCClipRegion(ClientPtr client)
     vals[0].val = stuff->xOrigin;
     vals[1].val = stuff->yOrigin;
     ChangeGC(NullClient, pGC, GCClipXOrigin | GCClipYOrigin, vals);
-    (*pGC->funcs->ChangeClip) (pGC, pRegion ? CT_REGION : CT_NONE,
-                               (void *) pRegion, 0);
+    pGC->pScreen->ChangeClip(pGC, pRegion ? CT_REGION : CT_NONE, pRegion, 0);
 
     return Success;
 }
-- 
2.9.3



More information about the xorg-devel mailing list