2 * Copyright © 2010 Nokia Corporation
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:
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
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.
23 * Author: Siarhei Siamashka (siarhei.siamashka@nokia.com)
26 #ifndef PIXMAN_ARM_COMMON_H
27 #define PIXMAN_ARM_COMMON_H
29 /* Define some macros which can expand into proxy functions between
30 * ARM assembly optimized functions and the rest of pixman fast path API.
32 * All the low level ARM assembly functions have to use ARM EABI
33 * calling convention and take up to 8 arguments:
34 * width, height, dst, dst_stride, src, src_stride, mask, mask_stride
36 * The arguments are ordered with the most important coming first (the
37 * first 4 arguments are passed to function in registers, the rest are
38 * on stack). The last arguments are optional, for example if the
39 * function is not using mask, then 'mask' and 'mask_stride' can be
40 * omitted when doing a function call.
42 * Arguments 'src' and 'mask' contain either a pointer to the top left
43 * pixel of the composited rectangle or a pixel color value depending
44 * on the function type. In the case of just a color value (solid source
45 * or mask), the corresponding stride argument is unused.
48 #define PIXMAN_ARM_BIND_FAST_PATH_SRC_DST(cputype, name, \
52 pixman_composite_##name##_asm_##cputype (int32_t w, \
57 int32_t src_stride); \
60 cputype##_composite_##name (pixman_implementation_t *imp, \
62 pixman_image_t * src_image, \
63 pixman_image_t * mask_image, \
64 pixman_image_t * dst_image, \
76 int32_t dst_stride, src_stride; \
78 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \
79 src_stride, src_line, src_cnt); \
80 PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type, \
81 dst_stride, dst_line, dst_cnt); \
83 pixman_composite_##name##_asm_##cputype (width, height, \
84 dst_line, dst_stride, \
85 src_line, src_stride); \
88 #define PIXMAN_ARM_BIND_FAST_PATH_N_DST(cputype, name, \
91 pixman_composite_##name##_asm_##cputype (int32_t w, \
98 cputype##_composite_##name (pixman_implementation_t *imp, \
100 pixman_image_t * src_image, \
101 pixman_image_t * mask_image, \
102 pixman_image_t * dst_image, \
112 dst_type *dst_line; \
113 int32_t dst_stride; \
116 src = _pixman_image_get_solid (src_image, dst_image->bits.format); \
121 PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type, \
122 dst_stride, dst_line, dst_cnt); \
124 pixman_composite_##name##_asm_##cputype (width, height, \
125 dst_line, dst_stride, \
129 #define PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST(cputype, name, \
130 mask_type, mask_cnt, \
133 pixman_composite_##name##_asm_##cputype (int32_t w, \
136 int32_t dst_stride, \
140 int32_t mask_stride); \
143 cputype##_composite_##name (pixman_implementation_t *imp, \
145 pixman_image_t * src_image, \
146 pixman_image_t * mask_image, \
147 pixman_image_t * dst_image, \
157 dst_type *dst_line; \
158 mask_type *mask_line; \
159 int32_t dst_stride, mask_stride; \
162 src = _pixman_image_get_solid (src_image, dst_image->bits.format); \
167 PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type, \
168 dst_stride, dst_line, dst_cnt); \
169 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type, \
170 mask_stride, mask_line, mask_cnt); \
172 pixman_composite_##name##_asm_##cputype (width, height, \
173 dst_line, dst_stride, \
175 mask_line, mask_stride); \
178 #define PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST(cputype, name, \
182 pixman_composite_##name##_asm_##cputype (int32_t w, \
185 int32_t dst_stride, \
187 int32_t src_stride, \
191 cputype##_composite_##name (pixman_implementation_t *imp, \
193 pixman_image_t * src_image, \
194 pixman_image_t * mask_image, \
195 pixman_image_t * dst_image, \
205 dst_type *dst_line; \
206 src_type *src_line; \
207 int32_t dst_stride, src_stride; \
210 mask = _pixman_image_get_solid (mask_image, dst_image->bits.format);\
215 PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type, \
216 dst_stride, dst_line, dst_cnt); \
217 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \
218 src_stride, src_line, src_cnt); \
220 pixman_composite_##name##_asm_##cputype (width, height, \
221 dst_line, dst_stride, \
222 src_line, src_stride, \
226 #define PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST(cputype, name, \
228 mask_type, mask_cnt, \
231 pixman_composite_##name##_asm_##cputype (int32_t w, \
234 int32_t dst_stride, \
236 int32_t src_stride, \
238 int32_t mask_stride); \
241 cputype##_composite_##name (pixman_implementation_t *imp, \
243 pixman_image_t * src_image, \
244 pixman_image_t * mask_image, \
245 pixman_image_t * dst_image, \
255 dst_type *dst_line; \
256 src_type *src_line; \
257 mask_type *mask_line; \
258 int32_t dst_stride, src_stride, mask_stride; \
260 PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type, \
261 dst_stride, dst_line, dst_cnt); \
262 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type, \
263 src_stride, src_line, src_cnt); \
264 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type, \
265 mask_stride, mask_line, mask_cnt); \
267 pixman_composite_##name##_asm_##cputype (width, height, \
268 dst_line, dst_stride, \
269 src_line, src_stride, \
270 mask_line, mask_stride); \