summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-04-15 19:26:34 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-04-15 19:29:47 +0100
commitd30d276aeebe666e2c71a275bb2c71781c75448b (patch)
tree05b080b855783233dbd68f24328dd8baa1f30a93 /src
parentbb69256b5270b6ff64a87db4eb308f1cc856679c (diff)
sna/blt: Reuse computed partial tile offset in copy_from_tiled
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/blt.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/sna/blt.c b/src/sna/blt.c
index e82647e8..c1ac1661 100644
--- a/src/sna/blt.c
+++ b/src/sna/blt.c
@@ -721,13 +721,16 @@ memcpy_from_tiled_x__swizzle_0__sse2(const void *src, void *dst, int bpp,
width *= cpp;
assert(dst_stride >= width);
if (src_x & tile_mask) {
- dst_stride -= width;
offset_x = (src_x & tile_mask) * cpp;
length_x = min(tile_width - offset_x, width);
+ dst_stride -= width;
dst_stride += (width - length_x) & 15;
- } else
+ } else {
+ offset_x = 0;
dst_stride -= width & ~15;
+ }
assert(dst_stride >= 0);
+ src_x = (src_x >> tile_shift) * tile_size;
while (height--) {
unsigned w = width;
@@ -735,17 +738,16 @@ memcpy_from_tiled_x__swizzle_0__sse2(const void *src, void *dst, int bpp,
tile_row += src_y / tile_height * src_stride * tile_height;
tile_row += (src_y & (tile_height-1)) * tile_width;
+ tile_row += src_x;
src_y++;
- if (src_x) {
- tile_row += (src_x >> tile_shift) * tile_size;
- if (src_x & tile_mask) {
- memcpy(dst, tile_row + offset_x, length_x);
- tile_row += tile_size;
- dst = (uint8_t *)dst + length_x;
- w -= length_x;
- }
+ if (offset_x) {
+ memcpy(dst, tile_row + offset_x, length_x);
+ tile_row += tile_size;
+ dst = (uint8_t *)dst + length_x;
+ w -= length_x;
}
+
if ((uintptr_t)dst & 15) {
while (w >= tile_width) {
from_sse128xNu(dst,