2 * Copyright © 2004, 2005 Red Hat, Inc.
3 * Copyright © 2004 Nicholas Miell
4 * Copyright © 2005 Trolltech AS
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Red Hat not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. Red Hat makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
21 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
22 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
25 * Author: Søren Sandmann (sandmann@redhat.com)
26 * Minor Improvements: Nicholas Miell (nmiell@gmail.com)
27 * MMX code paths for fbcompose.c by Lars Knoll (lars@trolltech.com)
29 * Based on work by Owen Taylor
36 #if defined USE_X86_MMX || defined USE_ARM_IWMMXT || defined USE_LOONGSON_MMI
38 #ifdef USE_LOONGSON_MMI
39 #include <loongson-mmintrin.h>
43 #include "pixman-private.h"
44 #include "pixman-combine32.h"
49 #define CHECKPOINT() error_f ("at %s %d\n", __FUNCTION__, __LINE__)
55 /* Empty the multimedia state. For some reason, ARM's mmintrin.h doesn't provide this. */
56 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
64 # if (defined(__SUNPRO_C) || defined(_MSC_VER))
65 # include <xmmintrin.h>
67 /* We have to compile with -msse to use xmmintrin.h, but that causes SSE
68 * instructions to be generated that we don't want. Just duplicate the
69 * functions we want to use. */
70 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
71 _mm_movemask_pi8 (__m64 __A)
75 asm ("pmovmskb %1, %0\n\t"
83 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
84 _mm_mulhi_pu16 (__m64 __A, __m64 __B)
86 asm ("pmulhuw %1, %0\n\t"
94 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
95 _mm_shuffle_pi16 (__m64 __A, int8_t const __N)
99 asm ("pshufw %2, %1, %0\n\t"
101 : "y" (__A), "K" (__N)
107 # define _mm_shuffle_pi16(A, N) \
108 ((__m64) __builtin_ia32_pshufw ((__v4hi)(__m64)(A), (int)(N)))
114 #define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \
115 (((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | (fp0))
118 /* Notes about writing mmx code
120 * give memory operands as the second operand. If you give it as the
121 * first, gcc will first load it into a register, then use that
126 * _mm_mullo_pi16 (x, mmx_constant);
130 * _mm_mullo_pi16 (mmx_constant, x);
132 * Also try to minimize dependencies. i.e. when you need a value, try
133 * to calculate it from a value that was calculated as early as
137 /* --------------- MMX primitives ------------------------------------- */
139 /* If __m64 is defined as a struct or union, then define M64_MEMBER to be
140 * the name of the member used to access the data.
141 * If __m64 requires using mm_cvt* intrinsics functions to convert between
142 * uint64_t and __m64 values, then define USE_CVT_INTRINSICS.
143 * If __m64 and uint64_t values can just be cast to each other directly,
144 * then define USE_M64_CASTS.
145 * If __m64 is a double datatype, then define USE_M64_DOUBLE.
148 # define M64_MEMBER m64_u64
150 # define USE_CVT_INTRINSICS
151 #elif defined(USE_LOONGSON_MMI)
152 # define USE_M64_DOUBLE
153 #elif defined(__GNUC__)
154 # define USE_M64_CASTS
155 #elif defined(__SUNPRO_C)
156 # if (__SUNPRO_C >= 0x5120) && !defined(__NOVECTORSIZE__)
157 /* Solaris Studio 12.3 (Sun C 5.12) introduces __attribute__(__vector_size__)
158 * support, and defaults to using it to define __m64, unless __NOVECTORSIZE__
159 * is defined. If it is used, then the mm_cvt* intrinsics must be used.
161 # define USE_CVT_INTRINSICS
163 /* For Studio 12.2 or older, or when __attribute__(__vector_size__) is
164 * disabled, __m64 is defined as a struct containing "unsigned long long l_".
166 # define M64_MEMBER l_
170 #if defined(USE_M64_CASTS) || defined(USE_CVT_INTRINSICS) || defined(USE_M64_DOUBLE)
171 typedef uint64_t mmxdatafield;
173 typedef __m64 mmxdatafield;
178 mmxdatafield mmx_4x00ff;
179 mmxdatafield mmx_4x0080;
180 mmxdatafield mmx_565_rgb;
181 mmxdatafield mmx_565_unpack_multiplier;
182 mmxdatafield mmx_565_r;
183 mmxdatafield mmx_565_g;
184 mmxdatafield mmx_565_b;
185 #ifndef USE_LOONGSON_MMI
186 mmxdatafield mmx_mask_0;
187 mmxdatafield mmx_mask_1;
188 mmxdatafield mmx_mask_2;
189 mmxdatafield mmx_mask_3;
191 mmxdatafield mmx_full_alpha;
192 mmxdatafield mmx_4x0101;
195 #if defined(_MSC_VER)
196 # define MMXDATA_INIT(field, val) { val ## UI64 }
197 #elif defined(M64_MEMBER) /* __m64 is a struct, not an integral type */
198 # define MMXDATA_INIT(field, val) field = { val ## ULL }
199 #else /* mmxdatafield is an integral type */
200 # define MMXDATA_INIT(field, val) field = val ## ULL
203 static const mmx_data_t c =
205 MMXDATA_INIT (.mmx_4x00ff, 0x00ff00ff00ff00ff),
206 MMXDATA_INIT (.mmx_4x0080, 0x0080008000800080),
207 MMXDATA_INIT (.mmx_565_rgb, 0x000001f0003f001f),
208 MMXDATA_INIT (.mmx_565_unpack_multiplier, 0x0000008404100840),
209 MMXDATA_INIT (.mmx_565_r, 0x000000f800000000),
210 MMXDATA_INIT (.mmx_565_g, 0x0000000000fc0000),
211 MMXDATA_INIT (.mmx_565_b, 0x00000000000000f8),
212 #ifndef USE_LOONGSON_MMI
213 MMXDATA_INIT (.mmx_mask_0, 0xffffffffffff0000),
214 MMXDATA_INIT (.mmx_mask_1, 0xffffffff0000ffff),
215 MMXDATA_INIT (.mmx_mask_2, 0xffff0000ffffffff),
216 MMXDATA_INIT (.mmx_mask_3, 0x0000ffffffffffff),
218 MMXDATA_INIT (.mmx_full_alpha, 0x00ff000000000000),
219 MMXDATA_INIT (.mmx_4x0101, 0x0101010101010101),
222 #ifdef USE_CVT_INTRINSICS
223 # define MC(x) to_m64 (c.mmx_ ## x)
224 #elif defined(USE_M64_CASTS)
225 # define MC(x) ((__m64)c.mmx_ ## x)
226 #elif defined(USE_M64_DOUBLE)
227 # define MC(x) (*(__m64 *)&c.mmx_ ## x)
229 # define MC(x) c.mmx_ ## x
232 static force_inline __m64
235 #ifdef USE_CVT_INTRINSICS
236 return _mm_cvtsi64_m64 (x);
237 #elif defined M64_MEMBER /* __m64 is a struct, not an integral type */
242 #elif defined USE_M64_DOUBLE
244 #else /* USE_M64_CASTS */
249 static force_inline uint64_t
252 #ifdef USE_CVT_INTRINSICS
253 return _mm_cvtm64_si64 (x);
254 #elif defined M64_MEMBER /* __m64 is a struct, not an integral type */
255 uint64_t res = x.M64_MEMBER;
257 #elif defined USE_M64_DOUBLE
258 return *(uint64_t *)&x;
259 #else /* USE_M64_CASTS */
264 static force_inline __m64
269 return _mm_slli_si64 (v, s);
271 return _mm_srli_si64 (v, -s);
276 static force_inline __m64
279 return _mm_xor_si64 (mask, MC (4x00ff));
282 static force_inline __m64
283 pix_multiply (__m64 a, __m64 b)
287 res = _mm_mullo_pi16 (a, b);
288 res = _mm_adds_pu16 (res, MC (4x0080));
289 res = _mm_mulhi_pu16 (res, MC (4x0101));
294 static force_inline __m64
295 pix_add (__m64 a, __m64 b)
297 return _mm_adds_pu8 (a, b);
300 static force_inline __m64
301 expand_alpha (__m64 pixel)
303 return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE (3, 3, 3, 3));
306 static force_inline __m64
307 expand_alpha_rev (__m64 pixel)
309 return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE (0, 0, 0, 0));
312 static force_inline __m64
313 invert_colors (__m64 pixel)
315 return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE (3, 0, 1, 2));
318 static force_inline __m64
323 return _mm_adds_pu8 (src, pix_multiply (dest, negate (srca)));
326 static force_inline __m64
327 over_rev_non_pre (__m64 src, __m64 dest)
329 __m64 srca = expand_alpha (src);
330 __m64 srcfaaa = _mm_or_si64 (srca, MC (full_alpha));
332 return over (pix_multiply (invert_colors (src), srcfaaa), srca, dest);
335 static force_inline __m64
336 in (__m64 src, __m64 mask)
338 return pix_multiply (src, mask);
342 static force_inline __m64
343 in_over (__m64 src, __m64 srca, __m64 mask, __m64 dest)
345 return over (in (src, mask), pix_multiply (srca, mask), dest);
350 #define in_over(src, srca, mask, dest) \
351 over (in (src, mask), pix_multiply (srca, mask), dest)
355 /* Elemental unaligned loads */
357 static force_inline __m64 ldq_u(__m64 *p)
360 /* x86's alignment restrictions are very relaxed. */
362 #elif defined USE_ARM_IWMMXT
363 int align = (uintptr_t)p & 7;
367 aligned_p = (__m64 *)((uintptr_t)p & ~7);
368 return (__m64) _mm_align_si64 (aligned_p[0], aligned_p[1], align);
370 struct __una_u64 { __m64 x __attribute__((packed)); };
371 const struct __una_u64 *ptr = (const struct __una_u64 *) p;
372 return (__m64) ptr->x;
376 static force_inline uint32_t ldl_u(const uint32_t *p)
379 /* x86's alignment restrictions are very relaxed. */
382 struct __una_u32 { uint32_t x __attribute__((packed)); };
383 const struct __una_u32 *ptr = (const struct __una_u32 *) p;
388 static force_inline __m64
389 load (const uint32_t *v)
391 #ifdef USE_LOONGSON_MMI
393 asm ("lwc1 %0, %1\n\t"
399 return _mm_cvtsi32_si64 (*v);
403 static force_inline __m64
404 load8888 (const uint32_t *v)
406 #ifdef USE_LOONGSON_MMI
407 return _mm_unpacklo_pi8_f (*(__m32 *)v, _mm_setzero_si64 ());
409 return _mm_unpacklo_pi8 (load (v), _mm_setzero_si64 ());
413 static force_inline __m64
414 load8888u (const uint32_t *v)
416 uint32_t l = ldl_u (v);
417 return load8888 (&l);
420 static force_inline __m64
421 pack8888 (__m64 lo, __m64 hi)
423 return _mm_packs_pu16 (lo, hi);
426 static force_inline void
427 store (uint32_t *dest, __m64 v)
429 #ifdef USE_LOONGSON_MMI
430 asm ("swc1 %1, %0\n\t"
436 *dest = _mm_cvtsi64_si32 (v);
440 static force_inline void
441 store8888 (uint32_t *dest, __m64 v)
443 v = pack8888 (v, _mm_setzero_si64 ());
447 static force_inline pixman_bool_t
448 is_equal (__m64 a, __m64 b)
450 #ifdef USE_LOONGSON_MMI
451 /* __m64 is double, we can compare directly. */
454 return _mm_movemask_pi8 (_mm_cmpeq_pi8 (a, b)) == 0xff;
458 static force_inline pixman_bool_t
461 #ifdef USE_LOONGSON_MMI
462 return is_equal (_mm_and_si64 (v, MC (full_alpha)), MC (full_alpha));
464 __m64 ffs = _mm_cmpeq_pi8 (v, v);
465 return (_mm_movemask_pi8 (_mm_cmpeq_pi8 (v, ffs)) & 0x40);
469 static force_inline pixman_bool_t
472 return is_equal (v, _mm_setzero_si64 ());
475 /* Expand 16 bits positioned at @pos (0-3) of a mmx register into
479 * --- Expanding 565 in the low word ---
481 * m = (m << (32 - 3)) | (m << (16 - 5)) | m;
482 * m = m & (01f0003f001f);
483 * m = m * (008404100840);
486 * Note the trick here - the top word is shifted by another nibble to
487 * avoid it bumping into the middle word
489 static force_inline __m64
490 expand565 (__m64 pixel, int pos)
495 /* move pixel to low 16 bit and zero the rest */
496 #ifdef USE_LOONGSON_MMI
497 p = loongson_extract_pi16 (p, pos);
499 p = shift (shift (p, (3 - pos) * 16), -48);
502 t1 = shift (p, 36 - 11);
503 t2 = shift (p, 16 - 5);
505 p = _mm_or_si64 (t1, p);
506 p = _mm_or_si64 (t2, p);
507 p = _mm_and_si64 (p, MC (565_rgb));
509 pixel = _mm_mullo_pi16 (p, MC (565_unpack_multiplier));
510 return _mm_srli_pi16 (pixel, 8);
513 static force_inline __m64
514 expand8888 (__m64 in, int pos)
517 return _mm_unpacklo_pi8 (in, _mm_setzero_si64 ());
519 return _mm_unpackhi_pi8 (in, _mm_setzero_si64 ());
522 static force_inline __m64
523 expandx888 (__m64 in, int pos)
525 return _mm_or_si64 (expand8888 (in, pos), MC (full_alpha));
528 static force_inline __m64
529 pack_565 (__m64 pixel, __m64 target, int pos)
535 r = _mm_and_si64 (p, MC (565_r));
536 g = _mm_and_si64 (p, MC (565_g));
537 b = _mm_and_si64 (p, MC (565_b));
539 #ifdef USE_LOONGSON_MMI
540 r = shift (r, -(32 - 8));
541 g = shift (g, -(16 - 3));
542 b = shift (b, -(0 + 3));
544 p = _mm_or_si64 (r, g);
545 p = _mm_or_si64 (p, b);
546 return loongson_insert_pi16 (t, p, pos);
548 r = shift (r, -(32 - 8) + pos * 16);
549 g = shift (g, -(16 - 3) + pos * 16);
550 b = shift (b, -(0 + 3) + pos * 16);
553 t = _mm_and_si64 (t, MC (mask_0));
555 t = _mm_and_si64 (t, MC (mask_1));
557 t = _mm_and_si64 (t, MC (mask_2));
559 t = _mm_and_si64 (t, MC (mask_3));
561 p = _mm_or_si64 (r, t);
562 p = _mm_or_si64 (g, p);
564 return _mm_or_si64 (b, p);
570 static force_inline __m64
571 pix_add_mul (__m64 x, __m64 a, __m64 y, __m64 b)
573 x = pix_multiply (x, a);
574 y = pix_multiply (y, b);
576 return pix_add (x, y);
581 #define pix_add_mul(x, a, y, b) \
582 ( x = pix_multiply (x, a), \
583 y = pix_multiply (y, b), \
588 /* --------------- MMX code patch for fbcompose.c --------------------- */
590 static force_inline __m64
591 combine (const uint32_t *src, const uint32_t *mask)
593 __m64 vsrc = load8888 (src);
597 __m64 m = load8888 (mask);
599 m = expand_alpha (m);
600 vsrc = pix_multiply (vsrc, m);
607 mmx_combine_over_u (pixman_implementation_t *imp,
610 const uint32_t * src,
611 const uint32_t * mask,
614 const uint32_t *end = dest + width;
618 __m64 vsrc = combine (src, mask);
620 if (is_opaque (vsrc))
622 store8888 (dest, vsrc);
624 else if (!is_zero (vsrc))
626 __m64 sa = expand_alpha (vsrc);
627 store8888 (dest, over (vsrc, sa, load8888 (dest)));
639 mmx_combine_over_reverse_u (pixman_implementation_t *imp,
642 const uint32_t * src,
643 const uint32_t * mask,
646 const uint32_t *end = dest + width;
651 __m64 s = combine (src, mask);
654 da = expand_alpha (d);
655 store8888 (dest, over (d, da, s));
666 mmx_combine_in_u (pixman_implementation_t *imp,
669 const uint32_t * src,
670 const uint32_t * mask,
673 const uint32_t *end = dest + width;
678 __m64 x = combine (src, mask);
681 a = expand_alpha (a);
682 x = pix_multiply (x, a);
695 mmx_combine_in_reverse_u (pixman_implementation_t *imp,
698 const uint32_t * src,
699 const uint32_t * mask,
702 const uint32_t *end = dest + width;
706 __m64 a = combine (src, mask);
710 a = expand_alpha (a);
711 x = pix_multiply (x, a);
723 mmx_combine_out_u (pixman_implementation_t *imp,
726 const uint32_t * src,
727 const uint32_t * mask,
730 const uint32_t *end = dest + width;
735 __m64 x = combine (src, mask);
738 a = expand_alpha (a);
740 x = pix_multiply (x, a);
752 mmx_combine_out_reverse_u (pixman_implementation_t *imp,
755 const uint32_t * src,
756 const uint32_t * mask,
759 const uint32_t *end = dest + width;
763 __m64 a = combine (src, mask);
767 a = expand_alpha (a);
769 x = pix_multiply (x, a);
782 mmx_combine_atop_u (pixman_implementation_t *imp,
785 const uint32_t * src,
786 const uint32_t * mask,
789 const uint32_t *end = dest + width;
794 __m64 s = combine (src, mask);
797 sia = expand_alpha (s);
799 da = expand_alpha (d);
800 s = pix_add_mul (s, da, d, sia);
812 mmx_combine_atop_reverse_u (pixman_implementation_t *imp,
815 const uint32_t * src,
816 const uint32_t * mask,
826 __m64 s = combine (src, mask);
829 sa = expand_alpha (s);
830 dia = expand_alpha (d);
832 s = pix_add_mul (s, dia, d, sa);
844 mmx_combine_xor_u (pixman_implementation_t *imp,
847 const uint32_t * src,
848 const uint32_t * mask,
851 const uint32_t *end = dest + width;
856 __m64 s = combine (src, mask);
859 sia = expand_alpha (s);
860 dia = expand_alpha (d);
863 s = pix_add_mul (s, dia, d, sia);
875 mmx_combine_add_u (pixman_implementation_t *imp,
878 const uint32_t * src,
879 const uint32_t * mask,
882 const uint32_t *end = dest + width;
887 __m64 s = combine (src, mask);
902 mmx_combine_saturate_u (pixman_implementation_t *imp,
905 const uint32_t * src,
906 const uint32_t * mask,
909 const uint32_t *end = dest + width;
915 __m64 ms = combine (src, mask);
916 __m64 md = load8888 (dest);
924 uint32_t quot = DIV_UN8 (da, sa) << 24;
925 __m64 msa = load8888 (");
926 msa = expand_alpha (msa);
927 ms = pix_multiply (ms, msa);
930 md = pix_add (md, ms);
931 store8888 (dest, md);
942 mmx_combine_src_ca (pixman_implementation_t *imp,
945 const uint32_t * src,
946 const uint32_t * mask,
949 const uint32_t *end = src + width;
953 __m64 a = load8888 (mask);
954 __m64 s = load8888 (src);
956 s = pix_multiply (s, a);
967 mmx_combine_over_ca (pixman_implementation_t *imp,
970 const uint32_t * src,
971 const uint32_t * mask,
974 const uint32_t *end = src + width;
978 __m64 a = load8888 (mask);
979 __m64 s = load8888 (src);
980 __m64 d = load8888 (dest);
981 __m64 sa = expand_alpha (s);
983 store8888 (dest, in_over (s, sa, a, d));
993 mmx_combine_over_reverse_ca (pixman_implementation_t *imp,
996 const uint32_t * src,
997 const uint32_t * mask,
1000 const uint32_t *end = src + width;
1004 __m64 a = load8888 (mask);
1005 __m64 s = load8888 (src);
1006 __m64 d = load8888 (dest);
1007 __m64 da = expand_alpha (d);
1009 store8888 (dest, over (d, da, in (s, a)));
1019 mmx_combine_in_ca (pixman_implementation_t *imp,
1022 const uint32_t * src,
1023 const uint32_t * mask,
1026 const uint32_t *end = src + width;
1030 __m64 a = load8888 (mask);
1031 __m64 s = load8888 (src);
1032 __m64 d = load8888 (dest);
1033 __m64 da = expand_alpha (d);
1035 s = pix_multiply (s, a);
1036 s = pix_multiply (s, da);
1037 store8888 (dest, s);
1047 mmx_combine_in_reverse_ca (pixman_implementation_t *imp,
1050 const uint32_t * src,
1051 const uint32_t * mask,
1054 const uint32_t *end = src + width;
1058 __m64 a = load8888 (mask);
1059 __m64 s = load8888 (src);
1060 __m64 d = load8888 (dest);
1061 __m64 sa = expand_alpha (s);
1063 a = pix_multiply (a, sa);
1064 d = pix_multiply (d, a);
1065 store8888 (dest, d);
1075 mmx_combine_out_ca (pixman_implementation_t *imp,
1078 const uint32_t * src,
1079 const uint32_t * mask,
1082 const uint32_t *end = src + width;
1086 __m64 a = load8888 (mask);
1087 __m64 s = load8888 (src);
1088 __m64 d = load8888 (dest);
1089 __m64 da = expand_alpha (d);
1092 s = pix_multiply (s, a);
1093 s = pix_multiply (s, da);
1094 store8888 (dest, s);
1104 mmx_combine_out_reverse_ca (pixman_implementation_t *imp,
1107 const uint32_t * src,
1108 const uint32_t * mask,
1111 const uint32_t *end = src + width;
1115 __m64 a = load8888 (mask);
1116 __m64 s = load8888 (src);
1117 __m64 d = load8888 (dest);
1118 __m64 sa = expand_alpha (s);
1120 a = pix_multiply (a, sa);
1122 d = pix_multiply (d, a);
1123 store8888 (dest, d);
1133 mmx_combine_atop_ca (pixman_implementation_t *imp,
1136 const uint32_t * src,
1137 const uint32_t * mask,
1140 const uint32_t *end = src + width;
1144 __m64 a = load8888 (mask);
1145 __m64 s = load8888 (src);
1146 __m64 d = load8888 (dest);
1147 __m64 da = expand_alpha (d);
1148 __m64 sa = expand_alpha (s);
1150 s = pix_multiply (s, a);
1151 a = pix_multiply (a, sa);
1153 d = pix_add_mul (d, a, s, da);
1154 store8888 (dest, d);
1164 mmx_combine_atop_reverse_ca (pixman_implementation_t *imp,
1167 const uint32_t * src,
1168 const uint32_t * mask,
1171 const uint32_t *end = src + width;
1175 __m64 a = load8888 (mask);
1176 __m64 s = load8888 (src);
1177 __m64 d = load8888 (dest);
1178 __m64 da = expand_alpha (d);
1179 __m64 sa = expand_alpha (s);
1181 s = pix_multiply (s, a);
1182 a = pix_multiply (a, sa);
1184 d = pix_add_mul (d, a, s, da);
1185 store8888 (dest, d);
1195 mmx_combine_xor_ca (pixman_implementation_t *imp,
1198 const uint32_t * src,
1199 const uint32_t * mask,
1202 const uint32_t *end = src + width;
1206 __m64 a = load8888 (mask);
1207 __m64 s = load8888 (src);
1208 __m64 d = load8888 (dest);
1209 __m64 da = expand_alpha (d);
1210 __m64 sa = expand_alpha (s);
1212 s = pix_multiply (s, a);
1213 a = pix_multiply (a, sa);
1216 d = pix_add_mul (d, a, s, da);
1217 store8888 (dest, d);
1227 mmx_combine_add_ca (pixman_implementation_t *imp,
1230 const uint32_t * src,
1231 const uint32_t * mask,
1234 const uint32_t *end = src + width;
1238 __m64 a = load8888 (mask);
1239 __m64 s = load8888 (src);
1240 __m64 d = load8888 (dest);
1242 s = pix_multiply (s, a);
1244 store8888 (dest, d);
1253 /* ------------- MMX code paths called from fbpict.c -------------------- */
1256 mmx_composite_over_n_8888 (pixman_implementation_t *imp,
1257 pixman_composite_info_t *info)
1259 PIXMAN_COMPOSITE_ARGS (info);
1261 uint32_t *dst_line, *dst;
1268 src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
1273 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
1275 vsrc = load8888 (&src);
1276 vsrca = expand_alpha (vsrc);
1281 dst_line += dst_stride;
1286 while (w && (unsigned long)dst & 7)
1288 store8888 (dst, over (vsrc, vsrca, load8888 (dst)));
1299 vdest = *(__m64 *)dst;
1301 dest0 = over (vsrc, vsrca, expand8888 (vdest, 0));
1302 dest1 = over (vsrc, vsrca, expand8888 (vdest, 1));
1304 *(__m64 *)dst = pack8888 (dest0, dest1);
1314 store8888 (dst, over (vsrc, vsrca, load8888 (dst)));
1322 mmx_composite_over_n_0565 (pixman_implementation_t *imp,
1323 pixman_composite_info_t *info)
1325 PIXMAN_COMPOSITE_ARGS (info);
1327 uint16_t *dst_line, *dst;
1334 src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
1339 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
1341 vsrc = load8888 (&src);
1342 vsrca = expand_alpha (vsrc);
1347 dst_line += dst_stride;
1352 while (w && (unsigned long)dst & 7)
1355 __m64 vdest = expand565 (to_m64 (d), 0);
1357 vdest = pack_565 (over (vsrc, vsrca, vdest), vdest, 0);
1358 *dst = to_uint64 (vdest);
1368 vdest = *(__m64 *)dst;
1370 vdest = pack_565 (over (vsrc, vsrca, expand565 (vdest, 0)), vdest, 0);
1371 vdest = pack_565 (over (vsrc, vsrca, expand565 (vdest, 1)), vdest, 1);
1372 vdest = pack_565 (over (vsrc, vsrca, expand565 (vdest, 2)), vdest, 2);
1373 vdest = pack_565 (over (vsrc, vsrca, expand565 (vdest, 3)), vdest, 3);
1375 *(__m64 *)dst = vdest;
1386 __m64 vdest = expand565 (to_m64 (d), 0);
1388 vdest = pack_565 (over (vsrc, vsrca, vdest), vdest, 0);
1389 *dst = to_uint64 (vdest);
1400 mmx_composite_over_n_8888_8888_ca (pixman_implementation_t *imp,
1401 pixman_composite_info_t *info)
1403 PIXMAN_COMPOSITE_ARGS (info);
1406 uint32_t *mask_line;
1407 int dst_stride, mask_stride;
1412 src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
1417 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
1418 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint32_t, mask_stride, mask_line, 1);
1420 vsrc = load8888 (&src);
1421 vsrca = expand_alpha (vsrc);
1426 uint32_t *p = (uint32_t *)mask_line;
1427 uint32_t *q = (uint32_t *)dst_line;
1429 while (twidth && (unsigned long)q & 7)
1431 uint32_t m = *(uint32_t *)p;
1435 __m64 vdest = load8888 (q);
1436 vdest = in_over (vsrc, vsrca, load8888 (&m), vdest);
1437 store8888 (q, vdest);
1454 __m64 vdest = *(__m64 *)q;
1456 dest0 = in_over (vsrc, vsrca, load8888 (&m0),
1457 expand8888 (vdest, 0));
1458 dest1 = in_over (vsrc, vsrca, load8888 (&m1),
1459 expand8888 (vdest, 1));
1461 *(__m64 *)q = pack8888 (dest0, dest1);
1471 uint32_t m = *(uint32_t *)p;
1475 __m64 vdest = load8888 (q);
1476 vdest = in_over (vsrc, vsrca, load8888 (&m), vdest);
1477 store8888 (q, vdest);
1485 dst_line += dst_stride;
1486 mask_line += mask_stride;
1493 mmx_composite_over_8888_n_8888 (pixman_implementation_t *imp,
1494 pixman_composite_info_t *info)
1496 PIXMAN_COMPOSITE_ARGS (info);
1497 uint32_t *dst_line, *dst;
1498 uint32_t *src_line, *src;
1501 int dst_stride, src_stride;
1506 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
1507 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
1509 mask = _pixman_image_get_solid (imp, mask_image, dest_image->bits.format);
1511 mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
1512 vmask = load8888 (&mask);
1517 dst_line += dst_stride;
1519 src_line += src_stride;
1522 while (w && (unsigned long)dst & 7)
1524 __m64 s = load8888 (src);
1525 __m64 d = load8888 (dst);
1527 store8888 (dst, in_over (s, expand_alpha (s), vmask, d));
1536 __m64 vs = ldq_u ((__m64 *)src);
1537 __m64 vd = *(__m64 *)dst;
1538 __m64 vsrc0 = expand8888 (vs, 0);
1539 __m64 vsrc1 = expand8888 (vs, 1);
1541 *(__m64 *)dst = pack8888 (
1542 in_over (vsrc0, expand_alpha (vsrc0), vmask, expand8888 (vd, 0)),
1543 in_over (vsrc1, expand_alpha (vsrc1), vmask, expand8888 (vd, 1)));
1552 __m64 s = load8888 (src);
1553 __m64 d = load8888 (dst);
1555 store8888 (dst, in_over (s, expand_alpha (s), vmask, d));
1563 mmx_composite_over_x888_n_8888 (pixman_implementation_t *imp,
1564 pixman_composite_info_t *info)
1566 PIXMAN_COMPOSITE_ARGS (info);
1567 uint32_t *dst_line, *dst;
1568 uint32_t *src_line, *src;
1571 int dst_stride, src_stride;
1577 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
1578 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
1579 mask = _pixman_image_get_solid (imp, mask_image, dest_image->bits.format);
1582 mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
1583 vmask = load8888 (&mask);
1589 dst_line += dst_stride;
1591 src_line += src_stride;
1594 while (w && (unsigned long)dst & 7)
1596 uint32_t ssrc = *src | 0xff000000;
1597 __m64 s = load8888 (&ssrc);
1598 __m64 d = load8888 (dst);
1600 store8888 (dst, in_over (s, srca, vmask, d));
1609 __m64 vd0 = *(__m64 *)(dst + 0);
1610 __m64 vd1 = *(__m64 *)(dst + 2);
1611 __m64 vd2 = *(__m64 *)(dst + 4);
1612 __m64 vd3 = *(__m64 *)(dst + 6);
1613 __m64 vd4 = *(__m64 *)(dst + 8);
1614 __m64 vd5 = *(__m64 *)(dst + 10);
1615 __m64 vd6 = *(__m64 *)(dst + 12);
1616 __m64 vd7 = *(__m64 *)(dst + 14);
1618 __m64 vs0 = ldq_u ((__m64 *)(src + 0));
1619 __m64 vs1 = ldq_u ((__m64 *)(src + 2));
1620 __m64 vs2 = ldq_u ((__m64 *)(src + 4));
1621 __m64 vs3 = ldq_u ((__m64 *)(src + 6));
1622 __m64 vs4 = ldq_u ((__m64 *)(src + 8));
1623 __m64 vs5 = ldq_u ((__m64 *)(src + 10));
1624 __m64 vs6 = ldq_u ((__m64 *)(src + 12));
1625 __m64 vs7 = ldq_u ((__m64 *)(src + 14));
1628 in_over (expandx888 (vs0, 0), srca, vmask, expand8888 (vd0, 0)),
1629 in_over (expandx888 (vs0, 1), srca, vmask, expand8888 (vd0, 1)));
1632 in_over (expandx888 (vs1, 0), srca, vmask, expand8888 (vd1, 0)),
1633 in_over (expandx888 (vs1, 1), srca, vmask, expand8888 (vd1, 1)));
1636 in_over (expandx888 (vs2, 0), srca, vmask, expand8888 (vd2, 0)),
1637 in_over (expandx888 (vs2, 1), srca, vmask, expand8888 (vd2, 1)));
1640 in_over (expandx888 (vs3, 0), srca, vmask, expand8888 (vd3, 0)),
1641 in_over (expandx888 (vs3, 1), srca, vmask, expand8888 (vd3, 1)));
1644 in_over (expandx888 (vs4, 0), srca, vmask, expand8888 (vd4, 0)),
1645 in_over (expandx888 (vs4, 1), srca, vmask, expand8888 (vd4, 1)));
1648 in_over (expandx888 (vs5, 0), srca, vmask, expand8888 (vd5, 0)),
1649 in_over (expandx888 (vs5, 1), srca, vmask, expand8888 (vd5, 1)));
1652 in_over (expandx888 (vs6, 0), srca, vmask, expand8888 (vd6, 0)),
1653 in_over (expandx888 (vs6, 1), srca, vmask, expand8888 (vd6, 1)));
1656 in_over (expandx888 (vs7, 0), srca, vmask, expand8888 (vd7, 0)),
1657 in_over (expandx888 (vs7, 1), srca, vmask, expand8888 (vd7, 1)));
1659 *(__m64 *)(dst + 0) = vd0;
1660 *(__m64 *)(dst + 2) = vd1;
1661 *(__m64 *)(dst + 4) = vd2;
1662 *(__m64 *)(dst + 6) = vd3;
1663 *(__m64 *)(dst + 8) = vd4;
1664 *(__m64 *)(dst + 10) = vd5;
1665 *(__m64 *)(dst + 12) = vd6;
1666 *(__m64 *)(dst + 14) = vd7;
1675 uint32_t ssrc = *src | 0xff000000;
1676 __m64 s = load8888 (&ssrc);
1677 __m64 d = load8888 (dst);
1679 store8888 (dst, in_over (s, srca, vmask, d));
1691 mmx_composite_over_8888_8888 (pixman_implementation_t *imp,
1692 pixman_composite_info_t *info)
1694 PIXMAN_COMPOSITE_ARGS (info);
1695 uint32_t *dst_line, *dst;
1696 uint32_t *src_line, *src;
1698 int dst_stride, src_stride;
1704 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
1705 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
1710 dst_line += dst_stride;
1712 src_line += src_stride;
1728 sa = expand_alpha (ms);
1729 store8888 (dst, over (ms, sa, load8888 (dst)));
1739 mmx_composite_over_8888_0565 (pixman_implementation_t *imp,
1740 pixman_composite_info_t *info)
1742 PIXMAN_COMPOSITE_ARGS (info);
1743 uint16_t *dst_line, *dst;
1744 uint32_t *src_line, *src;
1745 int dst_stride, src_stride;
1750 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
1751 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
1755 assert (src_image->drawable == mask_image->drawable);
1761 dst_line += dst_stride;
1763 src_line += src_stride;
1768 while (w && (unsigned long)dst & 7)
1770 __m64 vsrc = load8888 (src);
1772 __m64 vdest = expand565 (to_m64 (d), 0);
1775 over (vsrc, expand_alpha (vsrc), vdest), vdest, 0);
1777 *dst = to_uint64 (vdest);
1788 __m64 vsrc0, vsrc1, vsrc2, vsrc3;
1791 vsrc0 = load8888 ((src + 0));
1792 vsrc1 = load8888 ((src + 1));
1793 vsrc2 = load8888 ((src + 2));
1794 vsrc3 = load8888 ((src + 3));
1796 vdest = *(__m64 *)dst;
1798 vdest = pack_565 (over (vsrc0, expand_alpha (vsrc0), expand565 (vdest, 0)), vdest, 0);
1799 vdest = pack_565 (over (vsrc1, expand_alpha (vsrc1), expand565 (vdest, 1)), vdest, 1);
1800 vdest = pack_565 (over (vsrc2, expand_alpha (vsrc2), expand565 (vdest, 2)), vdest, 2);
1801 vdest = pack_565 (over (vsrc3, expand_alpha (vsrc3), expand565 (vdest, 3)), vdest, 3);
1803 *(__m64 *)dst = vdest;
1814 __m64 vsrc = load8888 (src);
1816 __m64 vdest = expand565 (to_m64 (d), 0);
1818 vdest = pack_565 (over (vsrc, expand_alpha (vsrc), vdest), vdest, 0);
1820 *dst = to_uint64 (vdest);
1832 mmx_composite_over_n_8_8888 (pixman_implementation_t *imp,
1833 pixman_composite_info_t *info)
1835 PIXMAN_COMPOSITE_ARGS (info);
1837 uint32_t *dst_line, *dst;
1838 uint8_t *mask_line, *mask;
1839 int dst_stride, mask_stride;
1846 src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
1852 srcsrc = (uint64_t)src << 32 | src;
1854 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
1855 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
1857 vsrc = load8888 (&src);
1858 vsrca = expand_alpha (vsrc);
1863 dst_line += dst_stride;
1865 mask_line += mask_stride;
1870 while (w && (unsigned long)dst & 7)
1876 __m64 vdest = in_over (vsrc, vsrca,
1877 expand_alpha_rev (to_m64 (m)),
1880 store8888 (dst, vdest);
1897 if (srca == 0xff && (m0 & m1) == 0xff)
1899 *(uint64_t *)dst = srcsrc;
1906 vdest = *(__m64 *)dst;
1908 dest0 = in_over (vsrc, vsrca, expand_alpha_rev (to_m64 (m0)),
1909 expand8888 (vdest, 0));
1910 dest1 = in_over (vsrc, vsrca, expand_alpha_rev (to_m64 (m1)),
1911 expand8888 (vdest, 1));
1913 *(__m64 *)dst = pack8888 (dest0, dest1);
1929 __m64 vdest = load8888 (dst);
1932 vsrc, vsrca, expand_alpha_rev (to_m64 (m)), vdest);
1933 store8888 (dst, vdest);
1942 pixman_fill_mmx (uint32_t *bits,
1953 uint32_t byte_width;
1956 #if defined __GNUC__ && defined USE_X86_MMX
1957 __m64 v1, v2, v3, v4, v5, v6, v7;
1960 if (bpp != 16 && bpp != 32 && bpp != 8)
1965 stride = stride * (int) sizeof (uint32_t) / 1;
1966 byte_line = (uint8_t *)(((uint8_t *)bits) + stride * y + x);
1969 xor = (xor & 0xff) * 0x01010101;
1973 stride = stride * (int) sizeof (uint32_t) / 2;
1974 byte_line = (uint8_t *)(((uint16_t *)bits) + stride * y + x);
1975 byte_width = 2 * width;
1977 xor = (xor & 0xffff) * 0x00010001;
1981 stride = stride * (int) sizeof (uint32_t) / 4;
1982 byte_line = (uint8_t *)(((uint32_t *)bits) + stride * y + x);
1983 byte_width = 4 * width;
1987 fill = ((uint64_t)xor << 32) | xor;
1988 vfill = to_m64 (fill);
1990 #if defined __GNUC__ && defined USE_X86_MMX
1999 : "=&y" (v1), "=&y" (v2), "=&y" (v3),
2000 "=&y" (v4), "=&y" (v5), "=&y" (v6), "=y" (v7)
2007 uint8_t *d = byte_line;
2009 byte_line += stride;
2012 if (w >= 1 && ((unsigned long)d & 1))
2014 *(uint8_t *)d = (xor & 0xff);
2019 if (w >= 2 && ((unsigned long)d & 3))
2021 *(uint16_t *)d = xor;
2026 while (w >= 4 && ((unsigned long)d & 7))
2028 *(uint32_t *)d = xor;
2036 #if defined __GNUC__ && defined USE_X86_MMX
2048 "y" (vfill), "y" (v1), "y" (v2), "y" (v3),
2049 "y" (v4), "y" (v5), "y" (v6), "y" (v7)
2052 *(__m64*) (d + 0) = vfill;
2053 *(__m64*) (d + 8) = vfill;
2054 *(__m64*) (d + 16) = vfill;
2055 *(__m64*) (d + 24) = vfill;
2056 *(__m64*) (d + 32) = vfill;
2057 *(__m64*) (d + 40) = vfill;
2058 *(__m64*) (d + 48) = vfill;
2059 *(__m64*) (d + 56) = vfill;
2067 *(uint32_t *)d = xor;
2074 *(uint16_t *)d = xor;
2080 *(uint8_t *)d = (xor & 0xff);
2092 mmx_composite_src_n_8_8888 (pixman_implementation_t *imp,
2093 pixman_composite_info_t *info)
2095 PIXMAN_COMPOSITE_ARGS (info);
2097 uint32_t *dst_line, *dst;
2098 uint8_t *mask_line, *mask;
2099 int dst_stride, mask_stride;
2106 src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
2111 pixman_fill_mmx (dest_image->bits.bits, dest_image->bits.rowstride,
2112 PIXMAN_FORMAT_BPP (dest_image->bits.format),
2113 dest_x, dest_y, width, height, 0);
2117 srcsrc = (uint64_t)src << 32 | src;
2119 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
2120 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
2122 vsrc = load8888 (&src);
2127 dst_line += dst_stride;
2129 mask_line += mask_stride;
2134 while (w && (unsigned long)dst & 7)
2140 __m64 vdest = in (vsrc, expand_alpha_rev (to_m64 (m)));
2142 store8888 (dst, vdest);
2162 if (srca == 0xff && (m0 & m1) == 0xff)
2164 *(uint64_t *)dst = srcsrc;
2170 dest0 = in (vsrc, expand_alpha_rev (to_m64 (m0)));
2171 dest1 = in (vsrc, expand_alpha_rev (to_m64 (m1)));
2173 *(__m64 *)dst = pack8888 (dest0, dest1);
2177 *(uint64_t *)dst = 0;
2193 __m64 vdest = load8888 (dst);
2195 vdest = in (vsrc, expand_alpha_rev (to_m64 (m)));
2196 store8888 (dst, vdest);
2209 mmx_composite_over_n_8_0565 (pixman_implementation_t *imp,
2210 pixman_composite_info_t *info)
2212 PIXMAN_COMPOSITE_ARGS (info);
2214 uint16_t *dst_line, *dst;
2215 uint8_t *mask_line, *mask;
2216 int dst_stride, mask_stride;
2218 __m64 vsrc, vsrca, tmp;
2223 src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
2229 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
2230 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
2232 vsrc = load8888 (&src);
2233 vsrca = expand_alpha (vsrc);
2235 tmp = pack_565 (vsrc, _mm_setzero_si64 (), 0);
2236 srcsrcsrcsrc = expand_alpha_rev (tmp);
2241 dst_line += dst_stride;
2243 mask_line += mask_stride;
2248 while (w && (unsigned long)dst & 7)
2255 __m64 vd = to_m64 (d);
2256 __m64 vdest = in_over (
2257 vsrc, vsrca, expand_alpha_rev (to_m64 (m)), expand565 (vd, 0));
2259 vd = pack_565 (vdest, _mm_setzero_si64 (), 0);
2260 *dst = to_uint64 (vd);
2272 uint64_t m0, m1, m2, m3;
2278 if (srca == 0xff && (m0 & m1 & m2 & m3) == 0xff)
2280 *(__m64 *)dst = srcsrcsrcsrc;
2282 else if (m0 | m1 | m2 | m3)
2285 __m64 vm0, vm1, vm2, vm3;
2287 vdest = *(__m64 *)dst;
2290 vdest = pack_565 (in_over (vsrc, vsrca, expand_alpha_rev (vm0),
2291 expand565 (vdest, 0)), vdest, 0);
2293 vdest = pack_565 (in_over (vsrc, vsrca, expand_alpha_rev (vm1),
2294 expand565 (vdest, 1)), vdest, 1);
2296 vdest = pack_565 (in_over (vsrc, vsrca, expand_alpha_rev (vm2),
2297 expand565 (vdest, 2)), vdest, 2);
2299 vdest = pack_565 (in_over (vsrc, vsrca, expand_alpha_rev (vm3),
2300 expand565 (vdest, 3)), vdest, 3);
2302 *(__m64 *)dst = vdest;
2319 __m64 vd = to_m64 (d);
2320 __m64 vdest = in_over (vsrc, vsrca, expand_alpha_rev (to_m64 (m)),
2322 vd = pack_565 (vdest, _mm_setzero_si64 (), 0);
2323 *dst = to_uint64 (vd);
2336 mmx_composite_over_pixbuf_0565 (pixman_implementation_t *imp,
2337 pixman_composite_info_t *info)
2339 PIXMAN_COMPOSITE_ARGS (info);
2340 uint16_t *dst_line, *dst;
2341 uint32_t *src_line, *src;
2342 int dst_stride, src_stride;
2347 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
2348 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
2352 assert (src_image->drawable == mask_image->drawable);
2358 dst_line += dst_stride;
2360 src_line += src_stride;
2365 while (w && (unsigned long)dst & 7)
2367 __m64 vsrc = load8888 (src);
2369 __m64 vdest = expand565 (to_m64 (d), 0);
2371 vdest = pack_565 (over_rev_non_pre (vsrc, vdest), vdest, 0);
2373 *dst = to_uint64 (vdest);
2384 uint32_t s0, s1, s2, s3;
2385 unsigned char a0, a1, a2, a3;
2397 if ((a0 & a1 & a2 & a3) == 0xFF)
2400 vdest = pack_565 (invert_colors (load8888 (&s0)), _mm_setzero_si64 (), 0);
2401 vdest = pack_565 (invert_colors (load8888 (&s1)), vdest, 1);
2402 vdest = pack_565 (invert_colors (load8888 (&s2)), vdest, 2);
2403 vdest = pack_565 (invert_colors (load8888 (&s3)), vdest, 3);
2405 *(__m64 *)dst = vdest;
2407 else if (s0 | s1 | s2 | s3)
2409 __m64 vdest = *(__m64 *)dst;
2411 vdest = pack_565 (over_rev_non_pre (load8888 (&s0), expand565 (vdest, 0)), vdest, 0);
2412 vdest = pack_565 (over_rev_non_pre (load8888 (&s1), expand565 (vdest, 1)), vdest, 1);
2413 vdest = pack_565 (over_rev_non_pre (load8888 (&s2), expand565 (vdest, 2)), vdest, 2);
2414 vdest = pack_565 (over_rev_non_pre (load8888 (&s3), expand565 (vdest, 3)), vdest, 3);
2416 *(__m64 *)dst = vdest;
2428 __m64 vsrc = load8888 (src);
2430 __m64 vdest = expand565 (to_m64 (d), 0);
2432 vdest = pack_565 (over_rev_non_pre (vsrc, vdest), vdest, 0);
2434 *dst = to_uint64 (vdest);
2446 mmx_composite_over_pixbuf_8888 (pixman_implementation_t *imp,
2447 pixman_composite_info_t *info)
2449 PIXMAN_COMPOSITE_ARGS (info);
2450 uint32_t *dst_line, *dst;
2451 uint32_t *src_line, *src;
2452 int dst_stride, src_stride;
2457 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
2458 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
2462 assert (src_image->drawable == mask_image->drawable);
2468 dst_line += dst_stride;
2470 src_line += src_stride;
2473 while (w && (unsigned long)dst & 7)
2475 __m64 s = load8888 (src);
2476 __m64 d = load8888 (dst);
2478 store8888 (dst, over_rev_non_pre (s, d));
2488 unsigned char a0, a1;
2497 if ((a0 & a1) == 0xFF)
2499 d0 = invert_colors (load8888 (&s0));
2500 d1 = invert_colors (load8888 (&s1));
2502 *(__m64 *)dst = pack8888 (d0, d1);
2506 __m64 vdest = *(__m64 *)dst;
2508 d0 = over_rev_non_pre (load8888 (&s0), expand8888 (vdest, 0));
2509 d1 = over_rev_non_pre (load8888 (&s1), expand8888 (vdest, 1));
2511 *(__m64 *)dst = pack8888 (d0, d1);
2521 __m64 s = load8888 (src);
2522 __m64 d = load8888 (dst);
2524 store8888 (dst, over_rev_non_pre (s, d));
2532 mmx_composite_over_n_8888_0565_ca (pixman_implementation_t *imp,
2533 pixman_composite_info_t *info)
2535 PIXMAN_COMPOSITE_ARGS (info);
2538 uint32_t *mask_line;
2539 int dst_stride, mask_stride;
2544 src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
2549 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
2550 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint32_t, mask_stride, mask_line, 1);
2552 vsrc = load8888 (&src);
2553 vsrca = expand_alpha (vsrc);
2558 uint32_t *p = (uint32_t *)mask_line;
2559 uint16_t *q = (uint16_t *)dst_line;
2561 while (twidth && ((unsigned long)q & 7))
2563 uint32_t m = *(uint32_t *)p;
2568 __m64 vdest = expand565 (to_m64 (d), 0);
2569 vdest = pack_565 (in_over (vsrc, vsrca, load8888 (&m), vdest), vdest, 0);
2570 *q = to_uint64 (vdest);
2580 uint32_t m0, m1, m2, m3;
2587 if ((m0 | m1 | m2 | m3))
2589 __m64 vdest = *(__m64 *)q;
2591 vdest = pack_565 (in_over (vsrc, vsrca, load8888 (&m0), expand565 (vdest, 0)), vdest, 0);
2592 vdest = pack_565 (in_over (vsrc, vsrca, load8888 (&m1), expand565 (vdest, 1)), vdest, 1);
2593 vdest = pack_565 (in_over (vsrc, vsrca, load8888 (&m2), expand565 (vdest, 2)), vdest, 2);
2594 vdest = pack_565 (in_over (vsrc, vsrca, load8888 (&m3), expand565 (vdest, 3)), vdest, 3);
2596 *(__m64 *)q = vdest;
2611 __m64 vdest = expand565 (to_m64 (d), 0);
2612 vdest = pack_565 (in_over (vsrc, vsrca, load8888 (&m), vdest), vdest, 0);
2613 *q = to_uint64 (vdest);
2621 mask_line += mask_stride;
2622 dst_line += dst_stride;
2629 mmx_composite_in_n_8_8 (pixman_implementation_t *imp,
2630 pixman_composite_info_t *info)
2632 PIXMAN_COMPOSITE_ARGS (info);
2633 uint8_t *dst_line, *dst;
2634 uint8_t *mask_line, *mask;
2635 int dst_stride, mask_stride;
2641 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
2642 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
2644 src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
2648 vsrc = load8888 (&src);
2649 vsrca = expand_alpha (vsrc);
2654 dst_line += dst_stride;
2656 mask_line += mask_stride;
2659 while (w && (unsigned long)dst & 7)
2668 m = MUL_UN8 (sa, a, tmp);
2669 d = MUL_UN8 (m, d, tmp);
2680 vmask = load8888u ((uint32_t *)mask);
2681 vdest = load8888 ((uint32_t *)dst);
2683 store8888 ((uint32_t *)dst, in (in (vsrca, vmask), vdest));
2699 m = MUL_UN8 (sa, a, tmp);
2700 d = MUL_UN8 (m, d, tmp);
2710 mmx_composite_in_8_8 (pixman_implementation_t *imp,
2711 pixman_composite_info_t *info)
2713 PIXMAN_COMPOSITE_ARGS (info);
2714 uint8_t *dst_line, *dst;
2715 uint8_t *src_line, *src;
2716 int src_stride, dst_stride;
2719 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
2720 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint8_t, src_stride, src_line, 1);
2725 dst_line += dst_stride;
2727 src_line += src_stride;
2730 while (w && (unsigned long)dst & 3)
2738 *dst = MUL_UN8 (s, d, tmp);
2747 uint32_t *s = (uint32_t *)src;
2748 uint32_t *d = (uint32_t *)dst;
2750 store8888 (d, in (load8888u (s), load8888 (d)));
2765 *dst = MUL_UN8 (s, d, tmp);
2776 mmx_composite_add_n_8_8 (pixman_implementation_t *imp,
2777 pixman_composite_info_t *info)
2779 PIXMAN_COMPOSITE_ARGS (info);
2780 uint8_t *dst_line, *dst;
2781 uint8_t *mask_line, *mask;
2782 int dst_stride, mask_stride;
2788 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
2789 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
2791 src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
2798 vsrc = load8888 (&src);
2799 vsrca = expand_alpha (vsrc);
2804 dst_line += dst_stride;
2806 mask_line += mask_stride;
2809 while (w && (unsigned long)dst & 3)
2819 m = MUL_UN8 (sa, a, tmp);
2820 r = ADD_UN8 (m, d, tmp);
2831 vmask = load8888u ((uint32_t *)mask);
2832 vdest = load8888 ((uint32_t *)dst);
2834 store8888 ((uint32_t *)dst, _mm_adds_pu8 (in (vsrca, vmask), vdest));
2851 m = MUL_UN8 (sa, a, tmp);
2852 r = ADD_UN8 (m, d, tmp);
2862 mmx_composite_add_8_8 (pixman_implementation_t *imp,
2863 pixman_composite_info_t *info)
2865 PIXMAN_COMPOSITE_ARGS (info);
2866 uint8_t *dst_line, *dst;
2867 uint8_t *src_line, *src;
2868 int dst_stride, src_stride;
2875 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint8_t, src_stride, src_line, 1);
2876 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
2881 dst_line += dst_stride;
2883 src_line += src_stride;
2886 while (w && (unsigned long)dst & 7)
2891 s = t | (0 - (t >> 8));
2901 *(__m64*)dst = _mm_adds_pu8 (ldq_u ((__m64 *)src), *(__m64*)dst);
2912 s = t | (0 - (t >> 8));
2925 mmx_composite_add_8888_8888 (pixman_implementation_t *imp,
2926 pixman_composite_info_t *info)
2928 PIXMAN_COMPOSITE_ARGS (info);
2929 uint32_t *dst_line, *dst;
2930 uint32_t *src_line, *src;
2931 int dst_stride, src_stride;
2936 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
2937 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
2942 dst_line += dst_stride;
2944 src_line += src_stride;
2947 while (w && (unsigned long)dst & 7)
2949 store (dst, _mm_adds_pu8 (load ((const uint32_t *)src),
2950 load ((const uint32_t *)dst)));
2958 *(__m64 *)dst = _mm_adds_pu8 (ldq_u ((__m64 *)src), *(__m64*)dst);
2966 store (dst, _mm_adds_pu8 (load ((const uint32_t *)src),
2967 load ((const uint32_t *)dst)));
2975 static pixman_bool_t
2976 pixman_blt_mmx (uint32_t *src_bits,
2989 uint8_t * src_bytes;
2990 uint8_t * dst_bytes;
2993 if (src_bpp != dst_bpp)
2998 src_stride = src_stride * (int) sizeof (uint32_t) / 2;
2999 dst_stride = dst_stride * (int) sizeof (uint32_t) / 2;
3000 src_bytes = (uint8_t *)(((uint16_t *)src_bits) + src_stride * (src_y) + (src_x));
3001 dst_bytes = (uint8_t *)(((uint16_t *)dst_bits) + dst_stride * (dest_y) + (dest_x));
3002 byte_width = 2 * width;
3006 else if (src_bpp == 32)
3008 src_stride = src_stride * (int) sizeof (uint32_t) / 4;
3009 dst_stride = dst_stride * (int) sizeof (uint32_t) / 4;
3010 src_bytes = (uint8_t *)(((uint32_t *)src_bits) + src_stride * (src_y) + (src_x));
3011 dst_bytes = (uint8_t *)(((uint32_t *)dst_bits) + dst_stride * (dest_y) + (dest_x));
3012 byte_width = 4 * width;
3024 uint8_t *s = src_bytes;
3025 uint8_t *d = dst_bytes;
3026 src_bytes += src_stride;
3027 dst_bytes += dst_stride;
3030 if (w >= 1 && ((unsigned long)d & 1))
3032 *(uint8_t *)d = *(uint8_t *)s;
3038 if (w >= 2 && ((unsigned long)d & 3))
3040 *(uint16_t *)d = *(uint16_t *)s;
3046 while (w >= 4 && ((unsigned long)d & 7))
3048 *(uint32_t *)d = ldl_u ((uint32_t *)s);
3057 #if (defined (__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined USE_X86_MMX
3059 "movq (%1), %%mm0\n"
3060 "movq 8(%1), %%mm1\n"
3061 "movq 16(%1), %%mm2\n"
3062 "movq 24(%1), %%mm3\n"
3063 "movq 32(%1), %%mm4\n"
3064 "movq 40(%1), %%mm5\n"
3065 "movq 48(%1), %%mm6\n"
3066 "movq 56(%1), %%mm7\n"
3068 "movq %%mm0, (%0)\n"
3069 "movq %%mm1, 8(%0)\n"
3070 "movq %%mm2, 16(%0)\n"
3071 "movq %%mm3, 24(%0)\n"
3072 "movq %%mm4, 32(%0)\n"
3073 "movq %%mm5, 40(%0)\n"
3074 "movq %%mm6, 48(%0)\n"
3075 "movq %%mm7, 56(%0)\n"
3079 "%mm0", "%mm1", "%mm2", "%mm3",
3080 "%mm4", "%mm5", "%mm6", "%mm7");
3082 __m64 v0 = ldq_u ((__m64 *)(s + 0));
3083 __m64 v1 = ldq_u ((__m64 *)(s + 8));
3084 __m64 v2 = ldq_u ((__m64 *)(s + 16));
3085 __m64 v3 = ldq_u ((__m64 *)(s + 24));
3086 __m64 v4 = ldq_u ((__m64 *)(s + 32));
3087 __m64 v5 = ldq_u ((__m64 *)(s + 40));
3088 __m64 v6 = ldq_u ((__m64 *)(s + 48));
3089 __m64 v7 = ldq_u ((__m64 *)(s + 56));
3090 *(__m64 *)(d + 0) = v0;
3091 *(__m64 *)(d + 8) = v1;
3092 *(__m64 *)(d + 16) = v2;
3093 *(__m64 *)(d + 24) = v3;
3094 *(__m64 *)(d + 32) = v4;
3095 *(__m64 *)(d + 40) = v5;
3096 *(__m64 *)(d + 48) = v6;
3097 *(__m64 *)(d + 56) = v7;
3106 *(uint32_t *)d = ldl_u ((uint32_t *)s);
3114 *(uint16_t *)d = *(uint16_t *)s;
3127 mmx_composite_copy_area (pixman_implementation_t *imp,
3128 pixman_composite_info_t *info)
3130 PIXMAN_COMPOSITE_ARGS (info);
3132 pixman_blt_mmx (src_image->bits.bits,
3133 dest_image->bits.bits,
3134 src_image->bits.rowstride,
3135 dest_image->bits.rowstride,
3136 PIXMAN_FORMAT_BPP (src_image->bits.format),
3137 PIXMAN_FORMAT_BPP (dest_image->bits.format),
3138 src_x, src_y, dest_x, dest_y, width, height);
3142 mmx_composite_over_x888_8_8888 (pixman_implementation_t *imp,
3143 pixman_composite_info_t *info)
3145 PIXMAN_COMPOSITE_ARGS (info);
3146 uint32_t *src, *src_line;
3147 uint32_t *dst, *dst_line;
3148 uint8_t *mask, *mask_line;
3149 int src_stride, mask_stride, dst_stride;
3152 PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
3153 PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
3154 PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
3159 src_line += src_stride;
3161 dst_line += dst_stride;
3163 mask_line += mask_stride;
3173 uint32_t ssrc = *src | 0xff000000;
3174 __m64 s = load8888 (&ssrc);
3182 __m64 sa = expand_alpha (s);
3183 __m64 vm = expand_alpha_rev (to_m64 (m));
3184 __m64 vdest = in_over (s, sa, vm, load8888 (dst));
3186 store8888 (dst, vdest);
3199 static const pixman_fast_path_t mmx_fast_paths[] =
3201 PIXMAN_STD_FAST_PATH (OVER, solid, a8, r5g6b5, mmx_composite_over_n_8_0565 ),
3202 PIXMAN_STD_FAST_PATH (OVER, solid, a8, b5g6r5, mmx_composite_over_n_8_0565 ),
3203 PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8r8g8b8, mmx_composite_over_n_8_8888 ),
3204 PIXMAN_STD_FAST_PATH (OVER, solid, a8, x8r8g8b8, mmx_composite_over_n_8_8888 ),
3205 PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8b8g8r8, mmx_composite_over_n_8_8888 ),
3206 PIXMAN_STD_FAST_PATH (OVER, solid, a8, x8b8g8r8, mmx_composite_over_n_8_8888 ),
3207 PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8r8g8b8, a8r8g8b8, mmx_composite_over_n_8888_8888_ca ),
3208 PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8r8g8b8, x8r8g8b8, mmx_composite_over_n_8888_8888_ca ),
3209 PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8r8g8b8, r5g6b5, mmx_composite_over_n_8888_0565_ca ),
3210 PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, a8b8g8r8, mmx_composite_over_n_8888_8888_ca ),
3211 PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, x8b8g8r8, mmx_composite_over_n_8888_8888_ca ),
3212 PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, b5g6r5, mmx_composite_over_n_8888_0565_ca ),
3213 PIXMAN_STD_FAST_PATH (OVER, pixbuf, pixbuf, a8r8g8b8, mmx_composite_over_pixbuf_8888 ),
3214 PIXMAN_STD_FAST_PATH (OVER, pixbuf, pixbuf, x8r8g8b8, mmx_composite_over_pixbuf_8888 ),
3215 PIXMAN_STD_FAST_PATH (OVER, pixbuf, pixbuf, r5g6b5, mmx_composite_over_pixbuf_0565 ),
3216 PIXMAN_STD_FAST_PATH (OVER, rpixbuf, rpixbuf, a8b8g8r8, mmx_composite_over_pixbuf_8888 ),
3217 PIXMAN_STD_FAST_PATH (OVER, rpixbuf, rpixbuf, x8b8g8r8, mmx_composite_over_pixbuf_8888 ),
3218 PIXMAN_STD_FAST_PATH (OVER, rpixbuf, rpixbuf, b5g6r5, mmx_composite_over_pixbuf_0565 ),
3219 PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, solid, a8r8g8b8, mmx_composite_over_x888_n_8888 ),
3220 PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, solid, x8r8g8b8, mmx_composite_over_x888_n_8888 ),
3221 PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, solid, a8b8g8r8, mmx_composite_over_x888_n_8888 ),
3222 PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, solid, x8b8g8r8, mmx_composite_over_x888_n_8888 ),
3223 PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid, a8r8g8b8, mmx_composite_over_8888_n_8888 ),
3224 PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid, x8r8g8b8, mmx_composite_over_8888_n_8888 ),
3225 PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid, a8b8g8r8, mmx_composite_over_8888_n_8888 ),
3226 PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid, x8b8g8r8, mmx_composite_over_8888_n_8888 ),
3227 PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, a8, x8r8g8b8, mmx_composite_over_x888_8_8888 ),
3228 PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, a8, a8r8g8b8, mmx_composite_over_x888_8_8888 ),
3229 PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, a8, x8b8g8r8, mmx_composite_over_x888_8_8888 ),
3230 PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, a8, a8b8g8r8, mmx_composite_over_x888_8_8888 ),
3231 PIXMAN_STD_FAST_PATH (OVER, solid, null, a8r8g8b8, mmx_composite_over_n_8888 ),
3232 PIXMAN_STD_FAST_PATH (OVER, solid, null, x8r8g8b8, mmx_composite_over_n_8888 ),
3233 PIXMAN_STD_FAST_PATH (OVER, solid, null, r5g6b5, mmx_composite_over_n_0565 ),
3234 PIXMAN_STD_FAST_PATH (OVER, solid, null, b5g6r5, mmx_composite_over_n_0565 ),
3235 PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, null, x8r8g8b8, mmx_composite_copy_area ),
3236 PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, null, x8b8g8r8, mmx_composite_copy_area ),
3238 PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, a8r8g8b8, mmx_composite_over_8888_8888 ),
3239 PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, x8r8g8b8, mmx_composite_over_8888_8888 ),
3240 PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, r5g6b5, mmx_composite_over_8888_0565 ),
3241 PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, a8b8g8r8, mmx_composite_over_8888_8888 ),
3242 PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, x8b8g8r8, mmx_composite_over_8888_8888 ),
3243 PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, b5g6r5, mmx_composite_over_8888_0565 ),
3245 PIXMAN_STD_FAST_PATH (ADD, a8r8g8b8, null, a8r8g8b8, mmx_composite_add_8888_8888 ),
3246 PIXMAN_STD_FAST_PATH (ADD, a8b8g8r8, null, a8b8g8r8, mmx_composite_add_8888_8888 ),
3247 PIXMAN_STD_FAST_PATH (ADD, a8, null, a8, mmx_composite_add_8_8 ),
3248 PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8, mmx_composite_add_n_8_8 ),
3250 PIXMAN_STD_FAST_PATH (SRC, solid, a8, a8r8g8b8, mmx_composite_src_n_8_8888 ),
3251 PIXMAN_STD_FAST_PATH (SRC, solid, a8, x8r8g8b8, mmx_composite_src_n_8_8888 ),
3252 PIXMAN_STD_FAST_PATH (SRC, solid, a8, a8b8g8r8, mmx_composite_src_n_8_8888 ),
3253 PIXMAN_STD_FAST_PATH (SRC, solid, a8, x8b8g8r8, mmx_composite_src_n_8_8888 ),
3254 PIXMAN_STD_FAST_PATH (SRC, a8r8g8b8, null, a8r8g8b8, mmx_composite_copy_area ),
3255 PIXMAN_STD_FAST_PATH (SRC, a8b8g8r8, null, a8b8g8r8, mmx_composite_copy_area ),
3256 PIXMAN_STD_FAST_PATH (SRC, a8r8g8b8, null, x8r8g8b8, mmx_composite_copy_area ),
3257 PIXMAN_STD_FAST_PATH (SRC, a8b8g8r8, null, x8b8g8r8, mmx_composite_copy_area ),
3258 PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, x8r8g8b8, mmx_composite_copy_area ),
3259 PIXMAN_STD_FAST_PATH (SRC, x8b8g8r8, null, x8b8g8r8, mmx_composite_copy_area ),
3260 PIXMAN_STD_FAST_PATH (SRC, r5g6b5, null, r5g6b5, mmx_composite_copy_area ),
3261 PIXMAN_STD_FAST_PATH (SRC, b5g6r5, null, b5g6r5, mmx_composite_copy_area ),
3263 PIXMAN_STD_FAST_PATH (IN, a8, null, a8, mmx_composite_in_8_8 ),
3264 PIXMAN_STD_FAST_PATH (IN, solid, a8, a8, mmx_composite_in_n_8_8 ),
3269 static pixman_bool_t
3270 mmx_blt (pixman_implementation_t *imp,
3271 uint32_t * src_bits,
3272 uint32_t * dst_bits,
3284 if (!pixman_blt_mmx (
3285 src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
3286 src_x, src_y, dest_x, dest_y, width, height))
3289 return _pixman_implementation_blt (
3291 src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
3292 src_x, src_y, dest_x, dest_y, width, height);
3298 static pixman_bool_t
3299 mmx_fill (pixman_implementation_t *imp,
3309 if (!pixman_fill_mmx (bits, stride, bpp, x, y, width, height, xor))
3311 return _pixman_implementation_fill (
3312 imp->delegate, bits, stride, bpp, x, y, width, height, xor);
3318 pixman_implementation_t *
3319 _pixman_implementation_create_mmx (pixman_implementation_t *fallback)
3321 pixman_implementation_t *imp = _pixman_implementation_create (fallback, mmx_fast_paths);
3323 imp->combine_32[PIXMAN_OP_OVER] = mmx_combine_over_u;
3324 imp->combine_32[PIXMAN_OP_OVER_REVERSE] = mmx_combine_over_reverse_u;
3325 imp->combine_32[PIXMAN_OP_IN] = mmx_combine_in_u;
3326 imp->combine_32[PIXMAN_OP_IN_REVERSE] = mmx_combine_in_reverse_u;
3327 imp->combine_32[PIXMAN_OP_OUT] = mmx_combine_out_u;
3328 imp->combine_32[PIXMAN_OP_OUT_REVERSE] = mmx_combine_out_reverse_u;
3329 imp->combine_32[PIXMAN_OP_ATOP] = mmx_combine_atop_u;
3330 imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = mmx_combine_atop_reverse_u;
3331 imp->combine_32[PIXMAN_OP_XOR] = mmx_combine_xor_u;
3332 imp->combine_32[PIXMAN_OP_ADD] = mmx_combine_add_u;
3333 imp->combine_32[PIXMAN_OP_SATURATE] = mmx_combine_saturate_u;
3335 imp->combine_32_ca[PIXMAN_OP_SRC] = mmx_combine_src_ca;
3336 imp->combine_32_ca[PIXMAN_OP_OVER] = mmx_combine_over_ca;
3337 imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = mmx_combine_over_reverse_ca;
3338 imp->combine_32_ca[PIXMAN_OP_IN] = mmx_combine_in_ca;
3339 imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = mmx_combine_in_reverse_ca;
3340 imp->combine_32_ca[PIXMAN_OP_OUT] = mmx_combine_out_ca;
3341 imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = mmx_combine_out_reverse_ca;
3342 imp->combine_32_ca[PIXMAN_OP_ATOP] = mmx_combine_atop_ca;
3343 imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = mmx_combine_atop_reverse_ca;
3344 imp->combine_32_ca[PIXMAN_OP_XOR] = mmx_combine_xor_ca;
3345 imp->combine_32_ca[PIXMAN_OP_ADD] = mmx_combine_add_ca;
3348 imp->fill = mmx_fill;
3353 #endif /* USE_X86_MMX || USE_ARM_IWMMXT || USE_LOONGSON_MMI */