[PATCH 3/3] randr: Initialise the contents of the slaved scanout pixmap
Chris Wilson
chris at chris-wilson.co.uk
Wed Jul 23 04:35:15 PDT 2014
Before we attach the slaved scanout pixmap we need to initialize its
contents as otherwise it may be some time before it is done so in the
next block handler or perhaps even after the next drawing, and
during that time the old uninitialised contents of the pixmap is
visible.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Dave Airlie <airlied at redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst at canonical.com>
---
randr/rrcrtc.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 4d3e31c..c86ea1c 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -24,6 +24,7 @@
#include "randrstr.h"
#include "swaprep.h"
#include "mipointer.h"
+#include "gcstruct.h"
#if 0
#define DBG(x) ErrorF x
@@ -407,6 +408,34 @@ RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
RRCrtcChanged(crtc, TRUE);
}
+static void
+rrInitSharedPixmap(PixmapPtr mpix, PixmapPtr spix, int x, int y)
+{
+ ScreenPtr pScreen = mpix->drawable.pScreen;
+ SourceValidateProcPtr SourceValidate;
+ GCPtr pGC;
+
+ /*
+ * SourceValidate is used by the software cursor code
+ * to pull the cursor off of the screen when reading
+ * bits from the frame buffer. Bypassing this function
+ * leaves the software cursor in place
+ */
+ SourceValidate = pScreen->SourceValidate;
+ pScreen->SourceValidate = NULL;
+
+ pGC = GetScratchGC(mpix->drawable.depth, pScreen);
+ ValidateGC(&mpix->drawable, pGC);
+
+ pGC->ops->CopyArea(&mpix->drawable, &spix->drawable, pGC,
+ x, y,
+ spix->drawable.width, spix->drawable.height,
+ 0, 0);
+ FreeScratchGC(pGC);
+
+ pScreen->SourceValidate = SourceValidate;
+}
+
static Bool
rrCreateSharedPixmap(RRCrtcPtr crtc, int width, int height,
int x, int y)
@@ -448,6 +477,8 @@ rrCreateSharedPixmap(RRCrtcPtr crtc, int width, int height,
return FALSE;
}
+ rrInitSharedPixmap(mscreenpix, mpix, x, y);
+
ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, spix);
if (ret == FALSE) {
DBG(("failed to set shadow slave pixmap\n"));
--
1.9.1
More information about the xorg-devel
mailing list