mi: Add a default no-op miSourceValidate

Slightly simplifies the callers since they don't need to check for
non-NULL anymore.

I do extremely hate the workarounds here to suppress misprite taking the
cursor down though. Surely there's a better way.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Adam Jackson 2019-10-09 11:27:12 -04:00 committed by Adam Jackson
parent 89a9927b1e
commit ff310903f3
13 changed files with 34 additions and 34 deletions

View File

@ -180,9 +180,8 @@ compSourceValidate(DrawablePtr pDrawable,
pScreen->SourceValidate = cs->SourceValidate; pScreen->SourceValidate = cs->SourceValidate;
if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors) if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors)
compPaintChildrenToWindow((WindowPtr) pDrawable); compPaintChildrenToWindow((WindowPtr) pDrawable);
if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
(*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode);
subWindowMode);
cs->SourceValidate = pScreen->SourceValidate; cs->SourceValidate = pScreen->SourceValidate;
pScreen->SourceValidate = compSourceValidate; pScreen->SourceValidate = compSourceValidate;
} }

View File

@ -32,6 +32,7 @@ from The Open Group.
#include <X11/X.h> #include <X11/X.h>
#include "scrnintstr.h" #include "scrnintstr.h"
#include "mi.h"
#include "misc.h" #include "misc.h"
#include "os.h" #include "os.h"
#include "windowstr.h" #include "windowstr.h"
@ -394,7 +395,7 @@ Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty)
* leaves the software cursor in place * leaves the software cursor in place
*/ */
SourceValidate = pScreen->SourceValidate; SourceValidate = pScreen->SourceValidate;
pScreen->SourceValidate = NULL; pScreen->SourceValidate = miSourceValidate;
RegionTranslate(&pixregion, dirty->x, dirty->y); RegionTranslate(&pixregion, dirty->x, dirty->y);
RegionIntersect(&pixregion, &pixregion, region); RegionIntersect(&pixregion, &pixregion, region);

View File

@ -2918,8 +2918,8 @@ The sample server implementation is in Xserver/fb/fbscreen.c.</para>
unsigned int subWindowMode; unsigned int subWindowMode;
</programlisting></blockquote> </programlisting></blockquote>
SourceValidate should be called by CopyArea/CopyPlane primitives when SourceValidate should be called by any primitive that reads from pDrawable.
the SourceValidate function pointer in the screen is non-null. If you know that If you know that
you will never need SourceValidate, you can avoid this check. Currently, you will never need SourceValidate, you can avoid this check. Currently,
SourceValidate is used by the mi software cursor code to remove the cursor SourceValidate is used by the mi software cursor code to remove the cursor
from the screen when the source rectangle overlaps the cursor position. from the screen when the source rectangle overlaps the cursor position.

View File

@ -459,11 +459,9 @@ ExaSrcValidate(DrawablePtr pDrawable,
RegionUnion(dst, dst, &reg); RegionUnion(dst, dst, &reg);
RegionUninit(&reg); RegionUninit(&reg);
if (pExaScr->SavedSourceValidate) { swap(pExaScr, pScreen, SourceValidate);
swap(pExaScr, pScreen, SourceValidate); pScreen->SourceValidate(pDrawable, x, y, width, height, subWindowMode);
pScreen->SourceValidate(pDrawable, x, y, width, height, subWindowMode); swap(pExaScr, pScreen, SourceValidate);
swap(pExaScr, pScreen, SourceValidate);
}
} }
static Bool static Bool

View File

@ -321,9 +321,8 @@ VGAarbiterSourceValidate(DrawablePtr pDrawable,
SCREEN_PROLOG(SourceValidate); SCREEN_PROLOG(SourceValidate);
VGAGet(pScreen); VGAGet(pScreen);
if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
(*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode);
subWindowMode);
VGAPut(); VGAPut();
SCREEN_EPILOG(SourceValidate, VGAarbiterSourceValidate); SCREEN_EPILOG(SourceValidate, VGAarbiterSourceValidate);
} }

View File

