diff options
author | Adam Jackson <ajax@redhat.com> | 2016-09-28 11:18:34 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-03-20 13:47:49 -0400 |
commit | 4aa35c46dab72bc945981f6fd29e494133bc2b0a (patch) | |
tree | bd92d47609f61b1409bc87c04d4cb4b1de471e72 /fb | |
parent | 368f60d461421fe5e2bbd90652d6ac858dbff8fe (diff) |
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@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'fb')
-rw-r--r-- | fb/fbimage.c | 9 |
1 files changed, 6 insertions, 3 deletions
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); |