[PATCH 2/2] glamor: use write only for putimage in some cases (v2)

Dave Airlie airlied at gmail.com
Tue Aug 23 01:41:45 UTC 2016


From: Dave Airlie <airlied at redhat.com>

Ilia pointed out that xlock -mode wator is slow, this speeds it
up by avoiding the ReadPixels on every frame.

The current criteria for putimage is

a) ALU copy operation
b) planemask all set
c) region is contained inside pCompositeClip

v2: check for rgnIN (Peter Harris)

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 glamor/glamor_image.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/glamor/glamor_image.c b/glamor/glamor_image.c
index 3158749..055472e 100644
--- a/glamor/glamor_image.c
+++ b/glamor/glamor_image.c
@@ -88,7 +88,19 @@ static void
 glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
                       int w, int h, int leftPad, int format, char *bits)
 {
-    if (glamor_prepare_access_box(drawable, GLAMOR_ACCESS_RW, x, y, w, h))
+    int access = GLAMOR_ACCESS_RW;
+
+    if (gc->alu == GXcopy && glamor_pm_is_solid(gc->depth, gc->planemask)) {
+	BoxRec box;
+	box.x1 = x;
+	box.y1 = y;
+	box.x2 = x + w;
+	box.y2 = y + h;
+
+	if (RegionContainsRect(gc->pCompositeClip, &box) == rgnIN)
+            access = GLAMOR_ACCESS_WO;
+    }
+    if (glamor_prepare_access_box(drawable, access, x, y, w, h))
         fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
     glamor_finish_access(drawable);
 }
-- 
2.5.5



More information about the xorg-devel mailing list