@ -28,7 +28,7 @@
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "mi.h"
#include "xf86.h" #include "xf86.h"
#include "xf86DDC.h" #include "xf86DDC.h"
#include "windowstr.h" #include "windowstr.h"
@ -191,7 +191,7 @@ xf86RotateRedisplay(ScreenPtr pScreen)
* leaves the software cursor in place * leaves the software cursor in place
*/ */
SourceValidate = pScreen->SourceValidate; SourceValidate = pScreen->SourceValidate;
pScreen->SourceValidate = NULL; pScreen->SourceValidate = miSourceValidate;
for (c = 0; c < xf86_config->num_crtc; c++) { for (c = 0; c < xf86_config->num_crtc; c++) {
xf86CrtcPtr crtc = xf86_config->crtc[c]; xf86CrtcPtr crtc = xf86_config->crtc[c];

View File

@ -263,7 +263,6 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
pScreen->SaveScreen = xnestSaveScreen; pScreen->SaveScreen = xnestSaveScreen;
pScreen->GetImage = xnestGetImage; pScreen->GetImage = xnestGetImage;
pScreen->GetSpans = xnestGetSpans; pScreen->GetSpans = xnestGetSpans;
pScreen->SourceValidate = NULL;
/* Window Procedures */ /* Window Procedures */

View File

@ -360,6 +360,10 @@ extern _X_EXPORT void miPushPixels(GCPtr /*pGC */ ,
/* miscrinit.c */ /* 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, extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap,
int width, int width,
int height, int height,

View File

@ -158,11 +158,9 @@ miDoCopy(DrawablePtr pSrcDrawable,
return NULL; return NULL;
} }
if (pSrcDrawable->pScreen->SourceValidate) { (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn,
(*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn, widthSrc, heightSrc,
widthSrc, heightSrc, pGC->subWindowMode);
pGC->subWindowMode);
}
/* Compute source clip region */ /* Compute source clip region */
if (pSrcDrawable->type == DRAWABLE_PIXMAP) { if (pSrcDrawable->type == DRAWABLE_PIXMAP) {

View File

@ -130,6 +130,13 @@ miSaveScreen(ScreenPtr pScreen, int on)
return TRUE; 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 /* With the introduction of pixmap privates, the "screen pixmap" can no
* longer be created in miScreenInit, since all the modules that could * longer be created in miScreenInit, since all the modules that could
* possibly ask for pixmap private space have not been initialized at * 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 */ /* QueryBestSize */
pScreen->SaveScreen = miSaveScreen; pScreen->SaveScreen = miSaveScreen;
/* GetImage, GetSpans */ /* GetImage, GetSpans */
pScreen->SourceValidate = (SourceValidateProcPtr) 0; pScreen->SourceValidate = miSourceValidate;
/* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */ /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */
/* RealizeWindow, UnrealizeWindow */ /* RealizeWindow, UnrealizeWindow */
pScreen->ValidateTree = miValidateTree; pScreen->ValidateTree = miValidateTree;

View File

@ -478,9 +478,8 @@ miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, int width,
} }
} }
if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
(*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode);
subWindowMode);
SCREEN_EPILOGUE(pPriv, pScreen, SourceValidate); SCREEN_EPILOGUE(pPriv, pScreen, SourceValidate);
} }

View File

@ -228,10 +228,8 @@ RootlessSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h,
RootlessStartDrawing(pWin); RootlessStartDrawing(pWin);
} }
if (pDrawable->pScreen->SourceValidate) { pDrawable->pScreen->SourceValidate(pDrawable, x, y, w, h,
pDrawable->pScreen->SourceValidate(pDrawable, x, y, w, h, subWindowMode);
subWindowMode);
}
SCREEN_WRAP(pDrawable->pScreen, SourceValidate); SCREEN_WRAP(pDrawable->pScreen, SourceValidate);
} }

View File

@ -294,10 +294,8 @@ SourceValidateOnePicture(PicturePtr pPicture)
pScreen = pDrawable->pScreen; pScreen = pDrawable->pScreen;
if (pScreen->SourceValidate) { pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width,
pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width, pDrawable->height, pPicture->subWindowMode);
pDrawable->height, pPicture->subWindowMode);
}
} }
void void