Mercurial > sdl-ios-xcode
comparison src/video/SDL_RLEaccel.c @ 880:9ef41050100c
Date: Tue, 30 Mar 2004 21:26:47 -0600
From: Tyler Montbriand
Subject: [SDL] Opteron MMX patches for SDL_blit.c and SDL_blit_A.c
The inline MMX assembly in SDL_blit.c and SDL_blit_A.c compiles and runs fine
unmodified under AMD Opteron. The inline assembly in SDL_yuv_mmx.c and
SDL_blit_N.c unfortunately isn't directly compatible.
I've included diffs from SDL_blit.c and SDL_blit_A.c that allow the MMX
assembly to be compiled when USE_ASMBLIT, __x86_64__, and __GNUC__ are all
defined. All I had to modify was typedefs, the inline assembly itself wasn't
touched.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 11 Apr 2004 19:47:28 +0000 |
parents | 2bacec7930b1 |
children | cdea7cbc3e23 |
comparison
equal
deleted
inserted
replaced
879:2bacec7930b1 | 880:9ef41050100c |
---|---|
100 #include "SDL_sysvideo.h" | 100 #include "SDL_sysvideo.h" |
101 #include "SDL_blit.h" | 101 #include "SDL_blit.h" |
102 #include "SDL_memops.h" | 102 #include "SDL_memops.h" |
103 #include "SDL_RLEaccel_c.h" | 103 #include "SDL_RLEaccel_c.h" |
104 | 104 |
105 #if defined(i386) || defined(__x86_64__) | 105 #if (defined(i386) || defined(__x86_64__)) && defined(__GNUC__) && defined(USE_ASMBLIT) |
106 #define MMX_CAPABLE | 106 #define MMX_ASMBLIT |
107 #endif | 107 #endif |
108 | 108 |
109 #if defined(MMX_CAPABLE) && defined(__GNUC__) && defined(USE_ASMBLIT) | 109 #ifdef MMX_ASMBLIT |
110 #include "mmx.h" | 110 #include "mmx.h" |
111 #include "SDL_cpuinfo.h" | 111 #include "SDL_cpuinfo.h" |
112 #endif | 112 #endif |
113 | 113 |
114 #ifndef MAX | 114 #ifndef MAX |
132 */ | 132 */ |
133 | 133 |
134 #define OPAQUE_BLIT(to, from, length, bpp, alpha) \ | 134 #define OPAQUE_BLIT(to, from, length, bpp, alpha) \ |
135 PIXEL_COPY(to, from, length, bpp) | 135 PIXEL_COPY(to, from, length, bpp) |
136 | 136 |
137 #if defined(MMX_CAPABLE) && defined(__GNUC__) && defined(USE_ASMBLIT) | 137 #ifdef MMX_ASMBLIT |
138 | 138 |
139 #define ALPHA_BLIT32_888MMX(to, from, length, bpp, alpha) \ | 139 #define ALPHA_BLIT32_888MMX(to, from, length, bpp, alpha) \ |
140 do { \ | 140 do { \ |
141 Uint32 *srcp = (Uint32 *)(from); \ | 141 Uint32 *srcp = (Uint32 *)(from); \ |
142 Uint32 *dstp = (Uint32 *)(to); \ | 142 Uint32 *dstp = (Uint32 *)(to); \ |
513 src += bpp; \ | 513 src += bpp; \ |
514 dst += bpp; \ | 514 dst += bpp; \ |
515 } \ | 515 } \ |
516 } while(0) | 516 } while(0) |
517 | 517 |
518 #if defined(MMX_CAPABLE) && defined(__GNUC__) && defined(USE_ASMBLIT) | 518 #ifdef MMX_ASMBLIT |
519 | 519 |
520 #define ALPHA_BLIT32_888_50MMX(to, from, length, bpp, alpha) \ | 520 #define ALPHA_BLIT32_888_50MMX(to, from, length, bpp, alpha) \ |
521 do { \ | 521 do { \ |
522 Uint32 *srcp = (Uint32 *)(from); \ | 522 Uint32 *srcp = (Uint32 *)(from); \ |
523 Uint32 *dstp = (Uint32 *)(to); \ | 523 Uint32 *dstp = (Uint32 *)(to); \ |
626 ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xf7de) | 626 ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xf7de) |
627 | 627 |
628 #define ALPHA_BLIT16_555_50(to, from, length, bpp, alpha) \ | 628 #define ALPHA_BLIT16_555_50(to, from, length, bpp, alpha) \ |
629 ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xfbde) | 629 ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xfbde) |
630 | 630 |
631 #if defined(MMX_CAPABLE) && defined(__GNUC__) && defined(USE_ASMBLIT) | 631 #ifdef MMX_ASMBLIT |
632 | 632 |
633 #define CHOOSE_BLIT(blitter, alpha, fmt) \ | 633 #define CHOOSE_BLIT(blitter, alpha, fmt) \ |
634 do { \ | 634 do { \ |
635 if(alpha == 255) { \ | 635 if(alpha == 255) { \ |
636 switch(fmt->BytesPerPixel) { \ | 636 switch(fmt->BytesPerPixel) { \ |