gfx/cairo/libpixman/src/pixman-mips-dspr2.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (c) 2012
michael@0 3 * MIPS Technologies, Inc., California.
michael@0 4 *
michael@0 5 * Redistribution and use in source and binary forms, with or without
michael@0 6 * modification, are permitted provided that the following conditions
michael@0 7 * are met:
michael@0 8 * 1. Redistributions of source code must retain the above copyright
michael@0 9 * notice, this list of conditions and the following disclaimer.
michael@0 10 * 2. Redistributions in binary form must reproduce the above copyright
michael@0 11 * notice, this list of conditions and the following disclaimer in the
michael@0 12 * documentation and/or other materials provided with the distribution.
michael@0 13 * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
michael@0 14 * contributors may be used to endorse or promote products derived from
michael@0 15 * this software without specific prior written permission.
michael@0 16 *
michael@0 17 * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
michael@0 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
michael@0 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
michael@0 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
michael@0 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
michael@0 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
michael@0 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
michael@0 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
michael@0 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
michael@0 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@0 27 * SUCH DAMAGE.
michael@0 28 *
michael@0 29 * Author: Nemanja Lukic (nlukic@mips.com)
michael@0 30 */
michael@0 31
michael@0 32 #ifndef PIXMAN_MIPS_DSPR2_H
michael@0 33 #define PIXMAN_MIPS_DSPR2_H
michael@0 34
michael@0 35 #include "pixman-private.h"
michael@0 36 #include "pixman-inlines.h"
michael@0 37
michael@0 38 #define SKIP_ZERO_SRC 1
michael@0 39 #define SKIP_ZERO_MASK 2
michael@0 40 #define DO_FAST_MEMCPY 3
michael@0 41
michael@0 42 void
michael@0 43 pixman_mips_fast_memcpy (void *dst, void *src, uint32_t n_bytes);
michael@0 44 void
michael@0 45 pixman_fill_buff16_mips (void *dst, uint32_t n_bytes, uint16_t value);
michael@0 46 void
michael@0 47 pixman_fill_buff32_mips (void *dst, uint32_t n_bytes, uint32_t value);
michael@0 48
michael@0 49 /****************************************************************/
michael@0 50
michael@0 51 #define PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST(flags, name, \
michael@0 52 src_type, src_cnt, \
michael@0 53 dst_type, dst_cnt) \
michael@0 54 void \
michael@0 55 pixman_composite_##name##_asm_mips (dst_type *dst, \
michael@0 56 src_type *src, \
michael@0 57 int32_t w); \
michael@0 58 \
michael@0 59 static void \
michael@0 60 mips_composite_##name (pixman_implementation_t *imp, \
michael@0 61 pixman_composite_info_t *info) \
michael@0 62 { \
michael@0 63 PIXMAN_COMPOSITE_ARGS (info); \
michael@0 64 dst_type *dst_line, *dst; \
michael@0 65 src_type *src_line, *src; \
michael@0 66 int32_t dst_stride, src_stride; \
michael@0 67 int bpp = PIXMAN_FORMAT_BPP (dest_image->bits.format) / 8; \
michael@0 68 \
michael@0 69 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \
michael@0 70 src_stride, src_line, src_cnt); \
michael@0 71 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
michael@0 72 dst_stride, dst_line, dst_cnt); \
michael@0 73 \
michael@0 74 while (height--) \
michael@0 75 { \
michael@0 76 dst = dst_line; \
michael@0 77 dst_line += dst_stride; \
michael@0 78 src = src_line; \
michael@0 79 src_line += src_stride; \
michael@0 80 \
michael@0 81 if (flags == DO_FAST_MEMCPY) \
michael@0 82 pixman_mips_fast_memcpy (dst, src, width * bpp); \
michael@0 83 else \
michael@0 84 pixman_composite_##name##_asm_mips (dst, src, width); \
michael@0 85 } \
michael@0 86 }
michael@0 87
michael@0 88 /****************************************************************/
michael@0 89
michael@0 90 #define PIXMAN_MIPS_BIND_FAST_PATH_N_DST(flags, name, \
michael@0 91 dst_type, dst_cnt) \
michael@0 92 void \
michael@0 93 pixman_composite_##name##_asm_mips (dst_type *dst, \
michael@0 94 uint32_t src, \
michael@0 95 int32_t w); \
michael@0 96 \
michael@0 97 static void \
michael@0 98 mips_composite_##name (pixman_implementation_t *imp, \
michael@0 99 pixman_composite_info_t *info) \
michael@0 100 { \
michael@0 101 PIXMAN_COMPOSITE_ARGS (info); \
michael@0 102 dst_type *dst_line, *dst; \
michael@0 103 int32_t dst_stride; \
michael@0 104 uint32_t src; \
michael@0 105 \
michael@0 106 src = _pixman_image_get_solid ( \
michael@0 107 imp, src_image, dest_image->bits.format); \
michael@0 108 \
michael@0 109 if ((flags & SKIP_ZERO_SRC) && src == 0) \
michael@0 110 return; \
michael@0 111 \
michael@0 112 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
michael@0 113 dst_stride, dst_line, dst_cnt); \
michael@0 114 \
michael@0 115 while (height--) \
michael@0 116 { \
michael@0 117 dst = dst_line; \
michael@0 118 dst_line += dst_stride; \
michael@0 119 \
michael@0 120 pixman_composite_##name##_asm_mips (dst, src, width); \
michael@0 121 } \
michael@0 122 }
michael@0 123
michael@0 124 /*******************************************************************/
michael@0 125
michael@0 126 #define PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST(flags, name, \
michael@0 127 mask_type, mask_cnt, \
michael@0 128 dst_type, dst_cnt) \
michael@0 129 void \
michael@0 130 pixman_composite_##name##_asm_mips (dst_type *dst, \
michael@0 131 uint32_t src, \
michael@0 132 mask_type *mask, \
michael@0 133 int32_t w); \
michael@0 134 \
michael@0 135 static void \
michael@0 136 mips_composite_##name (pixman_implementation_t *imp, \
michael@0 137 pixman_composite_info_t *info) \
michael@0 138 { \
michael@0 139 PIXMAN_COMPOSITE_ARGS (info); \
michael@0 140 dst_type *dst_line, *dst; \
michael@0 141 mask_type *mask_line, *mask; \
michael@0 142 int32_t dst_stride, mask_stride; \
michael@0 143 uint32_t src; \
michael@0 144 \
michael@0 145 src = _pixman_image_get_solid ( \
michael@0 146 imp, src_image, dest_image->bits.format); \
michael@0 147 \
michael@0 148 if ((flags & SKIP_ZERO_SRC) && src == 0) \
michael@0 149 return; \
michael@0 150 \
michael@0 151 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
michael@0 152 dst_stride, dst_line, dst_cnt); \
michael@0 153 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type, \
michael@0 154 mask_stride, mask_line, mask_cnt); \
michael@0 155 \
michael@0 156 while (height--) \
michael@0 157 { \
michael@0 158 dst = dst_line; \
michael@0 159 dst_line += dst_stride; \
michael@0 160 mask = mask_line; \
michael@0 161 mask_line += mask_stride; \
michael@0 162 pixman_composite_##name##_asm_mips (dst, src, mask, width); \
michael@0 163 } \
michael@0 164 }
michael@0 165
michael@0 166 /*******************************************************************/
michael@0 167
michael@0 168 #define PIXMAN_MIPS_BIND_FAST_PATH_SRC_N_DST(flags, name, \
michael@0 169 src_type, src_cnt, \
michael@0 170 dst_type, dst_cnt) \
michael@0 171 void \
michael@0 172 pixman_composite_##name##_asm_mips (dst_type *dst, \
michael@0 173 src_type *src, \
michael@0 174 uint32_t mask, \
michael@0 175 int32_t w); \
michael@0 176 \
michael@0 177 static void \
michael@0 178 mips_composite_##name (pixman_implementation_t *imp, \
michael@0 179 pixman_composite_info_t *info) \
michael@0 180 { \
michael@0 181 PIXMAN_COMPOSITE_ARGS (info); \
michael@0 182 dst_type *dst_line, *dst; \
michael@0 183 src_type *src_line, *src; \
michael@0 184 int32_t dst_stride, src_stride; \
michael@0 185 uint32_t mask; \
michael@0 186 \
michael@0 187 mask = _pixman_image_get_solid ( \
michael@0 188 imp, mask_image, dest_image->bits.format); \
michael@0 189 \
michael@0 190 if ((flags & SKIP_ZERO_MASK) && mask == 0) \
michael@0 191 return; \
michael@0 192 \
michael@0 193 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
michael@0 194 dst_stride, dst_line, dst_cnt); \
michael@0 195 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \
michael@0 196 src_stride, src_line, src_cnt); \
michael@0 197 \
michael@0 198 while (height--) \
michael@0 199 { \
michael@0 200 dst = dst_line; \
michael@0 201 dst_line += dst_stride; \
michael@0 202 src = src_line; \
michael@0 203 src_line += src_stride; \
michael@0 204 \
michael@0 205 pixman_composite_##name##_asm_mips (dst, src, mask, width); \
michael@0 206 } \
michael@0 207 }
michael@0 208
michael@0 209 /************************************************************************/
michael@0 210
michael@0 211 #define PIXMAN_MIPS_BIND_FAST_PATH_SRC_MASK_DST(name, src_type, src_cnt, \
michael@0 212 mask_type, mask_cnt, \
michael@0 213 dst_type, dst_cnt) \
michael@0 214 void \
michael@0 215 pixman_composite_##name##_asm_mips (dst_type *dst, \
michael@0 216 src_type *src, \
michael@0 217 mask_type *mask, \
michael@0 218 int32_t w); \
michael@0 219 \
michael@0 220 static void \
michael@0 221 mips_composite_##name (pixman_implementation_t *imp, \
michael@0 222 pixman_composite_info_t *info) \
michael@0 223 { \
michael@0 224 PIXMAN_COMPOSITE_ARGS (info); \
michael@0 225 dst_type *dst_line, *dst; \
michael@0 226 src_type *src_line, *src; \
michael@0 227 mask_type *mask_line, *mask; \
michael@0 228 int32_t dst_stride, src_stride, mask_stride; \
michael@0 229 \
michael@0 230 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
michael@0 231 dst_stride, dst_line, dst_cnt); \
michael@0 232 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \
michael@0 233 src_stride, src_line, src_cnt); \
michael@0 234 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type, \
michael@0 235 mask_stride, mask_line, mask_cnt); \
michael@0 236 \
michael@0 237 while (height--) \
michael@0 238 { \
michael@0 239 dst = dst_line; \
michael@0 240 dst_line += dst_stride; \
michael@0 241 mask = mask_line; \
michael@0 242 mask_line += mask_stride; \
michael@0 243 src = src_line; \
michael@0 244 src_line += src_stride; \
michael@0 245 pixman_composite_##name##_asm_mips (dst, src, mask, width); \
michael@0 246 } \
michael@0 247 }
michael@0 248
michael@0 249 /*****************************************************************************/
michael@0 250
michael@0 251 #define PIXMAN_MIPS_BIND_SCALED_NEAREST_SRC_A8_DST(flags, name, op, \
michael@0 252 src_type, dst_type) \
michael@0 253 void \
michael@0 254 pixman_scaled_nearest_scanline_##name##_##op##_asm_mips ( \
michael@0 255 dst_type * dst, \
michael@0 256 const src_type * src, \
michael@0 257 const uint8_t * mask, \
michael@0 258 int32_t w, \
michael@0 259 pixman_fixed_t vx, \
michael@0 260 pixman_fixed_t unit_x); \
michael@0 261 \
michael@0 262 static force_inline void \
michael@0 263 scaled_nearest_scanline_mips_##name##_##op (const uint8_t * mask, \
michael@0 264 dst_type * pd, \
michael@0 265 const src_type * ps, \
michael@0 266 int32_t w, \
michael@0 267 pixman_fixed_t vx, \
michael@0 268 pixman_fixed_t unit_x, \
michael@0 269 pixman_fixed_t max_vx, \
michael@0 270 pixman_bool_t zero_src) \
michael@0 271 { \
michael@0 272 if ((flags & SKIP_ZERO_SRC) && zero_src) \
michael@0 273 return; \
michael@0 274 pixman_scaled_nearest_scanline_##name##_##op##_asm_mips (pd, ps, \
michael@0 275 mask, w, \
michael@0 276 vx, unit_x); \
michael@0 277 } \
michael@0 278 \
michael@0 279 FAST_NEAREST_MAINLOOP_COMMON (mips_##name##_cover_##op, \
michael@0 280 scaled_nearest_scanline_mips_##name##_##op, \
michael@0 281 src_type, uint8_t, dst_type, COVER, TRUE, FALSE)\
michael@0 282 FAST_NEAREST_MAINLOOP_COMMON (mips_##name##_none_##op, \
michael@0 283 scaled_nearest_scanline_mips_##name##_##op, \
michael@0 284 src_type, uint8_t, dst_type, NONE, TRUE, FALSE) \
michael@0 285 FAST_NEAREST_MAINLOOP_COMMON (mips_##name##_pad_##op, \
michael@0 286 scaled_nearest_scanline_mips_##name##_##op, \
michael@0 287 src_type, uint8_t, dst_type, PAD, TRUE, FALSE)
michael@0 288
michael@0 289 /* Provide entries for the fast path table */
michael@0 290 #define PIXMAN_MIPS_SIMPLE_NEAREST_A8_MASK_FAST_PATH(op,s,d,func) \
michael@0 291 SIMPLE_NEAREST_A8_MASK_FAST_PATH_COVER (op,s,d,func), \
michael@0 292 SIMPLE_NEAREST_A8_MASK_FAST_PATH_NONE (op,s,d,func), \
michael@0 293 SIMPLE_NEAREST_A8_MASK_FAST_PATH_PAD (op,s,d,func)
michael@0 294
michael@0 295 /****************************************************************************/
michael@0 296
michael@0 297 #define PIXMAN_MIPS_BIND_SCALED_BILINEAR_SRC_DST(flags, name, op, \
michael@0 298 src_type, dst_type) \
michael@0 299 void \
michael@0 300 pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips( \
michael@0 301 dst_type * dst, \
michael@0 302 const src_type * src_top, \
michael@0 303 const src_type * src_bottom, \
michael@0 304 int32_t w, \
michael@0 305 int wt, \
michael@0 306 int wb, \
michael@0 307 pixman_fixed_t vx, \
michael@0 308 pixman_fixed_t unit_x); \
michael@0 309 static force_inline void \
michael@0 310 scaled_bilinear_scanline_mips_##name##_##op (dst_type * dst, \
michael@0 311 const uint32_t * mask, \
michael@0 312 const src_type * src_top, \
michael@0 313 const src_type * src_bottom, \
michael@0 314 int32_t w, \
michael@0 315 int wt, \
michael@0 316 int wb, \
michael@0 317 pixman_fixed_t vx, \
michael@0 318 pixman_fixed_t unit_x, \
michael@0 319 pixman_fixed_t max_vx, \
michael@0 320 pixman_bool_t zero_src) \
michael@0 321 { \
michael@0 322 if ((flags & SKIP_ZERO_SRC) && zero_src) \
michael@0 323 return; \
michael@0 324 pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips (dst, src_top, \
michael@0 325 src_bottom, w, \
michael@0 326 wt, wb, \
michael@0 327 vx, unit_x); \
michael@0 328 } \
michael@0 329 \
michael@0 330 FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_cover_##op, \
michael@0 331 scaled_bilinear_scanline_mips_##name##_##op, \
michael@0 332 src_type, uint32_t, dst_type, COVER, FLAG_NONE) \
michael@0 333 FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_none_##op, \
michael@0 334 scaled_bilinear_scanline_mips_##name##_##op, \
michael@0 335 src_type, uint32_t, dst_type, NONE, FLAG_NONE) \
michael@0 336 FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_pad_##op, \
michael@0 337 scaled_bilinear_scanline_mips_##name##_##op, \
michael@0 338 src_type, uint32_t, dst_type, PAD, FLAG_NONE) \
michael@0 339 FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_normal_##op, \
michael@0 340 scaled_bilinear_scanline_mips_##name##_##op, \
michael@0 341 src_type, uint32_t, dst_type, NORMAL, \
michael@0 342 FLAG_NONE)
michael@0 343
michael@0 344 /*****************************************************************************/
michael@0 345
michael@0 346 #define PIXMAN_MIPS_BIND_SCALED_BILINEAR_SRC_A8_DST(flags, name, op, \
michael@0 347 src_type, dst_type) \
michael@0 348 void \
michael@0 349 pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips ( \
michael@0 350 dst_type * dst, \
michael@0 351 const uint8_t * mask, \
michael@0 352 const src_type * top, \
michael@0 353 const src_type * bottom, \
michael@0 354 int wt, \
michael@0 355 int wb, \
michael@0 356 pixman_fixed_t x, \
michael@0 357 pixman_fixed_t ux, \
michael@0 358 int width); \
michael@0 359 \
michael@0 360 static force_inline void \
michael@0 361 scaled_bilinear_scanline_mips_##name##_##op (dst_type * dst, \
michael@0 362 const uint8_t * mask, \
michael@0 363 const src_type * src_top, \
michael@0 364 const src_type * src_bottom, \
michael@0 365 int32_t w, \
michael@0 366 int wt, \
michael@0 367 int wb, \
michael@0 368 pixman_fixed_t vx, \
michael@0 369 pixman_fixed_t unit_x, \
michael@0 370 pixman_fixed_t max_vx, \
michael@0 371 pixman_bool_t zero_src) \
michael@0 372 { \
michael@0 373 if ((flags & SKIP_ZERO_SRC) && zero_src) \
michael@0 374 return; \
michael@0 375 pixman_scaled_bilinear_scanline_##name##_##op##_asm_mips ( \
michael@0 376 dst, mask, src_top, src_bottom, wt, wb, vx, unit_x, w); \
michael@0 377 } \
michael@0 378 \
michael@0 379 FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_cover_##op, \
michael@0 380 scaled_bilinear_scanline_mips_##name##_##op, \
michael@0 381 src_type, uint8_t, dst_type, COVER, \
michael@0 382 FLAG_HAVE_NON_SOLID_MASK) \
michael@0 383 FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_none_##op, \
michael@0 384 scaled_bilinear_scanline_mips_##name##_##op, \
michael@0 385 src_type, uint8_t, dst_type, NONE, \
michael@0 386 FLAG_HAVE_NON_SOLID_MASK) \
michael@0 387 FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_pad_##op, \
michael@0 388 scaled_bilinear_scanline_mips_##name##_##op, \
michael@0 389 src_type, uint8_t, dst_type, PAD, \
michael@0 390 FLAG_HAVE_NON_SOLID_MASK) \
michael@0 391 FAST_BILINEAR_MAINLOOP_COMMON (mips_##name##_normal_##op, \
michael@0 392 scaled_bilinear_scanline_mips_##name##_##op, \
michael@0 393 src_type, uint8_t, dst_type, NORMAL, \
michael@0 394 FLAG_HAVE_NON_SOLID_MASK)
michael@0 395
michael@0 396 #endif //PIXMAN_MIPS_DSPR2_H

mercurial