From 2320fd4b52a60411714170d516fc58e6ec516353 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 9 Oct 2019 11:27:12 -0400 Subject: [PATCH] mi: Add a default no-op miSourceValidate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. [1.20: Do not in fact simplify the callers as above, since it would change the ABI. - ajax] Reviewed-by: Michel Dänzer (cherry picked from commit ff310903f34ac34c916ad74e919d1ac12aea4715) --- dix/pixmap.c | 3 ++- doc/Xserver-spec.xml | 4 ++-- hw/xfree86/modes/xf86Rotate.c | 4 ++-- hw/xnest/Screen.c | 1 - mi/mi.h | 4 ++++ mi/miscrinit.c | 8 +++++++- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/dix/pixmap.c b/dix/pixmap.c index 81ac5e2d8..6923e7e7b 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" @@ -395,7 +396,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 3dde65178..0ac2224e9 100644 --- a/doc/Xserver-spec.xml +++ b/doc/Xserver-spec.xml @@ -2930,8 +2930,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/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/miscrinit.c b/mi/miscrinit.c index 9c6af0dc7..264622df1 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -124,6 +124,12 @@ miCloseScreen(ScreenPtr pScreen) return ((*pScreen->DestroyPixmap) ((PixmapPtr) pScreen->devPrivate)); } +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 @@ -243,7 +249,7 @@ miScreenInit(ScreenPtr pScreen, void *pbits, /* pointer to screen bits */ } /* else CloseScreen */ /* QueryBestSize, SaveScreen, GetImage, GetSpans */ - pScreen->SourceValidate = (SourceValidateProcPtr) 0; + pScreen->SourceValidate = miSourceValidate; /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */ /* RealizeWindow, UnrealizeWindow */ pScreen->ValidateTree = miValidateTree;