summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2019-10-09 11:57:18 -0400
committerAdam Jackson <ajax@redhat.com>2019-11-18 14:23:38 -0500
commit68cfee97bc59580724d594c82f5ee55a980dadf0 (patch)
tree262f4f4bdae4ba570a533f82e4826f56b47e2964
parent2320fd4b52a60411714170d516fc58e6ec516353 (diff)
dix: Call SourceValidate before GetImage
This ensures that any prep work for the drawable we're about to read from is already done before we call down to GetImage. This should be no functional change as most of the callers with a non-trivial SourceValidate are already wrapping GetImage and doing the equivalent thing, but we'll be simplifying that shortly. More importantly this ensures that if any of that prep work would generate events - like automatic compositing flushing rendering to a parent pixmap which then triggers damage - then it happens entirely before we start writing the GetImage reply header. Note that we do not do the same for GetSpans, but that's okay. The only way to get to GetSpans is through miCopyArea or miCopyPlane - where the callers must already call SourceValidate - or miGetImage - which this commit now protects with SourceValidate. Fixes: xorg/xserver#902 Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> (cherry picked from commit 516e75dbb6bbf97c7af9c2226242ffd9259fec11)
-rw-r--r--Xext/panoramiXprocs.c10
-rw-r--r--Xext/shm.c9
-rw-r--r--dix/dispatch.c5
-rw-r--r--glx/glxdriswrast.c1
-rw-r--r--render/render.c5
5 files changed, 29 insertions, 1 deletions
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index f31b1e054..32424fcbd 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -1105,6 +1105,10 @@ PanoramiXCopyArea(ClientPtr client)
DixGetAttrAccess);
if (rc != Success)
return rc;
+ drawables[j]->pScreen->SourceValidate(drawables[j], 0, 0,
+ drawables[j]->width,
+ drawables[j]->height,
+ IncludeInferiors);
}
pitch = PixmapBytePad(width, drawables[0]->depth);
@@ -2007,6 +2011,12 @@ PanoramiXGetImage(ClientPtr client)
if (rc != Success)
return rc;
}
+ FOR_NSCREENS_FORWARD(i) {
+ drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
+ drawables[i]->width,
+ drawables[i]->height,
+ IncludeInferiors);
+ }
xgi = (xGetImageReply) {
.type = X_Reply,
diff --git a/Xext/shm.c b/Xext/shm.c
index 506fd4df1..24c6b1087 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -655,6 +655,9 @@ ProcShmGetImage(ClientPtr client)
visual = wVisual(((WindowPtr) pDraw));
if (pDraw->type == DRAWABLE_WINDOW)
pVisibleRegion = &((WindowPtr) pDraw)->borderClip;
+ pDraw->pScreen->SourceValidate(pDraw, stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ IncludeInferiors);
}
else {
if (stuff->x < 0 ||
@@ -863,6 +866,12 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return rc;
}
}
+ FOR_NSCREENS_FORWARD(i) {
+ drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
+ drawables[i]->width,
+ drawables[i]->height,
+ IncludeInferiors);
+ }
xgi = (xShmGetImageReply) {
.type = X_Reply,
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 176c7a0dd..a33bfaa9e 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -2196,8 +2196,11 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
return BadAlloc;
WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
- if (pDraw->type == DRAWABLE_WINDOW)
+ if (pDraw->type == DRAWABLE_WINDOW) {
pVisibleRegion = &((WindowPtr) pDraw)->borderClip;
+ pDraw->pScreen->SourceValidate(pDraw, x, y, width, height,
+ IncludeInferiors);
+ }
if (linesPerBuf == 0) {
/* nothing to do */
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 2858312de..c57d80db7 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -324,6 +324,7 @@ swrastGetImage(__DRIdrawable * draw,
ScreenPtr pScreen = pDraw->pScreen;
__GLXcontext *cx = lastGLContext;
+ pScreen->SourceValidate(pDraw, x, y, w, h, IncludeInferiors);
pScreen->GetImage(pDraw, x, y, w, h, ZPixmap, ~0L, data);
if (cx != lastGLContext) {
lastGLContext = cx;
diff --git a/render/render.c b/render/render.c
index 7d94bd5ff..c376090ca 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1492,6 +1492,11 @@ ProcRenderCreateCursor(ClientPtr client)
return BadAlloc;
}
+ /* what kind of maniac creates a cursor from a window picture though */
+ if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
+ pScreen->SourceValidate(pSrc->pDrawable, 0, 0, width, height,
+ IncludeInferiors);
+
if (pSrc->format == PICT_a8r8g8b8) {
(*pScreen->GetImage) (pSrc->pDrawable,
0, 0, width, height, ZPixmap,