diff --git a/composite/compinit.c b/composite/compinit.c index b19b3da62..69abb0a40 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -180,9 +180,8 @@ compSourceValidate(DrawablePtr pDrawable, pScreen->SourceValidate = cs->SourceValidate; if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors) compPaintChildrenToWindow((WindowPtr) pDrawable); - if (pScreen->SourceValidate) - (*pScreen->SourceValidate) (pDrawable, x, y, width, height, - subWindowMode); + (*pScreen->SourceValidate) (pDrawable, x, y, width, height, + subWindowMode); cs->SourceValidate = pScreen->SourceValidate; pScreen->SourceValidate = compSourceValidate; } diff --git a/dix/pixmap.c b/dix/pixmap.c index ad3254cb4..c970438ed 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -32,6 +32,7 @@ from The Open Group. #include #include "scrnintstr.h" +#include "mi.h" #include "misc.h" #include "os.h" #include "windowstr.h" @@ -394,7 +395,7 @@ Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty) * leaves the software cursor in place */ SourceValidate = pScreen->SourceValidate; - pScreen->SourceValidate = NULL; + pScreen->SourceValidate = miSourceValidate; RegionTranslate(&pixregion, dirty->x, dirty->y); RegionIntersect(&pixregion, &pixregion, region); diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml index c89ec527c..2c7e17a86 100644 --- a/doc/Xserver-spec.xml +++ b/doc/Xserver-spec.xml @@ -2918,8 +2918,8 @@ The sample server implementation is in Xserver/fb/fbscreen.c. unsigned int subWindowMode; -SourceValidate should be called by CopyArea/CopyPlane primitives when -the SourceValidate function pointer in the screen is non-null. If you know that +SourceValidate should be called by any primitive that reads from pDrawable. +If you know that you will never need SourceValidate, you can avoid this check. Currently, SourceValidate is used by the mi software cursor code to remove the cursor from the screen when the source rectangle overlaps the cursor position. diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c index 73eada9c2..ed1401a98 100644 --- a/exa/exa_unaccel.c +++ b/exa/exa_unaccel.c @@ -459,11 +459,9 @@ ExaSrcValidate(DrawablePtr pDrawable, RegionUnion(dst, dst, ®); RegionUninit(®); - if (pExaScr->SavedSourceValidate) { - swap(pExaScr, pScreen, SourceValidate); - pScreen->SourceValidate(pDrawable, x, y, width, height, subWindowMode); - swap(pExaScr, pScreen, SourceValidate); - } + swap(pExaScr, pScreen, SourceValidate); + pScreen->SourceValidate(pDrawable, x, y, width, height, subWindowMode); + swap(pExaScr, pScreen, SourceValidate); } static Bool diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c index 40f241aee..9db8d044f 100644 --- a/hw/xfree86/common/xf86VGAarbiter.c +++ b/hw/xfree86/common/xf86VGAarbiter.c @@ -321,9 +321,8 @@ VGAarbiterSourceValidate(DrawablePtr pDrawable, SCREEN_PROLOG(SourceValidate); VGAGet(pScreen); - if (pScreen->SourceValidate) - (*pScreen->SourceValidate) (pDrawable, x, y, width, height, - subWindowMode); + (*pScreen->SourceValidate) (pDrawable, x, y, width, height, + subWindowMode); VGAPut(); SCREEN_EPILOG(SourceValidate, VGAarbiterSourceValidate); } diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index 85ab9b8c7..a8f1e615c 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -28,7 +28,7 @@ #include #include #include - +#include "mi.h" #include "xf86.h" #include "xf86DDC.h" #include "windowstr.h" @@ -191,7 +191,7 @@ xf86RotateRedisplay(ScreenPtr pScreen) * leaves the software cursor in place */ SourceValidate = pScreen->SourceValidate; - pScreen->SourceValidate = NULL; + pScreen->SourceValidate = miSourceValidate; for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index 30c6a4623..ac01c248c 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -263,7 +263,6 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) pScreen->SaveScreen = xnestSaveScreen; pScreen->GetImage = xnestGetImage; pScreen->GetSpans = xnestGetSpans; - pScreen->SourceValidate = NULL; /* Window Procedures */ diff --git a/mi/mi.h b/mi/mi.h index db62c9166..2cd3066c1 100644 --- a/mi/mi.h +++ b/mi/mi.h @@ -360,6 +360,10 @@ extern _X_EXPORT void miPushPixels(GCPtr /*pGC */ , /* miscrinit.c */ +extern _X_EXPORT void +miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h, + unsigned int subWindowMode); + extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, diff --git a/mi/micopy.c b/mi/micopy.c index d563ea682..dd40ec0e3 100644 --- a/mi/micopy.c +++ b/mi/micopy.c @@ -158,11 +158,9 @@ miDoCopy(DrawablePtr pSrcDrawable, return NULL; } - if (pSrcDrawable->pScreen->SourceValidate) { - (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn, - widthSrc, heightSrc, - pGC->subWindowMode); - } + (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn, + widthSrc, heightSrc, + pGC->subWindowMode); /* Compute source clip region */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) { diff --git a/mi/miscrinit.c b/mi/miscrinit.c index f38298266..64a160b0c 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -130,6 +130,13 @@ miSaveScreen(ScreenPtr pScreen, int on) return TRUE; } +void +miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h, + unsigned int subWindowMode) +{ +} + + /* With the introduction of pixmap privates, the "screen pixmap" can no * longer be created in miScreenInit, since all the modules that could * possibly ask for pixmap private space have not been initialized at @@ -251,7 +258,7 @@ miScreenInit(ScreenPtr pScreen, void *pbits, /* pointer to screen bits */ /* QueryBestSize */ pScreen->SaveScreen = miSaveScreen; /* GetImage, GetSpans */ - pScreen->SourceValidate = (SourceValidateProcPtr) 0; + pScreen->SourceValidate = miSourceValidate; /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */ /* RealizeWindow, UnrealizeWindow */ pScreen->ValidateTree = miValidateTree; diff --git a/mi/misprite.c b/mi/misprite.c index add2c5505..379dd4883 100644 --- a/mi/misprite.c +++ b/mi/misprite.c @@ -478,9 +478,8 @@ miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, int width, } } - if (pScreen->SourceValidate) - (*pScreen->SourceValidate) (pDrawable, x, y, width, height, - subWindowMode); + (*pScreen->SourceValidate) (pDrawable, x, y, width, height, + subWindowMode); SCREEN_EPILOGUE(pPriv, pScreen, SourceValidate); } diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c index 2ec0ae54d..a99a2d158 100644 --- a/miext/rootless/rootlessScreen.c +++ b/miext/rootless/rootlessScreen.c @@ -228,10 +228,8 @@ RootlessSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h, RootlessStartDrawing(pWin); } - if (pDrawable->pScreen->SourceValidate) { - pDrawable->pScreen->SourceValidate(pDrawable, x, y, w, h, - subWindowMode); - } + pDrawable->pScreen->SourceValidate(pDrawable, x, y, w, h, + subWindowMode); SCREEN_WRAP(pDrawable->pScreen, SourceValidate); } diff --git a/render/mipict.c b/render/mipict.c index 4b855122e..7fb03435b 100644 --- a/render/mipict.c +++ b/render/mipict.c @@ -294,10 +294,8 @@ SourceValidateOnePicture(PicturePtr pPicture) pScreen = pDrawable->pScreen; - if (pScreen->SourceValidate) { - pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width, - pDrawable->height, pPicture->subWindowMode); - } + pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width, + pDrawable->height, pPicture->subWindowMode); } void