[Pixman] [PATCH 11/12] vmx: implement fast path iterator vmx_fetch_r5g6b5

Oded Gabbay oded.gabbay at gmail.com
Thu Jul 2 03:04:16 PDT 2015


no changes were observed when running cairo trimmed benchmarks.

Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
---
 pixman/pixman-vmx.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c
index ed248e1..f71f358 100644
--- a/pixman/pixman-vmx.c
+++ b/pixman/pixman-vmx.c
@@ -3432,6 +3432,55 @@ vmx_fetch_x8r8g8b8 (pixman_iter_t *iter, const uint32_t *mask)
     return iter->buffer;
 }
 
+static uint32_t *
+vmx_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
+{
+    int w = iter->width;
+    uint32_t *dst = iter->buffer;
+    uint16_t *src = (uint16_t *)iter->bits;
+    vector unsigned int ff000000 = mask_ff000000;
+
+    iter->bits += iter->stride;
+
+    while (w && ((uintptr_t)dst) & 0x0f)
+    {
+	uint16_t s = *src++;
+
+	*dst++ = convert_0565_to_8888 (s);
+	w--;
+    }
+
+    while (w >= 8)
+    {
+	vector unsigned int lo, hi, s;
+
+	s = load_128_unaligned((uint32_t *) src);
+
+	lo = unpack_565_to_8888(
+		unpacklo_128_8x16(s, (vector unsigned int) AVV(0)));
+
+	hi = unpack_565_to_8888(
+		unpackhi_128_8x16(s, (vector unsigned int) AVV(0)));
+
+	save_128_aligned(dst, vec_or(hi, ff000000));
+	save_128_aligned(dst + 4, vec_or(lo, ff000000));
+
+	dst += 8;
+	src += 8;
+	w -= 8;
+    }
+
+    while (w)
+    {
+	uint16_t s = *src++;
+
+	*dst++ = convert_0565_to_8888 (s);
+	w--;
+    }
+
+    return iter->buffer;
+}
+
 #define IMAGE_FLAGS							\
     (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM |		\
      FAST_PATH_BITS_IMAGE | FAST_PATH_SAMPLES_COVER_CLIP_NEAREST)
@@ -3441,6 +3490,9 @@ static const pixman_iter_info_t vmx_iters[] =
     { PIXMAN_x8r8g8b8, IMAGE_FLAGS, ITER_NARROW,
       _pixman_iter_init_bits_stride, vmx_fetch_x8r8g8b8, NULL
     },
+    { PIXMAN_r5g6b5, IMAGE_FLAGS, ITER_NARROW,
+      _pixman_iter_init_bits_stride, vmx_fetch_r5g6b5, NULL
+    },
     { PIXMAN_null },
 };
 
-- 
2.4.3



More information about the Pixman mailing list