summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Avison <bavison@riscosopen.org>2014-07-30 16:44:33 +0100
committerBen Avison <bavison@riscosopen.org>2015-10-15 15:04:06 +0100
commitb548620787af557628a26951192aa5fb0ea87946 (patch)
tree8049ab4c417cde1b3eacc6f4aea720ef81d6f343
parent2e1cda57088a298888a850ac7ddd43b2e794ae85 (diff)
armv6: Add nearest-scaled-cover src_8888_8888 fast path
Without this patch, any such operations are matched against the fast path implementation in pixman-fast-path.c before general_composite_rect(), so we never get to use the armv6-optimised assembly fetcher routines. This patch adds a C wrapper to the same assembly routine used for the nearest-scaled-cover fetcher, adapted to perform a 2D plot rather than a single scanlne. The C is macroised so that later patches can use the same approach to build more complex fast paths from combinations of armv6 fetcher/combiner/writeback routines in a similar manner to pixcman_composite_rect(). lowlevel-blt-bench -n src_8888_8888: Before After Mean StdDev Mean StdDev Confidence Change L1 117.2 1.6 79.2 1.1 100.0% -32.4% L2 44.1 3.1 49.9 2.4 100.0% +13.2% M 40.0 0.1 72.5 0.1 100.0% +81.4% HT 20.1 0.1 29.5 0.3 100.0% +46.5% VT 19.4 0.1 27.7 0.2 100.0% +42.7% R 18.2 0.1 26.2 0.2 100.0% +44.1% RT 8.7 0.2 10.0 0.2 100.0% +15.8% affine-bench * 0 0 1 src a8r8g8b8 a8r8g8b8: Before After Mean StdDev Mean StdDev Confidence Change 0.5 46.6 0.1 110.5 0.1 100.0% +137.2% 0.75 39.1 0.1 88.5 0.1 100.0% +126.1% 1.0 36.3 0.2 71.7 0.1 100.0% +97.7% 1.5 26.7 0.1 55.3 0.1 100.0% +106.8% 2.0 19.9 0.0 43.5 0.0 100.0% +119.2%
-rw-r--r--pixman/pixman-arm-common.h9
-rw-r--r--pixman/pixman-arm-simd.c95
2 files changed, 104 insertions, 0 deletions
diff --git a/pixman/pixman-arm-common.h b/pixman/pixman-arm-common.h
index cc27848..c2f15dc 100644
--- a/pixman/pixman-arm-common.h
+++ b/pixman/pixman-arm-common.h
@@ -528,6 +528,15 @@ cputype##_get_scanline_nearest_scaled_cover_##name (pixman_iter_t *iter, \
NULL \
}
+#define PIXMAN_ARM_NEAREST_SCALED_COVER_SRC_DST_FAST_PATH(cputype,op,s,d,func) \
+ { PIXMAN_OP_ ## op, \
+ PIXMAN_ ## s, \
+ PIXMAN_ARM_NEAREST_SCALED_COVER_FLAGS, \
+ PIXMAN_null, 0, \
+ PIXMAN_ ## d, FAST_PATH_STD_DEST_FLAGS, \
+ cputype ## _composite_nearest_scaled_cover_ ## func \
+ }
+
/*****************************************************************************/
/* Support for untransformed fetchers and writeback */
diff --git a/pixman/pixman-arm-simd.c b/pixman/pixman-arm-simd.c
index f791430..ea6ab78 100644
--- a/pixman/pixman-arm-simd.c
+++ b/pixman/pixman-arm-simd.c
@@ -31,6 +31,11 @@
#include "pixman-arm-common.h"
#include "pixman-inlines.h"
+#define SCANLINE_BUFFER_LENGTH 8192
+
+#define ALIGN(addr) \
+ ((uint8_t *)((((uintptr_t)(addr)) + 15) & (~15)))
+
PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, src_8888_8888,
uint32_t, 1, uint32_t, 1)
PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, src_x888_8888,
@@ -83,6 +88,8 @@ PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (armv6, 0565_0565, SRC,
PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (armv6, 8888_8888, SRC,
uint32_t, uint32_t)
+#define pixman_composite_scanline_src_asm_armv6(w, dst, src) do { (void)(w); (void)(dst); (void)(src); } while (0)
+
void
pixman_composite_scanline_src_mask_asm_armv6 (int32_t w,
uint32_t *dst,
@@ -111,6 +118,8 @@ PIXMAN_ARM_BIND_COMBINE_U (armv6, out)
PIXMAN_ARM_BIND_COMBINE_U (armv6, out_reverse)
PIXMAN_ARM_BIND_COMBINE_U (armv6, add)
+#define pixman_get_scanline_a8r8g8b8_asm_armv6(w, dst, src) do { (void)(w); (void)(dst); (void)(src); } while (0)
+#define pixman_write_back_a8r8g8b8_asm_armv6(w, dst, src) do { (void)(w); (void)(dst); (void)(src); } while (0)
PIXMAN_ARM_BIND_GET_SCANLINE (armv6, x8r8g8b8)
PIXMAN_ARM_BIND_GET_SCANLINE (armv6, r5g6b5)
PIXMAN_ARM_BIND_WRITE_BACK (armv6, r5g6b5)
@@ -144,6 +153,85 @@ PIXMAN_ARM_BIND_GET_SCANLINE_NEAREST_SCALED_COVER (armv6, x8r8g8b8, x888, uint32
PIXMAN_ARM_BIND_GET_SCANLINE_NEAREST_SCALED_COVER (armv6, r5g6b5, 0565, uint16_t)
PIXMAN_ARM_BIND_GET_SCANLINE_NEAREST_SCALED_COVER (armv6, a8, 8, uint8_t)
+#define NEAREST_SCALED_COVER_USES_SRC_BUFFER(op, src_format, dst_format) \
+ (PIXMAN_OP_##op != PIXMAN_OP_SRC || \
+ (PIXMAN_##dst_format != PIXMAN_a8r8g8b8 && \
+ (PIXMAN_##src_format != PIXMAN_r5g6b5 || PIXMAN_##dst_format != PIXMAN_r5g6b5)))
+
+#define NEAREST_SCALED_COVER_USES_DST_BUFFER(op, dst_format) \
+ (PIXMAN_OP_##op != PIXMAN_OP_SRC && PIXMAN_##dst_format != PIXMAN_a8r8g8b8)
+
+#define BIND_NEAREST_SCALED_COVER_FAST_PATH_SRC_DST(cputype, name, OP, op, src_type, dst_type, src_format, dst_format) \
+static void \
+cputype##_composite_nearest_scaled_cover_##name (pixman_implementation_t *imp, \
+ pixman_composite_info_t *info) \
+{ \
+ uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH]; \
+ uint8_t *scanline_buffer = stack_scanline_buffer; \
+ PIXMAN_COMPOSITE_ARGS (info); \
+ dst_type *dst_line, *dst; \
+ src_type *src_bits, *src; \
+ uint32_t *end_of_buffer, *dst_buffer, *src_buffer; \
+ int dst_stride, src_stride; \
+ pixman_fixed_t x, y, uxx, uxy, uyy; \
+ \
+ end_of_buffer = dst_buffer = src_buffer = (uint32_t *) ALIGN (scanline_buffer); \
+ if (NEAREST_SCALED_COVER_USES_SRC_BUFFER (OP, src_format, dst_format)) \
+ end_of_buffer = dst_buffer = (uint32_t *) ALIGN (src_buffer + width); \
+ if (NEAREST_SCALED_COVER_USES_DST_BUFFER (OP, dst_format)) \
+ end_of_buffer = dst_buffer + width; \
+ if (NEAREST_SCALED_COVER_USES_SRC_BUFFER (OP, src_format, dst_format) && \
+ (uint8_t *) end_of_buffer > scanline_buffer + sizeof stack_scanline_buffer) \
+ { \
+ scanline_buffer = pixman_malloc_ab_plus_c (end_of_buffer - src_buffer, sizeof (uint32_t), 15); \
+ \
+ if (!scanline_buffer) \
+ return; \
+ \
+ src_buffer = (uint32_t *) ALIGN (scanline_buffer); \
+ dst_buffer = (uint32_t *) ALIGN (src_buffer + width); \
+ } \
+ \
+ PIXMAN_ARM_IMAGE_GET_SCALED (src_image, src_x, src_y, src_type, src_stride, src_bits, x, y, uxx, uxy, uyy); \
+ PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, dst_stride, dst_line, 1); \
+ \
+ while (height--) \
+ { \
+ dst = dst_line; \
+ dst_line += dst_stride; \
+ src = src_bits + src_stride * pixman_fixed_to_int (y - pixman_fixed_e); \
+ if (PIXMAN_OP_##OP == PIXMAN_OP_SRC && \
+ PIXMAN_##src_format == PIXMAN_r5g6b5 && \
+ PIXMAN_##dst_format == PIXMAN_r5g6b5) \
+ pixman_get_scanline_r5g6b5_nearest_scaled_cover_r5g6b5_asm_##cputype ( \
+ width, x - pixman_fixed_e, uxx, (uint16_t *) dst, (uint16_t *) src); \
+ else if (NEAREST_SCALED_COVER_USES_SRC_BUFFER (OP, src_format, dst_format)) \
+ pixman_get_scanline_nearest_scaled_cover_##src_format##_asm_##cputype ( \
+ width, x - pixman_fixed_e, uxx, src_buffer, src, NULL); \
+ else \
+ pixman_get_scanline_nearest_scaled_cover_##src_format##_asm_##cputype ( \
+ width, x - pixman_fixed_e, uxx, (uint32_t *) dst, src, NULL); \
+ if (NEAREST_SCALED_COVER_USES_DST_BUFFER (OP, dst_format)) \
+ { \
+ pixman_get_scanline_##dst_format##_asm_##cputype (width, dst_buffer, (uint32_t *) dst); \
+ pixman_composite_scanline_##op##_asm_##cputype (width, dst_buffer, src_buffer); \
+ pixman_write_back_##dst_format##_asm_##cputype (width, (uint32_t *) dst, dst_buffer); \
+ } \
+ else if (PIXMAN_OP_##OP != PIXMAN_OP_SRC) \
+ pixman_composite_scanline_##op##_asm_##cputype (width, (uint32_t *) dst, src_buffer); \
+ else if (NEAREST_SCALED_COVER_USES_SRC_BUFFER (OP, src_format, dst_format)) \
+ pixman_write_back_##dst_format##_asm_##cputype (width, (uint32_t *) dst, src_buffer); \
+ x += uxy; \
+ y += uyy; \
+ } \
+ \
+ if (NEAREST_SCALED_COVER_USES_SRC_BUFFER (OP, src_format, dst_format) && \
+ scanline_buffer != stack_scanline_buffer) \
+ free (scanline_buffer); \
+}
+
+BIND_NEAREST_SCALED_COVER_FAST_PATH_SRC_DST (armv6, src_8888_8888, SRC, src, uint32_t, uint32_t, a8r8g8b8, a8r8g8b8)
+
void
pixman_composite_src_n_8888_asm_armv6 (int32_t w,
int32_t h,
@@ -358,6 +446,13 @@ static const pixman_fast_path_t arm_simd_fast_paths[] =
PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, a8b8g8r8, armv6_composite_over_n_8888_8888_ca),
PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, x8b8g8r8, armv6_composite_over_n_8888_8888_ca),
+ PIXMAN_ARM_NEAREST_SCALED_COVER_SRC_DST_FAST_PATH (armv6, SRC, a8r8g8b8, a8r8g8b8, src_8888_8888),
+ PIXMAN_ARM_NEAREST_SCALED_COVER_SRC_DST_FAST_PATH (armv6, SRC, a8r8g8b8, x8r8g8b8, src_8888_8888),
+ PIXMAN_ARM_NEAREST_SCALED_COVER_SRC_DST_FAST_PATH (armv6, SRC, x8r8g8b8, x8r8g8b8, src_8888_8888),
+ PIXMAN_ARM_NEAREST_SCALED_COVER_SRC_DST_FAST_PATH (armv6, SRC, a8b8g8r8, a8b8g8r8, src_8888_8888),
+ PIXMAN_ARM_NEAREST_SCALED_COVER_SRC_DST_FAST_PATH (armv6, SRC, a8b8g8r8, x8b8g8r8, src_8888_8888),
+ PIXMAN_ARM_NEAREST_SCALED_COVER_SRC_DST_FAST_PATH (armv6, SRC, x8b8g8r8, x8b8g8r8, src_8888_8888),
+
SIMPLE_NEAREST_FAST_PATH (SRC, r5g6b5, r5g6b5, armv6_0565_0565),
SIMPLE_NEAREST_FAST_PATH (SRC, b5g6r5, b5g6r5, armv6_0565_0565),