Mercurial > sdl-ios-xcode
annotate src/video/SDL_blit_copy.c @ 2247:93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Prepping for using MMX and SSE intrinsics instead of inline assembly.
.. except for memcpy equivalents which only get faster if they can
exploit the parallelism of loading into multiple SIMD registers. :)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 15 Aug 2007 08:21:10 +0000 |
parents | |
children | 5cd2a2293cf0 |
rev | line source |
---|---|
2247
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #include "SDL_video.h" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 #include "SDL_blit.h" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 /* The MMX/SSE intrinsics don't give access to specific registers for |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 the most memory parallelism, so we'll use GCC inline assembly here... |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 */ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 #ifndef __GNUC__ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 #undef __MMX__ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 #undef __SSE__ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 #endif |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 #ifdef __MMX__ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 static __inline__ void |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 SDL_memcpyMMX(Uint8 *dst, const Uint8 *src, int len) |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 int i; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 for (i = len / 64; i--;) { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 __asm__ __volatile__ ( |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 "prefetchnta (%0)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 "movq (%0), %%mm0\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 "movq 8(%0), %%mm1\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 "movq 16(%0), %%mm2\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 "movq 24(%0), %%mm3\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 "movq 32(%0), %%mm4\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 "movq 40(%0), %%mm5\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 "movq 48(%0), %%mm6\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 "movq 56(%0), %%mm7\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 "movntq %%mm0, (%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 "movntq %%mm1, 8(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 "movntq %%mm2, 16(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 "movntq %%mm3, 24(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 "movntq %%mm4, 32(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 "movntq %%mm5, 40(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 "movntq %%mm6, 48(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 "movntq %%mm7, 56(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 :: "r" (src), "r" (dst) : "memory"); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 src += 64; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 dst += 64; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 if (len & 63) |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 SDL_memcpy(dst, src, len & 63); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 #endif /* __MMX__ */ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 #ifdef __SSE__ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 static __inline__ void |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 SDL_memcpySSE(Uint8 *dst, const Uint8 *src, int len) |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 int i; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 for (i = len / 64; i--;) { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 __asm__ __volatile__ ( |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 "prefetchnta (%0)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 "movaps (%0), %%xmm0\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 "movaps 16(%0), %%xmm1\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 "movaps 32(%0), %%xmm2\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 "movaps 48(%0), %%xmm3\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 "movntps %%xmm0, (%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 "movntps %%xmm1, 16(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 "movntps %%xmm2, 32(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 "movntps %%xmm3, 48(%1)\n" |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 :: "r" (src), "r" (dst) : "memory"); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 src += 64; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 dst += 64; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 if (len & 63) |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 SDL_memcpy(dst, src, len & 63); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 #endif /* __SSE__ */ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 void |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 SDL_BlitCopy(SDL_BlitInfo * info) |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 Uint8 *src, *dst; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 int w, h; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 int srcskip, dstskip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 w = info->d_width * info->dst->BytesPerPixel; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 h = info->d_height; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 src = info->s_pixels; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 dst = info->d_pixels; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 srcskip = w + info->s_skip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 dstskip = w + info->d_skip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 #ifdef __SSE__ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 if (SDL_HasSSE() && !((uintptr_t)src & 15) && !((uintptr_t)dst & 15)) { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 while (h--) { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 SDL_memcpySSE(dst, src, w); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 src += srcskip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 dst += dstskip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 return; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 #endif |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 #ifdef __MMX__ |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 if (SDL_HasMMX() && !((uintptr_t)src & 7) && !((uintptr_t)dst & 7)) { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 while (h--) { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 SDL_memcpyMMX(dst, src, w); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 src += srcskip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 dst += dstskip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 __asm__ __volatile__(" emms\n"::); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 return; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 #endif |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 while (h--) { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 SDL_memcpy(dst, src, w); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 src += srcskip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 dst += dstskip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 void |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 SDL_BlitCopyOverlap(SDL_BlitInfo * info) |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 Uint8 *src, *dst; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 int w, h; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 int skip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 w = info->d_width * info->dst->BytesPerPixel; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 h = info->d_height; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 src = info->s_pixels; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 dst = info->d_pixels; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 skip = w + info->s_skip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 if ((dst < src) || (dst >= (src + h*skip))) { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 SDL_BlitCopy(info); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 } else { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 src += ((h - 1) * skip); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 dst += ((h - 1) * skip); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 while (h--) { |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 SDL_revcpy(dst, src, w); |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 src -= skip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 dst -= skip; |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 } |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 |
93994f65c74c
Removed hermes since it's LGPL and not compatible with a commercial license.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 /* vi: set ts=4 sw=4 expandtab: */ |