diff options
author | David Schleef <ds@schleef.org> | 2009-11-23 06:34:19 +0100 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2011-05-17 10:21:43 -0700 |
commit | 45f22591881a2477d264defb09d900ed39514f53 (patch) | |
tree | bd826ac379d88efa6ecbed61aedb756daf3d63b8 | |
parent | 3489c6b030c3a800aa8815bbe45325aee5c7d536 (diff) |
orc: Add orc backend
-rw-r--r-- | pixman/Makefile.am | 26 | ||||
-rw-r--r-- | pixman/pixman-cpu.c | 3 | ||||
-rw-r--r-- | pixman/pixman-orc.c | 497 | ||||
-rw-r--r-- | pixman/pixman-orccode.orc | 123 | ||||
-rw-r--r-- | pixman/pixman-private.h | 5 |
5 files changed, 654 insertions, 0 deletions
diff --git a/pixman/Makefile.am b/pixman/Makefile.am index be08266..3443003 100644 --- a/pixman/Makefile.am +++ b/pixman/Makefile.am @@ -124,5 +124,31 @@ libpixman_1_la_LIBADD += libpixman-arm-neon.la ASM_CFLAGS_arm_neon= endif +# orc code +if USE_ORC +noinst_LTLIBRARIES += libpixman-orc.la +libpixman_orc_la_SOURCES = \ + pixman-orc.c +libpixman_orc_la_CFLAGS = $(DEP_CFLAGS) $(ORC_CFLAGS) +libpixman_orc_la_LIBADD = $(DEP_LIBS) +libpixman_1_la_LDFLAGS += $(ORC_LDFLAGS) +libpixman_1_la_LIBADD += libpixman-orc.la + +$(libpixman_orc_la_SOURCES:.c=.s) : ASM_CFLAGS= + +nodist_libpixman_orc_la_SOURCES = pixman-orccode.c pixman-orccode.h +BUILT_SOURCES += pixman-orccode.c pixman-orccode.h +CLEANFILES += pixman-orccode.c pixman-orccode.h + +EXTRA_DIST += pixman-orccode.orc + +pixman-orccode.c: $(srcdir)/pixman-orccode.orc + $(ORCC) --implementation -o pixman-orccode.c $(srcdir)/pixman-orccode.orc + +pixman-orccode.h: $(srcdir)/pixman-orccode.orc + $(ORCC) --header -o pixman-orccode.h $(srcdir)/pixman-orccode.orc + +endif + .c.s : $(libpixmaninclude_HEADERS) $(BUILT_SOURCES) $(CC) $(CFLAGS) $(ASM_CFLAGS_$(@:pixman-%.s=%)) $(ASM_CFLAGS_$(@:pixman-arm-%.s=arm_%)) -DHAVE_CONFIG_H -I$(srcdir) -I$(builddir) -I$(top_builddir) -S -o $@ $< diff --git a/pixman/pixman-cpu.c b/pixman/pixman-cpu.c index 0e14ecb..17060b1 100644 --- a/pixman/pixman-cpu.c +++ b/pixman/pixman-cpu.c @@ -581,6 +581,9 @@ _pixman_choose_implementation (void) imp = _pixman_implementation_create_general(); imp = _pixman_implementation_create_fast_path (imp); +#ifdef USE_ORC + return _pixman_implementation_create_orc (); +#endif #ifdef USE_MMX if (pixman_have_mmx ()) imp = _pixman_implementation_create_mmx (imp); diff --git a/pixman/pixman-orc.c b/pixman/pixman-orc.c new file mode 100644 index 0000000..3c14471 --- /dev/null +++ b/pixman/pixman-orc.c @@ -0,0 +1,497 @@ +/* + * Copyright 2009 David Schleef <ds@schleef.org> + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Entropy Wave not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Entropy Wave makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * Author: David Schleef <ds@schleef.org> + */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <orc/orc.h> + +#include "pixmanorc.h" +#include "pixman-private.h" +#include "pixman-combine32.h" + +#include <stdio.h> + +#define static + + +static void +orc_combine_over_u (pixman_implementation_t *imp, + pixman_op_t op, + uint32_t * dst, + const uint32_t * src, + const uint32_t * mask, + int width) +{ + //printf("dst %p src %p mask %p width %d\n", dst, src, mask, width); + if (mask) { + orc_code_combine_over_u (dst, src, mask, width); + } else { + orc_code_combine_over_u_n (dst, src, width); + } +} + +static void +orc_combine_in_u (pixman_implementation_t *imp, + pixman_op_t op, + uint32_t * dst, + const uint32_t * src, + const uint32_t * mask, + int width) +{ + //printf("dst %p src %p mask %p width %d\n", dst, src, mask, width); + if (mask) { + orc_code_combine_in_u (dst, src, mask, width); + } else { + orc_code_combine_in_u_n (dst, src, width); + } +} + +static void +orc_combine_add_u (pixman_implementation_t *imp, + pixman_op_t op, + uint32_t * dst, + const uint32_t * src, + const uint32_t * mask, + int width) +{ + if (mask) { + orc_code_combine_add_u (dst, src, mask, width); + } else { + orc_code_combine_add_u_n (dst, src, width); + } +} + + +pixman_bool_t +pixman_fill_orc (uint32_t *bits, + int stride, + int bpp, + int x, + int y, + int width, + int height, + uint32_t data) +{ + uint8_t *line; + + if (bpp == 16 && (data >> 16 != (data & 0xffff))) + return FALSE; + + if (bpp == 16) { + stride *= 4; + line = (uint8_t *)bits + stride * y + 2 * x; + orc_splat_u16_2d ((uint16_t *)line, stride, data, width, height); + } else if (bpp == 32) { + stride *= 4; + line = (uint8_t *)bits + stride * y + 4 * x; + orc_splat_u32_2d ((uint32_t *)line, stride, data, width, height); + } else { + return FALSE; + } + + return TRUE; +} + +static pixman_bool_t +pixman_blt_orc (uint32_t *src_bits, + uint32_t *dst_bits, + int src_stride, + int dst_stride, + int src_bpp, + int dst_bpp, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + uint8_t *src_line; + uint8_t *dst_line; + + if (src_bpp != dst_bpp) return FALSE; + + if (src_bpp == 16) { + src_stride *= 4; + dst_stride *= 4; + src_line = (uint8_t *)src_bits + src_stride * src_y + 2 * src_x; + dst_line = (uint8_t *)dst_bits + dst_stride * dst_y + 2 * dst_x; + orc_copy_u16_2d ((uint16_t *)dst_line, dst_stride, + (uint16_t *)src_line, src_stride, width, height); + } else if (src_bpp == 32) { + src_stride *= 4; + dst_stride *= 4; + src_line = (uint8_t *)src_bits + src_stride * src_y + 4 * src_x; + dst_line = (uint8_t *)dst_bits + dst_stride * dst_y + 4 * dst_x; + orc_copy_u32_2d ((uint32_t *)dst_line, dst_stride, + (uint32_t *)src_line, src_stride, width, height); + } else { + return FALSE; + } + + return TRUE; +} + +static void +orc_composite_copy_area (pixman_implementation_t *imp, + pixman_op_t op, + pixman_image_t * src_image, + pixman_image_t * mask_image, + pixman_image_t * dst_image, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height) +{ + pixman_blt_orc (src_image->bits.bits, + dst_image->bits.bits, + src_image->bits.rowstride, + dst_image->bits.rowstride, + PIXMAN_FORMAT_BPP (src_image->bits.format), + PIXMAN_FORMAT_BPP (dst_image->bits.format), + src_x, src_y, dest_x, dest_y, width, height); +} + + +static void +orc_composite_add_8888_8888 (pixman_implementation_t *imp, + pixman_op_t op, + pixman_image_t * src_image, + pixman_image_t * mask_image, + pixman_image_t * dst_image, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height) +{ + uint32_t *src, *src_line; + uint32_t *dst, *dst_line; + int src_stride, dst_stride; + + PIXMAN_IMAGE_GET_LINE ( + dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); + PIXMAN_IMAGE_GET_LINE ( + src_image, src_x, src_y, uint32_t, src_stride, src_line, 1); + + while (height--) { + src = src_line; + src_line += src_stride; + dst = dst_line; + dst_line += dst_stride; + + orc_composite_add_8888_8888_line (dst, src, width); + } +} + + +static void +orc_composite_add_8000_8000 (pixman_implementation_t *imp, + pixman_op_t op, + pixman_image_t * src_image, + pixman_image_t * mask_image, + pixman_image_t * dst_image, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height) +{ + uint8_t *src, *src_line; + uint8_t *dst, *dst_line; + int src_stride, dst_stride; + + PIXMAN_IMAGE_GET_LINE ( + dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1); + PIXMAN_IMAGE_GET_LINE ( + src_image, src_x, src_y, uint8_t, src_stride, src_line, 1); + + while (height--) { + src = src_line; + src_line += src_stride; + dst = dst_line; + dst_line += dst_stride; + + orc_composite_add_8_8_line (dst, src, width); + } +} + +static void +orc_composite_add_n_8_8 (pixman_implementation_t *imp, + pixman_op_t op, + pixman_image_t * src_image, + pixman_image_t * mask_image, + pixman_image_t * dst_image, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height) +{ + uint8_t *dst, *dst_line; + uint8_t *mask, *mask_line; + int mask_stride, dst_stride; + int src; + + PIXMAN_IMAGE_GET_LINE ( + dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1); + PIXMAN_IMAGE_GET_LINE ( + mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1); + + src = _pixman_image_get_solid (src_image, dst_image->bits.format); + + while (height--) { + dst = dst_line; + dst_line += dst_stride; + mask = mask_line; + mask_line += mask_stride; + + orc_composite_add_n_8_8_line (dst, mask, src, width); + } +} + + +static const pixman_fast_path_t orc_fast_paths[] = +{ +#if 0 + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_r5g6b5, orc_composite_over_n_8_0565 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_b5g6r5, orc_composite_over_n_8_0565 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_null, PIXMAN_a8r8g8b8, orc_composite_over_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_null, PIXMAN_x8r8g8b8, orc_composite_over_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_null, PIXMAN_r5g6b5, orc_composite_over_n_0565 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_a8r8g8b8, orc_composite_over_8888_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, orc_composite_over_8888_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_a8b8g8r8, orc_composite_over_8888_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, orc_composite_over_8888_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_r5g6b5, orc_composite_over_8888_0565 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_b5g6r5, orc_composite_over_8888_0565 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8r8g8b8, orc_composite_over_n_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8r8g8b8, orc_composite_over_n_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8b8g8r8, orc_composite_over_n_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8b8g8r8, orc_composite_over_n_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_a8, PIXMAN_x8r8g8b8, orc_composite_over_8888_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_a8, PIXMAN_a8r8g8b8, orc_composite_over_8888_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_a8, PIXMAN_x8b8g8r8, orc_composite_over_8888_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_a8, PIXMAN_a8b8g8r8, orc_composite_over_8888_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8, PIXMAN_x8r8g8b8, orc_composite_over_x888_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8, PIXMAN_a8r8g8b8, orc_composite_over_x888_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8, PIXMAN_x8b8g8r8, orc_composite_over_x888_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8, PIXMAN_a8b8g8r8, orc_composite_over_x888_8_8888 }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_solid, PIXMAN_a8r8g8b8, orc_composite_over_x888_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_solid, PIXMAN_x8r8g8b8, orc_composite_over_x888_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_solid, PIXMAN_a8b8g8r8, orc_composite_over_x888_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_solid, PIXMAN_x8b8g8r8, orc_composite_over_x888_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_solid, PIXMAN_a8r8g8b8, orc_composite_over_8888_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_solid, PIXMAN_x8r8g8b8, orc_composite_over_8888_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_solid, PIXMAN_a8b8g8r8, orc_composite_over_8888_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_solid, PIXMAN_x8b8g8r8, orc_composite_over_8888_n_8888 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8r8g8b8_ca, PIXMAN_a8r8g8b8, orc_composite_over_n_8888_8888_ca }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8r8g8b8_ca, PIXMAN_x8r8g8b8, orc_composite_over_n_8888_8888_ca }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8b8g8r8_ca, PIXMAN_a8b8g8r8, orc_composite_over_n_8888_8888_ca }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8b8g8r8_ca, PIXMAN_x8b8g8r8, orc_composite_over_n_8888_8888_ca }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8r8g8b8_ca, PIXMAN_r5g6b5, orc_composite_over_n_8888_0565_ca }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8b8g8r8_ca, PIXMAN_b5g6r5, orc_composite_over_n_8888_0565_ca }, + { PIXMAN_OP_OVER, PIXMAN_pixbuf, PIXMAN_pixbuf, PIXMAN_a8r8g8b8, orc_composite_over_pixbuf_8888 }, + { PIXMAN_OP_OVER, PIXMAN_pixbuf, PIXMAN_pixbuf, PIXMAN_x8r8g8b8, orc_composite_over_pixbuf_8888 }, + { PIXMAN_OP_OVER, PIXMAN_rpixbuf, PIXMAN_rpixbuf, PIXMAN_a8b8g8r8, orc_composite_over_pixbuf_8888 }, + { PIXMAN_OP_OVER, PIXMAN_rpixbuf, PIXMAN_rpixbuf, PIXMAN_x8b8g8r8, orc_composite_over_pixbuf_8888 }, + { PIXMAN_OP_OVER, PIXMAN_pixbuf, PIXMAN_pixbuf, PIXMAN_r5g6b5, orc_composite_over_pixbuf_0565 }, + { PIXMAN_OP_OVER, PIXMAN_rpixbuf, PIXMAN_rpixbuf, PIXMAN_b5g6r5, orc_composite_over_pixbuf_0565 }, +#endif + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, orc_composite_copy_area }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, orc_composite_copy_area }, +#if 0 + + { PIXMAN_OP_ADD, PIXMAN_solid, PIXMAN_a8r8g8b8_ca, PIXMAN_a8r8g8b8, orc_composite_add_n_8888_8888_ca }, +#endif + { PIXMAN_OP_ADD, PIXMAN_a8, PIXMAN_null, PIXMAN_a8, orc_composite_add_8000_8000 }, + { PIXMAN_OP_ADD, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_a8r8g8b8, orc_composite_add_8888_8888 }, + { PIXMAN_OP_ADD, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_a8b8g8r8, orc_composite_add_8888_8888 }, +// { PIXMAN_OP_ADD, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8, orc_composite_add_n_8_8 }, + +#if 0 + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8r8g8b8, orc_composite_src_n_8_8888 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8r8g8b8, orc_composite_src_n_8_8888 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8b8g8r8, orc_composite_src_n_8_8888 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8b8g8r8, orc_composite_src_n_8_8888 }, +#endif + { PIXMAN_OP_SRC, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_a8r8g8b8, orc_composite_copy_area }, + { PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_a8b8g8r8, orc_composite_copy_area }, + { PIXMAN_OP_SRC, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, orc_composite_copy_area }, + { PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, orc_composite_copy_area }, + { PIXMAN_OP_SRC, PIXMAN_x8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, orc_composite_copy_area }, + { PIXMAN_OP_SRC, PIXMAN_x8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, orc_composite_copy_area }, + { PIXMAN_OP_SRC, PIXMAN_r5g6b5, PIXMAN_null, PIXMAN_r5g6b5, orc_composite_copy_area }, + { PIXMAN_OP_SRC, PIXMAN_b5g6r5, PIXMAN_null, PIXMAN_b5g6r5, orc_composite_copy_area }, + +#if 0 + { PIXMAN_OP_IN, PIXMAN_a8, PIXMAN_null, PIXMAN_a8, orc_composite_in_8_8 }, + { PIXMAN_OP_IN, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8, orc_composite_in_n_8_8 }, +#endif + + { PIXMAN_OP_NONE }, +}; + +static void +orc_composite (pixman_implementation_t *imp, + pixman_op_t op, + pixman_image_t * src, + pixman_image_t * mask, + pixman_image_t * dest, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height) +{ + if (_pixman_run_fast_path (orc_fast_paths, imp, + op, src, mask, dest, + src_x, src_y, + mask_x, mask_y, + dest_x, dest_y, + width, height)) + { + return; + } + + _pixman_implementation_composite (imp->delegate, op, + src, mask, dest, + src_x, src_y, + mask_x, mask_y, + dest_x, dest_y, + width, height); +} + +static pixman_bool_t +orc_blt (pixman_implementation_t *imp, + uint32_t * src_bits, + uint32_t * dst_bits, + int src_stride, + int dst_stride, + int src_bpp, + int dst_bpp, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + if (!pixman_blt_orc ( + src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp, + src_x, src_y, dst_x, dst_y, width, height)) + + { + return _pixman_implementation_blt ( + imp->delegate, + src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp, + src_x, src_y, dst_x, dst_y, width, height); + } + + return TRUE; +} + +static pixman_bool_t +orc_fill (pixman_implementation_t *imp, + uint32_t * bits, + int stride, + int bpp, + int x, + int y, + int width, + int height, + uint32_t xor) +{ + if (!pixman_fill_orc (bits, stride, bpp, x, y, width, height, xor)) + { + return _pixman_implementation_fill ( + imp->delegate, bits, stride, bpp, x, y, width, height, xor); + } + + return TRUE; +} + + +pixman_implementation_t * +_pixman_implementation_create_orc (void) +{ +#ifdef USE_SSE2x + pixman_implementation_t *general = _pixman_implementation_create_sse2 (); +#else + pixman_implementation_t *general = _pixman_implementation_create_fast_path (); +#endif + pixman_implementation_t *imp = _pixman_implementation_create (general); + + orc_init (); + + //imp->combine_32[PIXMAN_OP_OVER] = orc_combine_over_u; + //imp->combine_32[PIXMAN_OP_OVER_REVERSE] = orc_combine_over_reverse_u; + imp->combine_32[PIXMAN_OP_IN] = orc_combine_in_u; + //imp->combine_32[PIXMAN_OP_IN_REVERSE] = orc_combine_in_reverse_u; + //imp->combine_32[PIXMAN_OP_OUT] = orc_combine_out_u; + //imp->combine_32[PIXMAN_OP_OUT_REVERSE] = orc_combine_out_reverse_u; + //imp->combine_32[PIXMAN_OP_ATOP] = orc_combine_atop_u; + //imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = orc_combine_atop_reverse_u; + //imp->combine_32[PIXMAN_OP_XOR] = orc_combine_xor_u; + imp->combine_32[PIXMAN_OP_ADD] = orc_combine_add_u; + + //imp->combine_32[PIXMAN_OP_SATURATE] = orc_combine_saturate_u; + + //imp->combine_32_ca[PIXMAN_OP_SRC] = orc_combine_src_ca; + //imp->combine_32_ca[PIXMAN_OP_OVER] = orc_combine_over_ca; + //imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = orc_combine_over_reverse_ca; + //imp->combine_32_ca[PIXMAN_OP_IN] = orc_combine_in_ca; + //imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = orc_combine_in_reverse_ca; + //imp->combine_32_ca[PIXMAN_OP_OUT] = orc_combine_out_ca; + //imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = orc_combine_out_reverse_ca; + //imp->combine_32_ca[PIXMAN_OP_ATOP] = orc_combine_atop_ca; + //imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = orc_combine_atop_reverse_ca; + //imp->combine_32_ca[PIXMAN_OP_XOR] = orc_combine_xor_ca; + //imp->combine_32_ca[PIXMAN_OP_ADD] = orc_combine_add_ca; + + imp->composite = orc_composite; + imp->blt = orc_blt; + imp->fill = orc_fill; + + return imp; +} + diff --git a/pixman/pixman-orccode.orc b/pixman/pixman-orccode.orc new file mode 100644 index 0000000..edb2ab7 --- /dev/null +++ b/pixman/pixman-orccode.orc @@ -0,0 +1,123 @@ + + +.function orc_splat_u16 +.dest 2 d1 uint16_t +.param 2 p1 + +copyw d1, p1 + + +.function orc_splat_u32 +.dest 4 d1 uint32_t +.param 4 p1 + +copyl d1, p1 + + +.function orc_splat_u16_2d +.dest 2 d1 uint16_t +.param 2 p1 +.flags 2d + +copyw d1, p1 + + +.function orc_splat_u32_2d +.dest 4 d1 uint32_t +.param 4 p1 +.flags 2d + +copyl d1, p1 + + +.function orc_copy_u16_2d +.dest 2 d1 +.source 2 s1 +.flags 2d + +copyw d1, s1 + + +.function orc_copy_u32_2d +.dest 4 d1 +.source 4 s1 +.flags 2d + +copyl d1, s1 + + +.function orc_composite_add_8888_8888_line +.dest 4 d1 +.source 4 s1 + +compadd d1, d1, s1 + + +.function orc_composite_add_8_8_line +.dest 1 d1 +.source 1 s1 + +addusb d1, d1, s1 + + +.function orc_composite_add_n_8_8_line +.dest 1 d1 +.source 1 s1 +.param 1 p1 +.temp 1 t1 + +compina t1, p1, s1 +addusb d1, d1, t1 + + +.function orc_code_combine_add_u +.dest 4 d1 +.source 4 s1 +.source 4 s2 +.temp 4 t1 + +compin t1, s1, s2 +compadd d1, d1, t1 + + +.function orc_code_combine_add_u_n +.dest 4 d1 +.source 4 s1 + +compadd d1, d1, s1 + + +.function orc_code_combine_over_u +.dest 4 d1 +.source 4 s1 +.source 4 s2 +.temp 4 t1 + +compin t1, s1, s2 +compover d1, d1, t1 + + +.function orc_code_combine_over_u_n +.dest 4 d1 +.source 4 s1 + +compover d1, d1, s1 + + +.function orc_code_combine_in_u +.dest 4 d1 +.source 4 s1 +.source 4 s2 +.temp 4 t1 + +compin t1, s1, s2 +compin d1, t1, d1 + + +.function orc_code_combine_in_u_n +.dest 4 d1 +.source 4 s1 + +compin d1, s1, d1 + + diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 60060a9..ed24d20 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -548,6 +548,11 @@ pixman_implementation_t * _pixman_implementation_create_vmx (pixman_implementation_t *fallback); #endif +#ifdef USE_ORC +pixman_implementation_t * +_pixman_implementation_create_orc (void); +#endif + pixman_implementation_t * _pixman_choose_implementation (void); |