diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2018-12-18 21:39:04 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-12-19 12:19:17 +0100 |
commit | 034228d75ba1be6b035bdd387c183f14379abdc4 (patch) | |
tree | 30fbb9595f5df18f27d53c21322d3d9991cdbb8d /nx-X11/programs/Xserver/fb/fbsetsp.c | |
parent | 020ef045e0df09bc2f664d8d6e4b6600da53b41a (diff) | |
download | nx-libs-034228d75ba1be6b035bdd387c183f14379abdc4.tar.gz nx-libs-034228d75ba1be6b035bdd387c183f14379abdc4.tar.bz2 nx-libs-034228d75ba1be6b035bdd387c183f14379abdc4.zip |
fb: fix fast-path blt detection
Backport of this commit:
commit a2880699e8f1f576e1a48ebf25e8982463323f84
Author: Keith Packard <keithp@keithp.com>
Date: Tue Mar 25 08:21:16 2014 -0700
fb: fix fast-path blt detection
The width parameter is used to disable the blit fast-path (memcpy) when
source and destination rows overlap in memory. This check was added in [0].
Unfortunately, the calculation to determine if source and destination
lines overlapped was incorrect:
(1) it converts width from pixels to bytes, but width is actually in
bits, not pixels.
(2) it adds this byte offset to dst/srcLine, which implicitly converts
the offset from bytes to sizeof(FbBits).
Fix both of these by converting addresses to byte pointers and width
to bytes and doing comparisons on the resulting byte address.
For example:
A 32-bpp 1366 pixel-wide row will have
width = 1366 * 32 = 43712 bits
bpp = 32
(bpp >> 3) = 4
width * (bpp >> 3) = 174848 FbBits
(FbBits *)width => 699392 bytes
So, "careful" was true if the destination line was within 699392 bytes,
instead of just within its 1366 * 4 = 5464 byte row.
This bug causes us to take the slow path for large non-overlapping rows
that are "close" in memory. As a data point, XGetImage(1366x768) on my
ARM chromebook was taking ~140 ms, but with this fixed, it now takes
about 60 ms.
XGetImage() -> exaGetImage() -> fbGetImage -> fbBlt()
[0] commit e32cc0b4c85c78cd8743a6e1680dcc79054b57ce
Author: Adam Jackson <ajax@redhat.com>
Date: Thu Apr 21 16:37:11 2011 -0400
fb: Fix memcpy abuse
The memcpy fast path implicitly assumes that the copy walks
left-to-right. That's not something memcpy guarantees, and newer glibc
on some processors will indeed break that assumption. Since we walk a
line at a time, check the source and destination against the width of
the blit to determine whether we can be sloppy enough to allow memcpy.
(Having done this, we can remove the check for !reverse as well.)
v3: Convert to byte units
This first checks to make sure the blt is byte aligned, converts all
of the data to byte units and then compares for byte address range
overlap between source and dest.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Diffstat (limited to 'nx-X11/programs/Xserver/fb/fbsetsp.c')
0 files changed, 0 insertions, 0 deletions