diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-14 19:49:29 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-14 19:49:29 +0000 |
commit | aac022cbb3342e7027301a3f8c9add8929edbad6 (patch) | |
tree | da51104389cb4214eac6e31f804d15a0999a42b2 | |
parent | 5647e2981d81fd2b5cdb22d544f83d2d0f9445c9 (diff) |
sna: Optimise single pixel transfers
Surprisingly frequent.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/blt.c | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/src/sna/blt.c b/src/sna/blt.c index ca154532..1b56cc7a 100644 --- a/src/sna/blt.c +++ b/src/sna/blt.c @@ -64,9 +64,45 @@ memcpy_blt(const void *src, void *dst, int bpp, return; } - do { - memcpy(dst_bytes, src_bytes, byte_width); - src_bytes += src_stride; - dst_bytes += dst_stride; - } while (--height); + switch (byte_width) { + case 1: + do { + *dst_bytes = *src_bytes; + src_bytes += src_stride; + dst_bytes += dst_stride; + } while (--height); + break; + + case 2: + do { + *(uint16_t *)dst_bytes = *(uint16_t *)src_bytes; + src_bytes += src_stride; + dst_bytes += dst_stride; + } while (--height); + break; + + case 4: + do { + *(uint32_t *)dst_bytes = *(uint32_t *)src_bytes; + src_bytes += src_stride; + dst_bytes += dst_stride; + } while (--height); + break; + + case 8: + do { + *(uint64_t *)dst_bytes = *(uint64_t *)src_bytes; + src_bytes += src_stride; + dst_bytes += dst_stride; + } while (--height); + break; + + default: + do { + memcpy(dst_bytes, src_bytes, byte_width); + src_bytes += src_stride; + dst_bytes += dst_stride; + } while (--height); + break; + } } |