xserver: Branch 'master' - 2 commits

Adam Jackson ajax at kemper.freedesktop.org
Mon Mar 20 17:58:44 UTC 2017


 fb/fbimage.c          |    9 ++++++---
 glamor/glamor_image.c |   12 +++++++++++-
 2 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit 1ad230682338a9d2fc6eca6966a5bebb007df32c
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Sep 26 13:28:42 2016 -0400

    glamor: Avoid software fallback for planemasked ZPixmap GetImage
    
    Same trick as in fb: just do a normal GetImage and deal with the
    planemask on the CPU if you have to. Since the software fallback hit for
    glamor is pretty brutal, this is a much more impressive win for glamor
    than it was for fb:
    
      11100.0  87700.0 (7.901) (copy 0xaaaaaaaa) ShmGetImage 10x10 square
       9840.0  47800.0 (4.858) (copy 0xaaaaaaaa) ShmGetImage 100x100 square
       1550.0   4240.0 (2.735) (copy 0xaaaaaaaa) ShmGetImage 500x500 square
       9450.0  78900.0 (8.349) (0xaaaaaaaa) GetImage 10x10 square
       6910.0  30900.0 (4.472) (0xaaaaaaaa) GetImage 100x100 square
        431.0   2020.0 (4.687) (0xaaaaaaaa) GetImage 500x500 square
    
    Measured with Xephyr -glamor on Skylake GT3e.
    
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/glamor/glamor_image.c b/glamor/glamor_image.c
index 315874995..453ef79ba 100644
--- a/glamor/glamor_image.c
+++ b/glamor/glamor_image.c
@@ -116,7 +116,7 @@ glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h,
     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
         goto bail;
 
-    if (format != ZPixmap || !glamor_pm_is_solid(drawable->depth, plane_mask))
+    if (format != ZPixmap)
         goto bail;
 
     glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
@@ -128,6 +128,16 @@ glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h,
                           drawable->x + off_x, drawable->y + off_y,
                           -x, -y,
                           (uint8_t *) d, byte_stride);
+
+    if (!glamor_pm_is_solid(drawable->depth, plane_mask)) {
+        FbStip pm = fbReplicatePixel(plane_mask, drawable->bitsPerPixel);
+        FbStip *dst = (void *)d;
+        uint32_t dstStride = byte_stride / sizeof(FbStip);
+
+        for (int i = 0; i < dstStride * h; i++)
+            dst[i] &= pm;
+    }
+
     return TRUE;
 bail:
     return FALSE;
commit 4aa35c46dab72bc945981f6fd29e494133bc2b0a
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Sep 28 11:18:34 2016 -0400

    fb: Handle ZPixmap planemask in GetImage the other way around
    
    Formerly we'd zero the image data and then pull out a plane at a time.
    It's faster to apply the planemask after the fact, since that turns the
    GetImage into a memcpy:
    
      100000.0  101000.0 (1.010) (copy 0xaaaaaaaa) ShmGetImage 10x10 square
       42400.0   59400.0 (1.401) (copy 0xaaaaaaaa) ShmGetImage 100x100 square
        3040.0    5280.0 (1.737) (copy 0xaaaaaaaa) ShmGetImage 500x500 square
       96100.0   95200.0 (0.991) (0xaaaaaaaa) GetImage 10x10 square
       29600.0   36800.0 (1.243) (0xaaaaaaaa) GetImage 100x100 square
        1850.0    2620.0 (1.416) (0xaaaaaaaa) GetImage 500x500 square
    
    Measured with Xvfb at depth 24 on Skylake i7-6560U.
    
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fbimage.c b/fb/fbimage.c
index d81ed55e4..bd24728fd 100644
--- a/fb/fbimage.c
+++ b/fb/fbimage.c
@@ -233,13 +233,16 @@ fbGetImage(DrawablePtr pDrawable,
 
         pm = fbReplicatePixel(planeMask, srcBpp);
         dstStride = PixmapBytePad(w, pDrawable->depth);
-        if (pm != FB_ALLONES)
-            memset(d, 0, dstStride * h);
         dstStride /= sizeof(FbStip);
         fbBltStip((FbStip *) (src + (y + srcYoff) * srcStride),
                   FbBitsStrideToStipStride(srcStride),
                   (x + srcXoff) * srcBpp,
-                  dst, dstStride, 0, w * srcBpp, h, GXcopy, pm, srcBpp);
+                  dst, dstStride, 0, w * srcBpp, h, GXcopy, FB_ALLONES, srcBpp);
+
+        if (pm != FB_ALLONES) {
+            for (int i = 0; i < dstStride * h; i++)
+                dst[i] &= pm;
+        }
     }
     else {
         dstStride = BitmapBytePad(w) / sizeof(FbStip);


More information about the xorg-commit mailing list