[Pixman] [PATCH 2/2] Support direct fetch to destination for r5g6b5 fetchers

Siarhei Siamashka siarhei.siamashka at gmail.com
Wed Aug 28 18:16:08 PDT 2013


Because the redundant memcpy step is avoided, overall
performance is improved. Running lowlevel-blt-bench on
Intel Core-i7 860 @2.8GHz:

before:    src_0565_8888 =  L1: 931.54  L2: 888.93  M:638.34
after:     src_0565_8888 =  L1:1031.66  L2:1003.42  M:871.54
---
 pixman/pixman-fast-path.c | 6 ++++--
 pixman/pixman-mmx.c       | 6 ++++--
 pixman/pixman-sse2.c      | 6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 2608268..5e43fd6 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -2165,7 +2165,9 @@ static uint32_t *
 fast_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
 {
     int32_t w = iter->width;
-    uint32_t *dst = iter->buffer;
+    uint32_t *buffer = iter->direct_dest_buffer_ptr ?
+                       *iter->direct_dest_buffer_ptr : iter->buffer;
+    uint32_t *dst = buffer;
     const uint16_t *src = (const uint16_t *)iter->bits;
 
     iter->bits += iter->stride;
@@ -2205,7 +2207,7 @@ fast_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
 	*dst = convert_0565_to_8888 (*src);
     }
 
-    return iter->buffer;
+    return buffer;
 }
 
 static uint32_t *
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index c94d282..1cce6d5 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -3836,7 +3836,9 @@ static uint32_t *
 mmx_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
 {
     int w = iter->width;
-    uint32_t *dst = iter->buffer;
+    uint32_t *buffer = iter->direct_dest_buffer_ptr ?
+                       *iter->direct_dest_buffer_ptr : iter->buffer;
+    uint32_t *dst = buffer;
     uint16_t *src = (uint16_t *)iter->bits;
 
     iter->bits += iter->stride;
@@ -3873,7 +3875,7 @@ mmx_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
     }
 
     _mm_empty ();
-    return iter->buffer;
+    return buffer;
 }
 
 static uint32_t *
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index dde9235..11a0971 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -6252,7 +6252,9 @@ static uint32_t *
 sse2_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
 {
     int w = iter->width;
-    uint32_t *dst = iter->buffer;
+    uint32_t *buffer = iter->direct_dest_buffer_ptr ?
+                       *iter->direct_dest_buffer_ptr : iter->buffer;
+    uint32_t *dst = buffer;
     uint16_t *src = (uint16_t *)iter->bits;
     __m128i ff000000 = mask_ff000000;
 
@@ -6291,7 +6293,7 @@ sse2_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
 	w--;
     }
 
-    return iter->buffer;
+    return buffer;
 }
 
 static uint32_t *
-- 
1.8.1.5



More information about the Pixman mailing list