[Pixman] [PATCH 3/4] Add generic fast path for over_n_8888

Ben Avison bavison at riscosopen.org
Tue Feb 5 16:39:14 PST 2013


Cairo-perf-traces is now exercising this as a result of the preceding patch.
This should benefit any platform that hasn't already accelerated this
operation. Below are benchmarks for ARMv6.

[ # ]  backend                         test   min(s) median(s) stddev. count
[ # ]    image: pixman 0.29.3
[  0]    image         t-firefox-chalkboard    8.149    8.162   0.09%    5/6

t-firefox-chalkboard speedup is 1.14x (4.38x for cumulative patches so far)

lowlevel-blt-bench results for over_n_8888:
    Before          After
    Mean   StdDev   Mean   StdDev  Confidence  Change
L1  11.3   0.1      21.3   0.1     100.0%      +89.0%
L2  10.0   0.1      17.5   0.5     100.0%      +73.9%
M   8.6    0.0      14.1   0.0     100.0%      +63.0%
HT  5.1    0.0      12.7   0.1     100.0%      +148.8%
VT  4.9    0.0      12.4   0.1     100.0%      +151.3%
R   4.8    0.0      12.0   0.1     100.0%      +148.6%
RT  2.1    0.0      8.2    0.1     100.0%      +290.1%
---
 pixman/pixman-fast-path.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 59673de..09af2de 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1182,6 +1182,43 @@ fast_composite_src_memcpy (pixman_implementation_t *imp,
     }
 }
 
+static void
+fast_composite_over_n_8888 (pixman_implementation_t *imp,
+                            pixman_composite_info_t *info)
+{
+    PIXMAN_COMPOSITE_ARGS (info);
+    uint32_t  src, srca;
+    uint32_t *dst_line, *dst;
+    int       dst_stride;
+    int32_t   w;
+
+    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
+
+    srca = src >> 24;
+    if (src == 0)
+        return;
+    if (srca == 0xff)
+    {
+        fast_composite_solid_fill (imp, info);
+        return;
+    }
+
+    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
+
+    while (height--)
+    {
+        dst = dst_line;
+        dst_line += dst_stride;
+        w = width;
+
+        while (w--)
+        {
+            *dst = over (src, *dst);
+            dst++;
+        }
+    }
+}
+
 FAST_NEAREST (8888_8888_cover, 8888, 8888, uint32_t, uint32_t, SRC, COVER)
 FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, SRC, NONE)
 FAST_NEAREST (8888_8888_pad, 8888, 8888, uint32_t, uint32_t, SRC, PAD)
@@ -2121,9 +2158,13 @@ static const pixman_fast_path_t c_fast_paths[] =
     PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, a8, a8r8g8b8, fast_composite_over_x888_8_8888),
     PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, a8, x8b8g8r8, fast_composite_over_x888_8_8888),
     PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, a8, a8b8g8r8, fast_composite_over_x888_8_8888),
+    PIXMAN_STD_FAST_PATH (OVER, solid, null, a8r8g8b8, fast_composite_over_n_8888),
+    PIXMAN_STD_FAST_PATH (OVER, solid, null, x8r8g8b8, fast_composite_over_n_8888),
     PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, a8r8g8b8, fast_composite_over_8888_8888),
     PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, x8r8g8b8, fast_composite_over_8888_8888),
     PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, r5g6b5, fast_composite_over_8888_0565),
+    PIXMAN_STD_FAST_PATH (OVER, solid, null, a8b8g8r8, fast_composite_over_n_8888),
+    PIXMAN_STD_FAST_PATH (OVER, solid, null, x8b8g8r8, fast_composite_over_n_8888),
     PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, a8b8g8r8, fast_composite_over_8888_8888),
     PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, x8b8g8r8, fast_composite_over_8888_8888),
     PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, b5g6r5, fast_composite_over_8888_0565),
-- 
1.7.5.4



More information about the Pixman mailing list