Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright © 2008 Mozilla Corporation |
michael@0 | 3 | * |
michael@0 | 4 | * Permission to use, copy, modify, distribute, and sell this software and its |
michael@0 | 5 | * documentation for any purpose is hereby granted without fee, provided that |
michael@0 | 6 | * the above copyright notice appear in all copies and that both that |
michael@0 | 7 | * copyright notice and this permission notice appear in supporting |
michael@0 | 8 | * documentation, and that the name of Mozilla Corporation not be used in |
michael@0 | 9 | * advertising or publicity pertaining to distribution of the software without |
michael@0 | 10 | * specific, written prior permission. Mozilla Corporation makes no |
michael@0 | 11 | * representations about the suitability of this software for any purpose. It |
michael@0 | 12 | * is provided "as is" without express or implied warranty. |
michael@0 | 13 | * |
michael@0 | 14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS |
michael@0 | 15 | * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
michael@0 | 16 | * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY |
michael@0 | 17 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
michael@0 | 18 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN |
michael@0 | 19 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING |
michael@0 | 20 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
michael@0 | 21 | * SOFTWARE. |
michael@0 | 22 | * |
michael@0 | 23 | * Author: Jeff Muizelaar (jeff@infidigm.net) |
michael@0 | 24 | * |
michael@0 | 25 | */ |
michael@0 | 26 | #ifdef HAVE_CONFIG_H |
michael@0 | 27 | #include <config.h> |
michael@0 | 28 | #endif |
michael@0 | 29 | |
michael@0 | 30 | #include "pixman-private.h" |
michael@0 | 31 | #include "pixman-arm-common.h" |
michael@0 | 32 | #include "pixman-inlines.h" |
michael@0 | 33 | |
michael@0 | 34 | PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, src_8888_8888, |
michael@0 | 35 | uint32_t, 1, uint32_t, 1) |
michael@0 | 36 | PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, src_x888_8888, |
michael@0 | 37 | uint32_t, 1, uint32_t, 1) |
michael@0 | 38 | PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, src_0565_0565, |
michael@0 | 39 | uint16_t, 1, uint16_t, 1) |
michael@0 | 40 | PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, src_8_8, |
michael@0 | 41 | uint8_t, 1, uint8_t, 1) |
michael@0 | 42 | PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, src_0565_8888, |
michael@0 | 43 | uint16_t, 1, uint32_t, 1) |
michael@0 | 44 | |
michael@0 | 45 | PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, add_8_8, |
michael@0 | 46 | uint8_t, 1, uint8_t, 1) |
michael@0 | 47 | PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, over_8888_8888, |
michael@0 | 48 | uint32_t, 1, uint32_t, 1) |
michael@0 | 49 | |
michael@0 | 50 | PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, armv6, over_8888_n_8888, |
michael@0 | 51 | uint32_t, 1, uint32_t, 1) |
michael@0 | 52 | |
michael@0 | 53 | PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, armv6, over_n_8_8888, |
michael@0 | 54 | uint8_t, 1, uint32_t, 1) |
michael@0 | 55 | |
michael@0 | 56 | PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (armv6, 0565_0565, SRC, |
michael@0 | 57 | uint16_t, uint16_t) |
michael@0 | 58 | PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (armv6, 8888_8888, SRC, |
michael@0 | 59 | uint32_t, uint32_t) |
michael@0 | 60 | |
michael@0 | 61 | void |
michael@0 | 62 | pixman_composite_src_n_8888_asm_armv6 (int32_t w, |
michael@0 | 63 | int32_t h, |
michael@0 | 64 | uint32_t *dst, |
michael@0 | 65 | int32_t dst_stride, |
michael@0 | 66 | uint32_t src); |
michael@0 | 67 | |
michael@0 | 68 | void |
michael@0 | 69 | pixman_composite_src_n_0565_asm_armv6 (int32_t w, |
michael@0 | 70 | int32_t h, |
michael@0 | 71 | uint16_t *dst, |
michael@0 | 72 | int32_t dst_stride, |
michael@0 | 73 | uint16_t src); |
michael@0 | 74 | |
michael@0 | 75 | void |
michael@0 | 76 | pixman_composite_src_n_8_asm_armv6 (int32_t w, |
michael@0 | 77 | int32_t h, |
michael@0 | 78 | uint8_t *dst, |
michael@0 | 79 | int32_t dst_stride, |
michael@0 | 80 | uint8_t src); |
michael@0 | 81 | |
michael@0 | 82 | static pixman_bool_t |
michael@0 | 83 | arm_simd_fill (pixman_implementation_t *imp, |
michael@0 | 84 | uint32_t * bits, |
michael@0 | 85 | int stride, /* in 32-bit words */ |
michael@0 | 86 | int bpp, |
michael@0 | 87 | int x, |
michael@0 | 88 | int y, |
michael@0 | 89 | int width, |
michael@0 | 90 | int height, |
michael@0 | 91 | uint32_t _xor) |
michael@0 | 92 | { |
michael@0 | 93 | /* stride is always multiple of 32bit units in pixman */ |
michael@0 | 94 | uint32_t byte_stride = stride * sizeof(uint32_t); |
michael@0 | 95 | |
michael@0 | 96 | switch (bpp) |
michael@0 | 97 | { |
michael@0 | 98 | case 8: |
michael@0 | 99 | pixman_composite_src_n_8_asm_armv6 ( |
michael@0 | 100 | width, |
michael@0 | 101 | height, |
michael@0 | 102 | (uint8_t *)(((char *) bits) + y * byte_stride + x), |
michael@0 | 103 | byte_stride, |
michael@0 | 104 | _xor & 0xff); |
michael@0 | 105 | return TRUE; |
michael@0 | 106 | case 16: |
michael@0 | 107 | pixman_composite_src_n_0565_asm_armv6 ( |
michael@0 | 108 | width, |
michael@0 | 109 | height, |
michael@0 | 110 | (uint16_t *)(((char *) bits) + y * byte_stride + x * 2), |
michael@0 | 111 | byte_stride / 2, |
michael@0 | 112 | _xor & 0xffff); |
michael@0 | 113 | return TRUE; |
michael@0 | 114 | case 32: |
michael@0 | 115 | pixman_composite_src_n_8888_asm_armv6 ( |
michael@0 | 116 | width, |
michael@0 | 117 | height, |
michael@0 | 118 | (uint32_t *)(((char *) bits) + y * byte_stride + x * 4), |
michael@0 | 119 | byte_stride / 4, |
michael@0 | 120 | _xor); |
michael@0 | 121 | return TRUE; |
michael@0 | 122 | default: |
michael@0 | 123 | return FALSE; |
michael@0 | 124 | } |
michael@0 | 125 | } |
michael@0 | 126 | |
michael@0 | 127 | static pixman_bool_t |
michael@0 | 128 | arm_simd_blt (pixman_implementation_t *imp, |
michael@0 | 129 | uint32_t * src_bits, |
michael@0 | 130 | uint32_t * dst_bits, |
michael@0 | 131 | int src_stride, /* in 32-bit words */ |
michael@0 | 132 | int dst_stride, /* in 32-bit words */ |
michael@0 | 133 | int src_bpp, |
michael@0 | 134 | int dst_bpp, |
michael@0 | 135 | int src_x, |
michael@0 | 136 | int src_y, |
michael@0 | 137 | int dest_x, |
michael@0 | 138 | int dest_y, |
michael@0 | 139 | int width, |
michael@0 | 140 | int height) |
michael@0 | 141 | { |
michael@0 | 142 | if (src_bpp != dst_bpp) |
michael@0 | 143 | return FALSE; |
michael@0 | 144 | |
michael@0 | 145 | switch (src_bpp) |
michael@0 | 146 | { |
michael@0 | 147 | case 8: |
michael@0 | 148 | pixman_composite_src_8_8_asm_armv6 ( |
michael@0 | 149 | width, height, |
michael@0 | 150 | (uint8_t *)(((char *) dst_bits) + |
michael@0 | 151 | dest_y * dst_stride * 4 + dest_x * 1), dst_stride * 4, |
michael@0 | 152 | (uint8_t *)(((char *) src_bits) + |
michael@0 | 153 | src_y * src_stride * 4 + src_x * 1), src_stride * 4); |
michael@0 | 154 | return TRUE; |
michael@0 | 155 | case 16: |
michael@0 | 156 | pixman_composite_src_0565_0565_asm_armv6 ( |
michael@0 | 157 | width, height, |
michael@0 | 158 | (uint16_t *)(((char *) dst_bits) + |
michael@0 | 159 | dest_y * dst_stride * 4 + dest_x * 2), dst_stride * 2, |
michael@0 | 160 | (uint16_t *)(((char *) src_bits) + |
michael@0 | 161 | src_y * src_stride * 4 + src_x * 2), src_stride * 2); |
michael@0 | 162 | return TRUE; |
michael@0 | 163 | case 32: |
michael@0 | 164 | pixman_composite_src_8888_8888_asm_armv6 ( |
michael@0 | 165 | width, height, |
michael@0 | 166 | (uint32_t *)(((char *) dst_bits) + |
michael@0 | 167 | dest_y * dst_stride * 4 + dest_x * 4), dst_stride, |
michael@0 | 168 | (uint32_t *)(((char *) src_bits) + |
michael@0 | 169 | src_y * src_stride * 4 + src_x * 4), src_stride); |
michael@0 | 170 | return TRUE; |
michael@0 | 171 | default: |
michael@0 | 172 | return FALSE; |
michael@0 | 173 | } |
michael@0 | 174 | } |
michael@0 | 175 | |
michael@0 | 176 | static const pixman_fast_path_t arm_simd_fast_paths[] = |
michael@0 | 177 | { |
michael@0 | 178 | PIXMAN_STD_FAST_PATH (SRC, a8r8g8b8, null, a8r8g8b8, armv6_composite_src_8888_8888), |
michael@0 | 179 | PIXMAN_STD_FAST_PATH (SRC, a8b8g8r8, null, a8b8g8r8, armv6_composite_src_8888_8888), |
michael@0 | 180 | PIXMAN_STD_FAST_PATH (SRC, a8r8g8b8, null, x8r8g8b8, armv6_composite_src_8888_8888), |
michael@0 | 181 | PIXMAN_STD_FAST_PATH (SRC, a8b8g8r8, null, x8b8g8r8, armv6_composite_src_8888_8888), |
michael@0 | 182 | PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, x8r8g8b8, armv6_composite_src_8888_8888), |
michael@0 | 183 | PIXMAN_STD_FAST_PATH (SRC, x8b8g8r8, null, x8b8g8r8, armv6_composite_src_8888_8888), |
michael@0 | 184 | |
michael@0 | 185 | PIXMAN_STD_FAST_PATH (SRC, x8b8g8r8, null, a8b8g8r8, armv6_composite_src_x888_8888), |
michael@0 | 186 | PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, a8r8g8b8, armv6_composite_src_x888_8888), |
michael@0 | 187 | |
michael@0 | 188 | PIXMAN_STD_FAST_PATH (SRC, r5g6b5, null, r5g6b5, armv6_composite_src_0565_0565), |
michael@0 | 189 | PIXMAN_STD_FAST_PATH (SRC, b5g6r5, null, b5g6r5, armv6_composite_src_0565_0565), |
michael@0 | 190 | PIXMAN_STD_FAST_PATH (SRC, a1r5g5b5, null, a1r5g5b5, armv6_composite_src_0565_0565), |
michael@0 | 191 | PIXMAN_STD_FAST_PATH (SRC, a1b5g5r5, null, a1b5g5r5, armv6_composite_src_0565_0565), |
michael@0 | 192 | PIXMAN_STD_FAST_PATH (SRC, a1r5g5b5, null, x1r5g5b5, armv6_composite_src_0565_0565), |
michael@0 | 193 | PIXMAN_STD_FAST_PATH (SRC, a1b5g5r5, null, x1b5g5r5, armv6_composite_src_0565_0565), |
michael@0 | 194 | PIXMAN_STD_FAST_PATH (SRC, x1r5g5b5, null, x1r5g5b5, armv6_composite_src_0565_0565), |
michael@0 | 195 | PIXMAN_STD_FAST_PATH (SRC, x1b5g5r5, null, x1b5g5r5, armv6_composite_src_0565_0565), |
michael@0 | 196 | PIXMAN_STD_FAST_PATH (SRC, a4r4g4b4, null, a4r4g4b4, armv6_composite_src_0565_0565), |
michael@0 | 197 | PIXMAN_STD_FAST_PATH (SRC, a4b4g4r4, null, a4b4g4r4, armv6_composite_src_0565_0565), |
michael@0 | 198 | PIXMAN_STD_FAST_PATH (SRC, a4r4g4b4, null, x4r4g4b4, armv6_composite_src_0565_0565), |
michael@0 | 199 | PIXMAN_STD_FAST_PATH (SRC, a4b4g4r4, null, x4b4g4r4, armv6_composite_src_0565_0565), |
michael@0 | 200 | PIXMAN_STD_FAST_PATH (SRC, x4r4g4b4, null, x4r4g4b4, armv6_composite_src_0565_0565), |
michael@0 | 201 | PIXMAN_STD_FAST_PATH (SRC, x4b4g4r4, null, x4b4g4r4, armv6_composite_src_0565_0565), |
michael@0 | 202 | |
michael@0 | 203 | PIXMAN_STD_FAST_PATH (SRC, a8, null, a8, armv6_composite_src_8_8), |
michael@0 | 204 | PIXMAN_STD_FAST_PATH (SRC, r3g3b2, null, r3g3b2, armv6_composite_src_8_8), |
michael@0 | 205 | PIXMAN_STD_FAST_PATH (SRC, b2g3r3, null, b2g3r3, armv6_composite_src_8_8), |
michael@0 | 206 | PIXMAN_STD_FAST_PATH (SRC, a2r2g2b2, null, a2r2g2b2, armv6_composite_src_8_8), |
michael@0 | 207 | PIXMAN_STD_FAST_PATH (SRC, a2b2g2r2, null, a2b2g2r2, armv6_composite_src_8_8), |
michael@0 | 208 | PIXMAN_STD_FAST_PATH (SRC, c8, null, c8, armv6_composite_src_8_8), |
michael@0 | 209 | PIXMAN_STD_FAST_PATH (SRC, g8, null, g8, armv6_composite_src_8_8), |
michael@0 | 210 | PIXMAN_STD_FAST_PATH (SRC, x4a4, null, x4a4, armv6_composite_src_8_8), |
michael@0 | 211 | PIXMAN_STD_FAST_PATH (SRC, x4c4, null, x4c4, armv6_composite_src_8_8), |
michael@0 | 212 | PIXMAN_STD_FAST_PATH (SRC, x4g4, null, x4g4, armv6_composite_src_8_8), |
michael@0 | 213 | |
michael@0 | 214 | PIXMAN_STD_FAST_PATH (SRC, r5g6b5, null, a8r8g8b8, armv6_composite_src_0565_8888), |
michael@0 | 215 | PIXMAN_STD_FAST_PATH (SRC, r5g6b5, null, x8r8g8b8, armv6_composite_src_0565_8888), |
michael@0 | 216 | PIXMAN_STD_FAST_PATH (SRC, b5g6r5, null, a8b8g8r8, armv6_composite_src_0565_8888), |
michael@0 | 217 | PIXMAN_STD_FAST_PATH (SRC, b5g6r5, null, x8b8g8r8, armv6_composite_src_0565_8888), |
michael@0 | 218 | |
michael@0 | 219 | PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, a8r8g8b8, armv6_composite_over_8888_8888), |
michael@0 | 220 | PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, x8r8g8b8, armv6_composite_over_8888_8888), |
michael@0 | 221 | PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, a8b8g8r8, armv6_composite_over_8888_8888), |
michael@0 | 222 | PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, x8b8g8r8, armv6_composite_over_8888_8888), |
michael@0 | 223 | PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid, a8r8g8b8, armv6_composite_over_8888_n_8888), |
michael@0 | 224 | PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid, x8r8g8b8, armv6_composite_over_8888_n_8888), |
michael@0 | 225 | PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid, a8b8g8r8, armv6_composite_over_8888_n_8888), |
michael@0 | 226 | PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid, x8b8g8r8, armv6_composite_over_8888_n_8888), |
michael@0 | 227 | |
michael@0 | 228 | PIXMAN_STD_FAST_PATH (ADD, a8, null, a8, armv6_composite_add_8_8), |
michael@0 | 229 | |
michael@0 | 230 | PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8r8g8b8, armv6_composite_over_n_8_8888), |
michael@0 | 231 | PIXMAN_STD_FAST_PATH (OVER, solid, a8, x8r8g8b8, armv6_composite_over_n_8_8888), |
michael@0 | 232 | PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8b8g8r8, armv6_composite_over_n_8_8888), |
michael@0 | 233 | PIXMAN_STD_FAST_PATH (OVER, solid, a8, x8b8g8r8, armv6_composite_over_n_8_8888), |
michael@0 | 234 | |
michael@0 | 235 | PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, r5g6b5, r5g6b5, armv6_0565_0565), |
michael@0 | 236 | PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, b5g6r5, b5g6r5, armv6_0565_0565), |
michael@0 | 237 | |
michael@0 | 238 | PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, a8r8g8b8, a8r8g8b8, armv6_8888_8888), |
michael@0 | 239 | PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, armv6_8888_8888), |
michael@0 | 240 | PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, armv6_8888_8888), |
michael@0 | 241 | PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, a8b8g8r8, a8b8g8r8, armv6_8888_8888), |
michael@0 | 242 | PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, a8b8g8r8, x8b8g8r8, armv6_8888_8888), |
michael@0 | 243 | PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, x8b8g8r8, x8b8g8r8, armv6_8888_8888), |
michael@0 | 244 | |
michael@0 | 245 | { PIXMAN_OP_NONE }, |
michael@0 | 246 | }; |
michael@0 | 247 | |
michael@0 | 248 | pixman_implementation_t * |
michael@0 | 249 | _pixman_implementation_create_arm_simd (pixman_implementation_t *fallback) |
michael@0 | 250 | { |
michael@0 | 251 | pixman_implementation_t *imp = _pixman_implementation_create (fallback, arm_simd_fast_paths); |
michael@0 | 252 | |
michael@0 | 253 | imp->blt = arm_simd_blt; |
michael@0 | 254 | imp->fill = arm_simd_fill; |
michael@0 | 255 | |
michael@0 | 256 | return imp; |
michael@0 | 257 | } |