1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/cairo/libpixman/src/pixman-mips-dspr2.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,396 @@ 1.4 +/* 1.5 + * Copyright (c) 2012 1.6 + * MIPS Technologies, Inc., California. 1.7 + * 1.8 + * Redistribution and use in source and binary forms, with or without 1.9 + * modification, are permitted provided that the following conditions 1.10 + * are met: 1.11 + * 1. Redistributions of source code must retain the above copyright 1.12 + * notice, this list of conditions and the following disclaimer. 1.13 + * 2. Redistributions in binary form must reproduce the above copyright 1.14 + * notice, this list of conditions and the following disclaimer in the 1.15 + * documentation and/or other materials provided with the distribution. 1.16 + * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its 1.17 + * contributors may be used to endorse or promote products derived from 1.18 + * this software without specific prior written permission. 1.19 + * 1.20 + * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND 1.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE 1.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.30 + * SUCH DAMAGE. 1.31 + * 1.32 + * Author: Nemanja Lukic (nlukic@mips.com) 1.33 + */ 1.34 + 1.35 +#ifndef PIXMAN_MIPS_DSPR2_H 1.36 +#define PIXMAN_MIPS_DSPR2_H 1.37 + 1.38 +#include "pixman-private.h" 1.39 +#include "pixman-inlines.h" 1.40 + 1.41 +#define SKIP_ZERO_SRC 1 1.42 +#define SKIP_ZERO_MASK 2 1.43 +#define DO_FAST_MEMCPY 3 1.44 + 1.45 +void 1.46 +pixman_mips_fast_memcpy (void *dst, void *src, uint32_t n_bytes); 1.47 +void 1.48 +pixman_fill_buff16_mips (void *dst, uint32_t n_bytes, uint16_t value); 1.49 +void 1.50 +pixman_fill_buff32_mips (void *dst, uint32_t n_bytes, uint32_t value); 1.51 + 1.52 +/****************************************************************/ 1.53 + 1.54 +#define PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST(flags, name, \ 1.55 + src_type, src_cnt, \ 1.56 + dst_type, dst_cnt) \ 1.57 +void \ 1.58 +pixman_composite_##name##_asm_mips (dst_type *dst, \ 1.59 + src_type *src, \ 1.60 + int32_t w); \ 1.61 + \ 1.62 +static void \ 1.63 +mips_composite_##name (pixman_implementation_t *imp, \ 1.64 + pixman_composite_info_t *info) \ 1.65 +{ \ 1.66 + PIXMAN_COMPOSITE_ARGS (info); \ 1.67 + dst_type *dst_line, *dst; \ 1.68 + src_type *src_line, *src; \ 1.69 + int32_t dst_stride, src_stride; \ 1.70 + int bpp = PIXMAN_FORMAT_BPP (dest_image->bits.format) / 8; \ 1.71 + \ 1.72 + PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \ 1.73 + src_stride, src_line, src_cnt); \ 1.74 + PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \ 1.75 + dst_stride, dst_line, dst_cnt); \ 1.76 + \ 1.77 + while (height--) \ 1.78 + { \ 1.79 + dst = dst_line; \ 1.80 + dst_line += dst_stride; \ 1.81 + src = src_line; \ 1.82 + src_line += src_stride; \ 1.83 + \ 1.84 + if (flags == DO_FAST_MEMCPY) \ 1.85 + pixman_mips_fast_memcpy (dst, src, width * bpp); \ 1.86 + else \ 1.87 + pixman_composite_##name##_asm_mips (dst, src, width); \ 1.88 + } \ 1.89 +} 1.90 + 1.91 +/****************************************************************/ 1.92 + 1.93 +#define PIXMAN_MIPS_BIND_FAST_PATH_N_DST(flags, name, \ 1.94 + dst_type, dst_cnt) \ 1.95 +void \ 1.96 +pixman_composite_##name##_asm_mips (dst_type *dst, \ 1.97 + uint32_t src, \ 1.98 + int32_t w); \ 1.99 + \ 1.100 +static void \ 1.101 +mips_composite_##name (pixman_implementation_t *imp, \ 1.102 + pixman_composite_info_t *info) \ 1.103 +{ \ 1.104 + PIXMAN_COMPOSITE_ARGS (info); \ 1.105 + dst_type *dst_line, *dst; \ 1.106 + int32_t dst_stride; \ 1.107 + uint32_t src; \ 1.108 + \ 1.109 + src = _pixman_image_get_solid ( \ 1.110 + imp, src_image, dest_image->bits.format); \ 1.111 + \ 1.112 + if ((flags & SKIP_ZERO_SRC) && src == 0) \ 1.113 + return; \ 1.114 + \ 1.115 + PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \ 1.116 + dst_stride, dst_line, dst_cnt); \ 1.117 + \ 1.118 + while (height--) \ 1.119 + { \ 1.120 + dst = dst_line; \ 1.121 + dst_line += dst_stride; \ 1.122 + \ 1.123 + pixman_composite_##name##_asm_mips (dst, src, width); \ 1.124 + } \ 1.125 +} 1.126 + 1.127 +/*******************************************************************/ 1.128 + 1.129 +#define PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST(flags, name, \ 1.130 + mask_type, mask_cnt, \ 1.131 + dst_type, dst_cnt) \ 1.132 +void \ 1.133 +pixman_composite_##name##_asm_mips (dst_type *dst, \ 1.134 + uint32_t src, \ 1.135 + mask_type *mask, \ 1.136 + int32_t w); \ 1.137 + \ 1.138 +static void \ 1.139 +mips_composite_##name (pixman_implementation_t *imp, \ 1.140 + pixman_composite_info_t *info) \ 1.141 +{ \ 1.142 + PIXMAN_COMPOSITE_ARGS (info); \ 1.143 + dst_type *dst_line, *dst; \ 1.144 + mask_type *mask_line, *mask; \ 1.145 + int32_t dst_stride, mask_stride; \ 1.146 + uint32_t src; \ 1.147 + \ 1.148 + src = _pixman_image_get_solid ( \ 1.149 + imp, src_image, dest_image->bits.format); \ 1.150 + \ 1.151 + if ((flags & SKIP_ZERO_SRC) && src == 0) \ 1.152 + return; \ 1.153 + \ 1.154 + PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \ 1.155 + dst_stride, dst_line, dst_cnt); \ 1.156 + PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type, \ 1.157 + mask_stride, mask_line, mask_cnt); \ 1.158 + \ 1.159 + while (height--) \ 1.160 + { \ 1.161 + dst = dst_line; \ 1.162 + dst_line += dst_stride; \ 1.163 + mask = mask_line; \ 1.164 + mask_line += mask_stride; \ 1.165 + pixman_composite_##name##_asm_mips (dst, src, mask, width); \ 1.166 + } \ 1.167 +} 1.168 + 1.169 +/*******************************************************************/ 1.170 + 1.171 +#define PIXMAN_MIPS_BIND_FAST_PATH_SRC_N_DST(flags, name, \ 1.172 + src_type, src_cnt, \ 1.173 + dst_type, dst_cnt) \ 1.174 +void \ 1.175 +pixman_composite_##name##_asm_mips (dst_type *dst, \ 1.176 + src_type *src, \ 1.177 + uint32_t mask, \ 1.178 + int32_t w); \ 1.179 + \ 1.180 +static void \ 1.181 +mips_composite_##name (pixman_implementation_t *imp, \ 1.182 + pixman_composite_info_t *info) \ 1.183 +{ \ 1.184 + PIXMAN_COMPOSITE_ARGS (info); \ 1.185 + dst_type *dst_line, *dst; \ 1.186 + src_type *src_line, *src; \ 1.187 + int32_t dst_stride, src_stride; \ 1.188 + uint32_t mask; \ 1.189 + \ 1.190 + mask = _pixman_image_get_solid ( \ 1.191 + imp, mask_image, dest_image->bits.format); \ 1.192 + \ 1.193 + if ((flags & SKIP_ZERO_MASK) && mask == 0) \ 1.194 + return; \ 1.195 + \ 1.196 + PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \ 1.197 + dst_stride, dst_line, dst_cnt); \ 1.198 + PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \ 1.199 + src_stride, src_line, src_cnt); \ 1.200 + \ 1.201 + while (height--) \ 1.202 + { \ 1.203 + dst = dst_line; \ 1.204 + dst_line += dst_stride; \ 1.205 + src = src_line; \ 1.206 + src_line += src_stride; \ 1.207 + \ 1.208 + pixman_composite_##name##_asm_mips (dst, src, mask, width); \ 1.209 + } \ 1.210 +} 1.211 + 1.212 +/************************************************************************/ 1.213 + 1.214 +#define PIXMAN_MIPS_BIND_FAST_PATH_SRC_MASK_DST(name, src_type, src_cnt, \ 1.215 + mask_type, mask_cnt, \ 1.216 + dst_type, dst_cnt) \ 1.217 +void \ 1.218 +pixman_composite_##name##_asm_mips (dst_type *dst, \ 1.219 + src_type *src, \ 1.220 + mask_type *mask, \ 1.221 + int32_t w); \ 1.222 + \ 1.223 +static void \ 1.224 +mips_composite_##name (pixman_implementation_t *imp, \ 1.225 + pixman_composite_info_t *info) \ 1.226 +{ \ 1.227 + PIXMAN_COMPOSITE_ARGS (info); \ 1.228 + dst_type *dst_line, *dst; \ 1.229 + src_type *src_line, *src; \ 1.230 + mask_type *mask_line, *mask; \ 1.231 + int32_t dst_stride, src_stride, mask_stride; \ 1.232 + \ 1.233 + PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \ 1.234 + dst_stride, dst_line, dst_cnt); \ 1.235 + PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \ 1.236 + src_stride, src_line, src_cnt); \ 1.237 + PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type, \ 1.238 + mask_stride, mask_line, mask_cnt); \ 1.239 + \ 1.240 + while (height--) \ 1.241 + { \ 1.242 + dst = dst_line; \ 1.243 + dst_line += dst_stride; \ 1.244 + mask = mask_line; \ 1.245 + mask_line += mask_stride; \ 1.246 + src = src_line; \ 1.247 + src_line += src_stride; \ 1.248 + pixman_composite_##name##_asm_mips (dst, src, mask, width); \ 1.249 + } \ 1.250 +} 1.251 + 1.252 +/*****************************************************************************/ 1.253 + 1.254 +#define PIXMAN_MIPS_BIND_SCALED_NEAREST_SRC_A8_DST(flags, name, op, \ 1.255 + src_type, dst_type) \ 1.256 +void \ 1.257 +pixman_scaled_nearest_scanline_##name##_##op##_asm_mips ( \ 1.258 + dst_type * dst, \ 1.259 + const src_type * src, \ 1.260 + const uint8_t * mask, \ 1.261 + int32_t w, \ 1.262 + pixman_fixed_t vx, \ 1.263 + pixman_fixed_t unit_x); \ 1.264 + \ 1.265 +static force_inline void \ 1.266 +scaled_nearest_scanline_mips_##name##_##op (const uint8_t * mask, \ 1.267 + dst_type * pd, \ 1.268 + const src_type * ps, \ 1.269 + int32_t w, \ 1.270 + pixman_fixed_t vx, \ 1.271 + pixman_fixed_t unit_x, \ 1.272 + pixman_fixed_t max_vx, \ 1.273 + pixman_bool_t zero_src) \ 1.274 +{ \ 1.275 + if ((flags & SKIP_ZERO_SRC) && zero_src) \ 1.276 + return; \ 1.277 + pixman_scaled_nearest_scanline_##name##_##op##_asm_mips (pd, ps, \ 1.278 + mask, w, \ 1.279 + vx, unit_x); \ 1.280 +} \ 1.281 + \ 1.282 +FAST_NEAREST_MAINLOOP_COMMON (mips_##name##_cover_##op, \ 1.283 + scaled_nearest_scanline_mips_##name##_##op, \ 1.284 + src_type, uint8_t, dst_type, COVER, TRUE, FALSE)\ 1.285 +FAST_NEAREST_MAINLOOP_COMMON (mips_##name##_none_##op, \ 1.286 + scaled_nearest_scanline_mips_##name##_##op, \ 1.287 + src_type, uint8_t, dst_type, NONE, TRUE, FALSE) \ 1.288 +FAST_NEAREST_MAINLOOP_COMMON (mips_##name##_pad_##op, \ 1.289 + scaled_nearest_scanline_mips_##name##_##op, \ 1.290 + src_type, uint8_t, dst_type, PAD, TRUE, FALSE) 1.291 + 1.292 +/* Provide entries for the fast path table */ 1.293 +#define PIXMAN_MIPS_SIMPLE_NEAREST_A8_MASK_FAST_PATH(op,s,d,func) \ 1.294 + SIMPLE_NEAREST_A8_MASK_FAST_PATH_COVER (op,s,d,func), \ 1.295 + SIMPLE_NEAREST_A8_MASK_FAST_PATH_NONE (op,s,d,func), \ 1.296 + SIMPLE_NEAREST_A8_MASK_FAST_PATH_PAD (op,s,d,func) 1.297 + 1.298 +/****************************************************************************/ 1.299 + 1.300 +#define PIXMAN_MIPS_BIND_SCALED_BILINEAR_SRC_DST(flags, name, op, \ 1.301 + src_type, dst_type) \ 1.302 +void \ 1.303 +pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips( \ 1.304 + dst_type * dst, \ 1.305 + const src_type * src_top, \ 1.306 + const src_type * src_bottom, \ 1.307 + int32_t w, \ 1.308 + int wt, \ 1.309 + int wb, \ 1.310 + pixman_fixed_t vx, \ 1.311 + pixman_fixed_t unit_x); \ 1.312 +static force_inline void \ 1.313 +scaled_bilinear_scanline_mips_##name##_##op (dst_type * dst, \ 1.314 + const uint32_t * mask, \ 1.315 + const src_type * src_top, \ 1.316 + const src_type * src_bottom, \ 1.317 + int32_t w, \ 1.318 + int wt, \ 1.319 + int wb, \ 1.320 + pixman_fixed_t vx, \ 1.321 + pixman_fixed_t unit_x, \ 1.322 + pixman_fixed_t max_vx, \ 1.323 + pixman_bool_t zero_src) \ 1.324 +{ \ 1.325 + if ((flags & SKIP_ZERO_SRC) && zero_src) \ 1.326 + return; \ 1.327 + pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips (dst, src_top, \ 1.328 + src_bottom, w, \ 1.329 + wt, wb, \ 1.330 + vx, unit_x); \ 1.331 +} \ 1.332 + \ 1.333 +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_cover_##op, \ 1.334 + scaled_bilinear_scanline_mips_##name##_##op, \ 1.335 + src_type, uint32_t, dst_type, COVER, FLAG_NONE) \ 1.336 +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_none_##op, \ 1.337 + scaled_bilinear_scanline_mips_##name##_##op, \ 1.338 + src_type, uint32_t, dst_type, NONE, FLAG_NONE) \ 1.339 +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_pad_##op, \ 1.340 + scaled_bilinear_scanline_mips_##name##_##op, \ 1.341 + src_type, uint32_t, dst_type, PAD, FLAG_NONE) \ 1.342 +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_normal_##op, \ 1.343 + scaled_bilinear_scanline_mips_##name##_##op, \ 1.344 + src_type, uint32_t, dst_type, NORMAL, \ 1.345 + FLAG_NONE) 1.346 + 1.347 +/*****************************************************************************/ 1.348 + 1.349 +#define PIXMAN_MIPS_BIND_SCALED_BILINEAR_SRC_A8_DST(flags, name, op, \ 1.350 + src_type, dst_type) \ 1.351 +void \ 1.352 +pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips ( \ 1.353 + dst_type * dst, \ 1.354 + const uint8_t * mask, \ 1.355 + const src_type * top, \ 1.356 + const src_type * bottom, \ 1.357 + int wt, \ 1.358 + int wb, \ 1.359 + pixman_fixed_t x, \ 1.360 + pixman_fixed_t ux, \ 1.361 + int width); \ 1.362 + \ 1.363 +static force_inline void \ 1.364 +scaled_bilinear_scanline_mips_##name##_##op (dst_type * dst, \ 1.365 + const uint8_t * mask, \ 1.366 + const src_type * src_top, \ 1.367 + const src_type * src_bottom, \ 1.368 + int32_t w, \ 1.369 + int wt, \ 1.370 + int wb, \ 1.371 + pixman_fixed_t vx, \ 1.372 + pixman_fixed_t unit_x, \ 1.373 + pixman_fixed_t max_vx, \ 1.374 + pixman_bool_t zero_src) \ 1.375 +{ \ 1.376 + if ((flags & SKIP_ZERO_SRC) && zero_src) \ 1.377 + return; \ 1.378 + pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips ( \ 1.379 + dst, mask, src_top, src_bottom, wt, wb, vx, unit_x, w); \ 1.380 +} \ 1.381 + \ 1.382 +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_cover_##op, \ 1.383 + scaled_bilinear_scanline_mips_##name##_##op, \ 1.384 + src_type, uint8_t, dst_type, COVER, \ 1.385 + FLAG_HAVE_NON_SOLID_MASK) \ 1.386 +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_none_##op, \ 1.387 + scaled_bilinear_scanline_mips_##name##_##op, \ 1.388 + src_type, uint8_t, dst_type, NONE, \ 1.389 + FLAG_HAVE_NON_SOLID_MASK) \ 1.390 +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_pad_##op, \ 1.391 + scaled_bilinear_scanline_mips_##name##_##op, \ 1.392 + src_type, uint8_t, dst_type, PAD, \ 1.393 + FLAG_HAVE_NON_SOLID_MASK) \ 1.394 +FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_normal_##op, \ 1.395 + scaled_bilinear_scanline_mips_##name##_##op, \ 1.396 + src_type, uint8_t, dst_type, NORMAL, \ 1.397 + FLAG_HAVE_NON_SOLID_MASK) 1.398 + 1.399 +#endif //PIXMAN_MIPS_DSPR2_H