w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

pixman-arm-common.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2010 Nokia Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  *
23  * Author: Siarhei Siamashka (siarhei.siamashka@nokia.com)
24  */
25 
26 #ifndef PIXMAN_ARM_COMMON_H
27 #define PIXMAN_ARM_COMMON_H
28 
29 #include "pixman-inlines.h"
30 
31 /* Define some macros which can expand into proxy functions between
32  * ARM assembly optimized functions and the rest of pixman fast path API.
33  *
34  * All the low level ARM assembly functions have to use ARM EABI
35  * calling convention and take up to 8 arguments:
36  * width, height, dst, dst_stride, src, src_stride, mask, mask_stride
37  *
38  * The arguments are ordered with the most important coming first (the
39  * first 4 arguments are passed to function in registers, the rest are
40  * on stack). The last arguments are optional, for example if the
41  * function is not using mask, then 'mask' and 'mask_stride' can be
42  * omitted when doing a function call.
43  *
44  * Arguments 'src' and 'mask' contain either a pointer to the top left
45  * pixel of the composited rectangle or a pixel color value depending
46  * on the function type. In the case of just a color value (solid source
47  * or mask), the corresponding stride argument is unused.
48  */
49 
50 #define SKIP_ZERO_SRC 1
51 #define SKIP_ZERO_MASK 2
52 
53 #define PIXMAN_ARM_BIND_FAST_PATH_SRC_DST(cputype, name, \
54  src_type, src_cnt, \
55  dst_type, dst_cnt) \
56 void \
57 pixman_composite_##name##_asm_##cputype (int32_t w, \
58  int32_t h, \
59  dst_type *dst, \
60  int32_t dst_stride, \
61  src_type *src, \
62  int32_t src_stride); \
63  \
64 static void \
65 cputype##_composite_##name (pixman_implementation_t *imp, \
66  pixman_composite_info_t *info) \
67 { \
68  PIXMAN_COMPOSITE_ARGS (info); \
69  dst_type *dst_line; \
70  src_type *src_line; \
71  int32_t dst_stride, src_stride; \
72  \
73  PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \
74  src_stride, src_line, src_cnt); \
75  PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
76  dst_stride, dst_line, dst_cnt); \
77  \
78  pixman_composite_##name##_asm_##cputype (width, height, \
79  dst_line, dst_stride, \
80  src_line, src_stride); \
81 }
82 
83 #define PIXMAN_ARM_BIND_FAST_PATH_N_DST(flags, cputype, name, \
84  dst_type, dst_cnt) \
85 void \
86 pixman_composite_##name##_asm_##cputype (int32_t w, \
87  int32_t h, \
88  dst_type *dst, \
89  int32_t dst_stride, \
90  uint32_t src); \
91  \
92 static void \
93 cputype##_composite_##name (pixman_implementation_t *imp, \
94  pixman_composite_info_t *info) \
95 { \
96  PIXMAN_COMPOSITE_ARGS (info); \
97  dst_type *dst_line; \
98  int32_t dst_stride; \
99  uint32_t src; \
100  \
101  src = _pixman_image_get_solid ( \
102  imp, src_image, dest_image->bits.format); \
103  \
104  if ((flags & SKIP_ZERO_SRC) && src == 0) \
105  return; \
106  \
107  PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
108  dst_stride, dst_line, dst_cnt); \
109  \
110  pixman_composite_##name##_asm_##cputype (width, height, \
111  dst_line, dst_stride, \
112  src); \
113 }
114 
115 #define PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST(flags, cputype, name, \
116  mask_type, mask_cnt, \
117  dst_type, dst_cnt) \
118 void \
119 pixman_composite_##name##_asm_##cputype (int32_t w, \
120  int32_t h, \
121  dst_type *dst, \
122  int32_t dst_stride, \
123  uint32_t src, \
124  int32_t unused, \
125  mask_type *mask, \
126  int32_t mask_stride); \
127  \
128 static void \
129 cputype##_composite_##name (pixman_implementation_t *imp, \
130  pixman_composite_info_t *info) \
131 { \
132  PIXMAN_COMPOSITE_ARGS (info); \
133  dst_type *dst_line; \
134  mask_type *mask_line; \
135  int32_t dst_stride, mask_stride; \
136  uint32_t src; \
137  \
138  src = _pixman_image_get_solid ( \
139  imp, src_image, dest_image->bits.format); \
140  \
141  if ((flags & SKIP_ZERO_SRC) && src == 0) \
142  return; \
143  \
144  PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
145  dst_stride, dst_line, dst_cnt); \
146  PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type, \
147  mask_stride, mask_line, mask_cnt); \
148  \
149  pixman_composite_##name##_asm_##cputype (width, height, \
150  dst_line, dst_stride, \
151  src, 0, \
152  mask_line, mask_stride); \
153 }
154 
155 #define PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST(flags, cputype, name, \
156  src_type, src_cnt, \
157  dst_type, dst_cnt) \
158 void \
159 pixman_composite_##name##_asm_##cputype (int32_t w, \
160  int32_t h, \
161  dst_type *dst, \
162  int32_t dst_stride, \
163  src_type *src, \
164  int32_t src_stride, \
165  uint32_t mask); \
166  \
167 static void \
168 cputype##_composite_##name (pixman_implementation_t *imp, \
169  pixman_composite_info_t *info) \
170 { \
171  PIXMAN_COMPOSITE_ARGS (info); \
172  dst_type *dst_line; \
173  src_type *src_line; \
174  int32_t dst_stride, src_stride; \
175  uint32_t mask; \
176  \
177  mask = _pixman_image_get_solid ( \
178  imp, mask_image, dest_image->bits.format); \
179  \
180  if ((flags & SKIP_ZERO_MASK) && mask == 0) \
181  return; \
182  \
183  PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
184  dst_stride, dst_line, dst_cnt); \
185  PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \
186  src_stride, src_line, src_cnt); \
187  \
188  pixman_composite_##name##_asm_##cputype (width, height, \
189  dst_line, dst_stride, \
190  src_line, src_stride, \
191  mask); \
192 }
193 
194 #define PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST(cputype, name, \
195  src_type, src_cnt, \
196  mask_type, mask_cnt, \
197  dst_type, dst_cnt) \
198 void \
199 pixman_composite_##name##_asm_##cputype (int32_t w, \
200  int32_t h, \
201  dst_type *dst, \
202  int32_t dst_stride, \
203  src_type *src, \
204  int32_t src_stride, \
205  mask_type *mask, \
206  int32_t mask_stride); \
207  \
208 static void \
209 cputype##_composite_##name (pixman_implementation_t *imp, \
210  pixman_composite_info_t *info) \
211 { \
212  PIXMAN_COMPOSITE_ARGS (info); \
213  dst_type *dst_line; \
214  src_type *src_line; \
215  mask_type *mask_line; \
216  int32_t dst_stride, src_stride, mask_stride; \
217  \
218  PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type, \
219  dst_stride, dst_line, dst_cnt); \
220  PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \
221  src_stride, src_line, src_cnt); \
222  PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type, \
223  mask_stride, mask_line, mask_cnt); \
224  \
225  pixman_composite_##name##_asm_##cputype (width, height, \
226  dst_line, dst_stride, \
227  src_line, src_stride, \
228  mask_line, mask_stride); \
229 }
230 
231 #define PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST(cputype, name, op, \
232  src_type, dst_type) \
233 void \
234 pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype ( \
235  int32_t w, \
236  dst_type * dst, \
237  const src_type * src, \
238  pixman_fixed_t vx, \
239  pixman_fixed_t unit_x, \
240  pixman_fixed_t max_vx); \
241  \
242 static force_inline void \
243 scaled_nearest_scanline_##cputype##_##name##_##op (dst_type * pd, \
244  const src_type * ps, \
245  int32_t w, \
246  pixman_fixed_t vx, \
247  pixman_fixed_t unit_x, \
248  pixman_fixed_t max_vx, \
249  pixman_bool_t zero_src) \
250 { \
251  pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (w, pd, ps, \
252  vx, unit_x, \
253  max_vx); \
254 } \
255  \
256 FAST_NEAREST_MAINLOOP (cputype##_##name##_cover_##op, \
257  scaled_nearest_scanline_##cputype##_##name##_##op, \
258  src_type, dst_type, COVER) \
259 FAST_NEAREST_MAINLOOP (cputype##_##name##_none_##op, \
260  scaled_nearest_scanline_##cputype##_##name##_##op, \
261  src_type, dst_type, NONE) \
262 FAST_NEAREST_MAINLOOP (cputype##_##name##_pad_##op, \
263  scaled_nearest_scanline_##cputype##_##name##_##op, \
264  src_type, dst_type, PAD) \
265 FAST_NEAREST_MAINLOOP (cputype##_##name##_normal_##op, \
266  scaled_nearest_scanline_##cputype##_##name##_##op, \
267  src_type, dst_type, NORMAL)
268 
269 #define PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_A8_DST(flags, cputype, name, op, \
270  src_type, dst_type) \
271 void \
272 pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype ( \
273  int32_t w, \
274  dst_type * dst, \
275  const src_type * src, \
276  pixman_fixed_t vx, \
277  pixman_fixed_t unit_x, \
278  pixman_fixed_t max_vx, \
279  const uint8_t * mask); \
280  \
281 static force_inline void \
282 scaled_nearest_scanline_##cputype##_##name##_##op (const uint8_t * mask, \
283  dst_type * pd, \
284  const src_type * ps, \
285  int32_t w, \
286  pixman_fixed_t vx, \
287  pixman_fixed_t unit_x, \
288  pixman_fixed_t max_vx, \
289  pixman_bool_t zero_src) \
290 { \
291  if ((flags & SKIP_ZERO_SRC) && zero_src) \
292  return; \
293  pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (w, pd, ps, \
294  vx, unit_x, \
295  max_vx, \
296  mask); \
297 } \
298  \
299 FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_cover_##op, \
300  scaled_nearest_scanline_##cputype##_##name##_##op,\
301  src_type, uint8_t, dst_type, COVER, TRUE, FALSE)\
302 FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_none_##op, \
303  scaled_nearest_scanline_##cputype##_##name##_##op,\
304  src_type, uint8_t, dst_type, NONE, TRUE, FALSE) \
305 FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_pad_##op, \
306  scaled_nearest_scanline_##cputype##_##name##_##op,\
307  src_type, uint8_t, dst_type, PAD, TRUE, FALSE) \
308 FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_normal_##op, \
309  scaled_nearest_scanline_##cputype##_##name##_##op,\
310  src_type, uint8_t, dst_type, NORMAL, TRUE, FALSE)
311 
312 /* Provide entries for the fast path table */
313 #define PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH(op,s,d,func) \
314  SIMPLE_NEAREST_A8_MASK_FAST_PATH (op,s,d,func), \
315  SIMPLE_NEAREST_A8_MASK_FAST_PATH_NORMAL (op,s,d,func)
316 
317 /*****************************************************************************/
318 
319 #define PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST(flags, cputype, name, op, \
320  src_type, dst_type) \
321 void \
322 pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype ( \
323  dst_type * dst, \
324  const src_type * top, \
325  const src_type * bottom, \
326  int wt, \
327  int wb, \
328  pixman_fixed_t x, \
329  pixman_fixed_t ux, \
330  int width); \
331  \
332 static force_inline void \
333 scaled_bilinear_scanline_##cputype##_##name##_##op ( \
334  dst_type * dst, \
335  const uint32_t * mask, \
336  const src_type * src_top, \
337  const src_type * src_bottom, \
338  int32_t w, \
339  int wt, \
340  int wb, \
341  pixman_fixed_t vx, \
342  pixman_fixed_t unit_x, \
343  pixman_fixed_t max_vx, \
344  pixman_bool_t zero_src) \
345 { \
346  if ((flags & SKIP_ZERO_SRC) && zero_src) \
347  return; \
348  pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype ( \
349  dst, src_top, src_bottom, wt, wb, vx, unit_x, w); \
350 } \
351  \
352 FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_cover_##op, \
353  scaled_bilinear_scanline_##cputype##_##name##_##op, \
354  src_type, uint32_t, dst_type, COVER, FLAG_NONE) \
355 FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_none_##op, \
356  scaled_bilinear_scanline_##cputype##_##name##_##op, \
357  src_type, uint32_t, dst_type, NONE, FLAG_NONE) \
358 FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_pad_##op, \
359  scaled_bilinear_scanline_##cputype##_##name##_##op, \
360  src_type, uint32_t, dst_type, PAD, FLAG_NONE) \
361 FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_normal_##op, \
362  scaled_bilinear_scanline_##cputype##_##name##_##op, \
363  src_type, uint32_t, dst_type, NORMAL, \
364  FLAG_NONE)
365 
366 
367 #define PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_A8_DST(flags, cputype, name, op, \
368  src_type, dst_type) \
369 void \
370 pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype ( \
371  dst_type * dst, \
372  const uint8_t * mask, \
373  const src_type * top, \
374  const src_type * bottom, \
375  int wt, \
376  int wb, \
377  pixman_fixed_t x, \
378  pixman_fixed_t ux, \
379  int width); \
380  \
381 static force_inline void \
382 scaled_bilinear_scanline_##cputype##_##name##_##op ( \
383  dst_type * dst, \
384  const uint8_t * mask, \
385  const src_type * src_top, \
386  const src_type * src_bottom, \
387  int32_t w, \
388  int wt, \
389  int wb, \
390  pixman_fixed_t vx, \
391  pixman_fixed_t unit_x, \
392  pixman_fixed_t max_vx, \
393  pixman_bool_t zero_src) \
394 { \
395  if ((flags & SKIP_ZERO_SRC) && zero_src) \
396  return; \
397  pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype ( \
398  dst, mask, src_top, src_bottom, wt, wb, vx, unit_x, w); \
399 } \
400  \
401 FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_cover_##op, \
402  scaled_bilinear_scanline_##cputype##_##name##_##op, \
403  src_type, uint8_t, dst_type, COVER, \
404  FLAG_HAVE_NON_SOLID_MASK) \
405 FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_none_##op, \
406  scaled_bilinear_scanline_##cputype##_##name##_##op, \
407  src_type, uint8_t, dst_type, NONE, \
408  FLAG_HAVE_NON_SOLID_MASK) \
409 FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_pad_##op, \
410  scaled_bilinear_scanline_##cputype##_##name##_##op, \
411  src_type, uint8_t, dst_type, PAD, \
412  FLAG_HAVE_NON_SOLID_MASK) \
413 FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_normal_##op, \
414  scaled_bilinear_scanline_##cputype##_##name##_##op, \
415  src_type, uint8_t, dst_type, NORMAL, \
416  FLAG_HAVE_NON_SOLID_MASK)
417 
418 
419 #endif