[MPlayer-dev-eng] [PATCH] pic working with x86
Chris White
chriswhite at gentoo.org
Fri Mar 25 06:25:12 CET 2005
Ok, here's a rather long patch I made against -pre6 to get pic working
with MPlayer under gentoo. Please note that 3dnow, 3dnowex, mmx, and
mmx2 extensions were disabled to get pic working. That means the user
has to manually do that, or logic can be built into configure to
accomidate this. Haven't got that far yet. Also, since our libtool
works with __PIC__ instead of PIC with regards to defines. I'm not sure
if that's specific or not, but I did a sed-ing like so:
sed -i -e 's/#if\(\(.*def *\)\|\(.*defined *\)\)PIC/#if\1__PIC__/' \
libavcodec/i386/dsputil_mmx{.c,_rnd.h} \
libavcodec/msmpeg4.c \
libavcodec/libpostproc/mangle.h \
libavcodec/common.h \
to create the "patch". I'm not sure if you'd rather have -DPIC as an
alternative. So then.. on to the fun.
I've pasted the patch inline so I can comment on what's being done.
Comments are indicated by ###'s for readability. The uncommented patch
exists here:
http://dev.gentoo.org/~chriswhite/mplayer-1.0_pre6-pic.patch
Ok, so let's start with liba52 here:
### First off, I made a lot of the 3dnow stuff conditional (as 3dnow
stuff doesn't like x86+PIC and clobbers the ebx register..)
diff -ur MPlayer-1.0pre6a_old/liba52/imdct.c MPlayer-1.0pre6a/liba52/imdct.c
--- MPlayer-1.0pre6a_old/liba52/imdct.c 2004-04-27 04:47:50.000000000
+0900
+++ MPlayer-1.0pre6a/liba52/imdct.c 2005-03-21 15:55:39.036875280 +0900
@@ -744,19 +744,18 @@
// Stuff below this line is borrowed from libac3
#include "srfftp.h"
#ifdef ARCH_X86
-#ifndef HAVE_3DNOW
-#define HAVE_3DNOW 1
-#endif
-#include "srfftp_3dnow.h"
+#ifdef HAVE_3DNOW
+
+#include "srfftp_3dnow.h"
const i_cmplx_t x_plus_minus_3dnow __attribute__ ((aligned (8))) = {{
0x00000000UL, 0x80000000UL }};
const i_cmplx_t x_minus_plus_3dnow __attribute__ ((aligned (8))) = {{
0x80000000UL, 0x00000000UL }};
const complex_t HSQRT2_3DNOW __attribute__ ((aligned (8))) = {
0.707106781188, 0.707106781188 };
+#endif
-#undef HAVE_3DNOWEX
-#include "imdct_3dnow.h"
-#define HAVE_3DNOWEX
+#ifdef HAVE_3DNOW
#include "imdct_3dnow.h"
+#endif
void
imdct_do_512_sse(sample_t data[],sample_t delay[], sample_t bias)
### I tried to get the imdct_do_512_sse function to play nice with pic
(as sse and pic aren't THAT bad..) but it didn't seem to want to, so I
### conditioned it off.
@@ -1303,24 +1302,26 @@
imdct_512 = imdct_do_512;
#ifdef ARCH_X86
+#if defined(HAVE_SSE) && !defined(__PIC__)
if(mm_accel & MM_ACCEL_X86_SSE)
{
fprintf (stderr, "Using SSE optimized IMDCT transform\n");
imdct_512 = imdct_do_512_sse;
}
- else
+#elif defined(HAVE_3DNOWEXT)
if(mm_accel & MM_ACCEL_X86_3DNOWEXT)
{
fprintf (stderr, "Using 3DNowEx optimized IMDCT transform\n");
imdct_512 = imdct_do_512_3dnowex;
}
- else
+#elif defined(HAVE_3DNOW)
if(mm_accel & MM_ACCEL_X86_3DNOW)
{
fprintf (stderr, "Using 3DNow optimized IMDCT transform\n");
imdct_512 = imdct_do_512_3dnow;
}
else
+#endif
#endif // arch_x86
#ifdef HAVE_ALTIVEC
if (mm_accel & MM_ACCEL_PPC_ALTIVEC)
### Too many things that had weird conditional logic here, I cleaned
that up a little...
diff -ur MPlayer-1.0pre6a_old/postproc/rgb2rgb.c
MPlayer-1.0pre6a/postproc/rgb2rgb.c
--- MPlayer-1.0pre6a_old/postproc/rgb2rgb.c 2004-10-21
20:55:20.000000000 +0900
+++ MPlayer-1.0pre6a/postproc/rgb2rgb.c 2005-03-21 15:39:23.779136992
+0900
@@ -146,43 +146,43 @@
//Note: we have C, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one
//Plain C versions
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_3DNOW
-#undef HAVE_SSE2
-#define RENAME(a) a ## _C
-#include "rgb2rgb_template.c"
-
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
-
-//MMX versions
-#undef RENAME
-#define HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_3DNOW
-#undef HAVE_SSE2
-#define RENAME(a) a ## _MMX
-#include "rgb2rgb_template.c"
-
-//MMX2 versions
-#undef RENAME
-#define HAVE_MMX
-#define HAVE_MMX2
-#undef HAVE_3DNOW
-#undef HAVE_SSE2
-#define RENAME(a) a ## _MMX2
-#include "rgb2rgb_template.c"
//3DNOW versions
-#undef RENAME
-#define HAVE_MMX
-#undef HAVE_MMX2
-#define HAVE_3DNOW
-#undef HAVE_SSE2
-#define RENAME(a) a ## _3DNOW
-#include "rgb2rgb_template.c"
-
-#endif //ARCH_X86 || ARCH_X86_64
+// MMX2 versions
+#if defined(HAVE_MMX2)
+ #undef RENAME
+ #define HAVE_MMX
+ #define HAVE_MMX2
+ #undef HAVE_3DNOW
+ #undef HAVE_SSE2
+ #define RENAME(a) a ## _MMX2
+ #include "rgb2rgb_template.c"
+#elif HAVE_3DNOW
+ #undef RENAME
+ #define HAVE_MMX
+ #undef HAVE_MMX2
+ #define HAVE_3DNOW
+ #undef HAVE_SSE2
+ #define RENAME(a) a ## _3DNOW
+ #include "rgb2rgb_template.c"
+//MMX versions
+#elif defined(HAVE_MMX)
+ #undef RENAME
+ #define HAVE_MMX
+ #undef HAVE_MMX2
+ #undef HAVE_3DNOW
+ #undef HAVE_SSE2
+ #define RENAME(a) a ## _MMX
+ #include "rgb2rgb_template.c"
+#else
+ #undef RENAME
+ #undef HAVE_MMX
+ #undef HAVE_MMX2
+ #undef HAVE_3DNOW
+ #undef HAVE_SSE2
+ #define RENAME(a) a ## _C
+ #include "rgb2rgb_template.c"
+#endif
/*
rgb15->rgb16 Original by Strepto/Astral
### more conditional cleanups
@@ -192,8 +192,7 @@
*/
void sws_rgb2rgb_init(int flags){
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
- if(flags & SWS_CPU_CAPS_MMX2){
+#if defined(HAVE_MMX2)
rgb15to16= rgb15to16_MMX2;
rgb15to24= rgb15to24_MMX2;
rgb15to32= rgb15to32_MMX2;
@@ -223,7 +222,7 @@
interleaveBytes= interleaveBytes_MMX2;
vu9_to_vu12= vu9_to_vu12_MMX2;
yvu9_to_yuy2= yvu9_to_yuy2_MMX2;
- }else if(flags & SWS_CPU_CAPS_3DNOW){
+#elif defined(HAVE_3DNOW)
rgb15to16= rgb15to16_3DNOW;
rgb15to24= rgb15to24_3DNOW;
rgb15to32= rgb15to32_3DNOW;
@@ -253,7 +252,7 @@
interleaveBytes= interleaveBytes_3DNOW;
vu9_to_vu12= vu9_to_vu12_3DNOW;
yvu9_to_yuy2= yvu9_to_yuy2_3DNOW;
- }else if(flags & SWS_CPU_CAPS_MMX){
+#elif defined(HAVE_MMX)
rgb15to16= rgb15to16_MMX;
rgb15to24= rgb15to24_MMX;
rgb15to32= rgb15to32_MMX;
@@ -283,9 +282,7 @@
interleaveBytes= interleaveBytes_MMX;
vu9_to_vu12= vu9_to_vu12_MMX;
yvu9_to_yuy2= yvu9_to_yuy2_MMX;
- }else
-#endif
- {
+#else
rgb15to16= rgb15to16_C;
rgb15to24= rgb15to24_C;
rgb15to32= rgb15to32_C;
@@ -315,7 +312,7 @@
interleaveBytes= interleaveBytes_C;
vu9_to_vu12= vu9_to_vu12_C;
yvu9_to_yuy2= yvu9_to_yuy2_C;
- }
+#endif
}
/**
### now here, moving REG_b (ebx register) out of the clober list got it
to compile just fine
### and was actually recommeneded by a page I saw someplace (don't have
it off hand..)
diff -ur MPlayer-1.0pre6a_old/postproc/swscale_template.c
MPlayer-1.0pre6a/postproc/swscale_template.c
--- MPlayer-1.0pre6a_old/postproc/swscale_template.c 2004-10-22
09:21:57.000000000 +0900
+++ MPlayer-1.0pre6a/postproc/swscale_template.c 2005-03-21
16:06:21.531201296 +0900
@@ -2334,7 +2334,11 @@
:: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc>>16), "m"
(xInc&0xFFFF)
+#ifdef __PIC__
+ : "%"REG_a, "%ecx", "%"REG_D, "%esi"
+#else
: "%"REG_a, "%"REG_b, "%ecx", "%"REG_D, "%esi"
+#endif
);
#ifdef HAVE_MMX2
} //if MMX2 can't be used
@@ -2513,7 +2517,11 @@
:: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m"
((long)(xInc>>16)), "m" ((xInc&0xFFFF)),
"r" (src2)
+#ifdef __PIC__
+ : "%"REG_a, "%ecx", "%"REG_D, "%esi"
+#else
: "%"REG_a, "%"REG_b, "%ecx", "%"REG_D, "%esi"
+#endif
);
#ifdef HAVE_MMX2
} //if MMX2 can't be used
### Yet more conditional cleanups...
diff -ur MPlayer-1.0pre6a_old/postproc/yuv2rgb.c
MPlayer-1.0pre6a/postproc/yuv2rgb.c
--- MPlayer-1.0pre6a_old/postproc/yuv2rgb.c 2004-10-21
20:55:20.000000000 +0900
+++ MPlayer-1.0pre6a/postproc/yuv2rgb.c 2005-03-21 15:37:23.791377904
+0900
@@ -182,23 +182,25 @@
0x0602060206020602LL,
0x0004000400040004LL,};
-#undef HAVE_MMX
+#ifdef HAVE_MMX
+ //MMX versions
+ #undef RENAME
+ #define HAVE_MMX
+ #undef HAVE_MMX2
+ #undef HAVE_3DNOW
+ #define RENAME(a) a ## _MMX
+ #include "yuv2rgb_template.c"
+#endif
-//MMX versions
-#undef RENAME
-#define HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_3DNOW
-#define RENAME(a) a ## _MMX
-#include "yuv2rgb_template.c"
-
-//MMX2 versions
-#undef RENAME
-#define HAVE_MMX
-#define HAVE_MMX2
-#undef HAVE_3DNOW
-#define RENAME(a) a ## _MMX2
-#include "yuv2rgb_template.c"
+#ifdef HAVE_MMX2
+ //MMX2 versions
+ #undef RENAME
+ #define HAVE_MMX
+ #define HAVE_MMX2
+ #undef HAVE_3DNOW
+ #define RENAME(a) a ## _MMX2
+ #include "yuv2rgb_template.c"
+#endif
#endif // CAN_COMPILE_X86_ASM
@@ -581,6 +583,7 @@
SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
{
#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#ifdef HAVE_MMX2
if(c->flags & SWS_CPU_CAPS_MMX2){
switch(c->dstFormat){
case IMGFMT_BGR32: return yuv420_rgb32_MMX2;
@@ -589,6 +592,8 @@
case IMGFMT_BGR15: return yuv420_rgb15_MMX2;
}
}
+#endif
+#ifdef HAVE_MMX
if(c->flags & SWS_CPU_CAPS_MMX){
switch(c->dstFormat){
case IMGFMT_BGR32: return yuv420_rgb32_MMX;
@@ -598,6 +603,7 @@
}
}
#endif
+#endif
#ifdef HAVE_MLIB
{
SwsFunc t= yuv2rgb_init_mlib(c);
### here I removed the -fno-PIC logic otherwise my tests would have failed
### this is optional, not sure if you want to go about things this way...
--- MPlayer-1.0pre6a/configure~ 2005-03-21 17:04:53.223342944 +0900
+++ MPlayer-1.0pre6a/configure 2005-03-21 17:09:53.285726528 +0900
@@ -6370,21 +6370,6 @@
fi
fi
-echocheck "compiler support for -fno-PIC"
-if x86; then
-cat > $TMPC <<EOF
-int main(void) { return 0; }
-EOF
-if cc_check -fno-PIC ; then
- CFLAGS="-fno-PIC $CFLAGS"
- echores "yes"
-else
- echores "no"
-fi
-else
- echores "only used for x86"
-fi
-
echocheck "ftello()"
# if we don't have ftello use the osdep/ compatibility module
cat > $TMPC << EOF
### you guessed.. more conditional logic..
--- MPlayer-1.0pre6a/libvo/osd.c.old 2005-03-21 20:41:30.580451920 +0000
+++ MPlayer-1.0pre6a/libvo/osd.c 2005-03-21 20:41:15.274778736 +0000
@@ -45,10 +45,6 @@
#endif
#endif //CAN_COMPILE_X86_ASM
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_3DNOW
-
#ifndef CAN_COMPILE_X86_ASM
#ifdef COMPILE_C
@@ -61,44 +57,46 @@
#else
-//X86 noMMX versions
-#ifdef COMPILE_C
-#undef RENAME
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_3DNOW
-#define RENAME(a) a ## _X86
-#include "osd_template.c"
-#endif
-
-//MMX versions
-#ifdef COMPILE_MMX
-#undef RENAME
-#define HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_3DNOW
-#define RENAME(a) a ## _MMX
-#include "osd_template.c"
-#endif
-
-//MMX2 versions
-#ifdef COMPILE_MMX2
-#undef RENAME
-#define HAVE_MMX
-#define HAVE_MMX2
-#undef HAVE_3DNOW
-#define RENAME(a) a ## _MMX2
-#include "osd_template.c"
-#endif
-
-//3DNOW versions
-#ifdef COMPILE_3DNOW
-#undef RENAME
-#define HAVE_MMX
-#undef HAVE_MMX2
-#define HAVE_3DNOW
-#define RENAME(a) a ## _3DNow
-#include "osd_template.c"
+#if defined(HAVE_MMX2)
+ //MMX2 versions
+ #ifdef COMPILE_MMX2
+ #undef RENAME
+ #define HAVE_MMX
+ #define HAVE_MMX2
+ #undef HAVE_3DNOW
+ #define RENAME(a) a ## _MMX2
+ #include "osd_template.c"
+ #endif
+#elif defined(HAVE_3DNOW)
+ //3DNOW versions
+ #ifdef COMPILE_3DNOW
+ #undef RENAME
+ #define HAVE_MMX
+ #undef HAVE_MMX2
+ #define HAVE_3DNOW
+ #define RENAME(a) a ## _3DNow
+ #include "osd_template.c"
+ #endif
+#elif defined(HAVE_MMX)
+ //MMX versions
+ #ifdef COMPILE_MMX
+ #undef RENAME
+ #define HAVE_MMX
+ #undef HAVE_MMX2
+ #undef HAVE_3DNOW
+ #define RENAME(a) a ## _MMX
+ #include "osd_template.c"
+ #endif
+#else
+ //X86 noMMX versions
+ #ifdef COMPILE_C
+ #undef RENAME
+ #undef HAVE_MMX
+ #undef HAVE_MMX2
+ #undef HAVE_3DNOW
+ #define RENAME(a) a ## _X86
+ #include "osd_template.c"
+ #endif
#endif
#endif //CAN_COMPILE_X86_ASM
@@ -106,24 +104,25 @@
void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char
*srca, int srcstride, unsigned char* dstbase,int dststride){
#ifdef RUNTIME_CPUDETECT
#ifdef CAN_COMPILE_X86_ASM
+#if defined(HAVE_MMX2)
// ordered by speed / fastest first
- if(gCpuCaps.hasMMX2)
vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.has3DNow)
+#elif defined(HAVE_3DNOW)
vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.hasMMX)
+#elif defined(HAVE_MMX)
vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase,
dststride);
- else
+#else
vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase,
dststride);
+#endif
#else
vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase,
dststride);
#endif
#else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if defined(HAVE_MMX2)
vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
-#elif defined (HAVE_3DNOW)
+#elif defined(HAVE_3DNOW)
vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
-#elif defined (HAVE_MMX)
+#elif defined(HAVE_MMX)
vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase,
dststride);
#elif defined(ARCH_X86) || defined(ARCH_X86_64)
vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase,
dststride);
@@ -137,23 +135,24 @@
#ifdef RUNTIME_CPUDETECT
#ifdef CAN_COMPILE_X86_ASM
// ordered by speed / fastest first
- if(gCpuCaps.hasMMX2)
+#if defined(HAVE_MMX2)
vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.has3DNow)
+#elif defined(HAVE_3DNOW)
vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.hasMMX)
+#elif defined(HAVE_MMX)
vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase,
dststride);
- else
+#else
vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase,
dststride);
+#endif
#else
vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase,
dststride);
#endif
#else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if defined(HAVE_MMX2)
vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
-#elif defined (HAVE_3DNOW)
+#elif defined(HAVE_3DNOW)
vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
-#elif defined (HAVE_MMX)
+#elif defined(HAVE_MMX)
vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase,
dststride);
#elif defined(ARCH_X86) || defined(ARCH_X86_64)
vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase,
dststride);
@@ -167,23 +166,24 @@
#ifdef RUNTIME_CPUDETECT
#ifdef CAN_COMPILE_X86_ASM
// ordered by speed / fastest first
- if(gCpuCaps.hasMMX2)
+#if defined(HAVE_MMX2)
vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.has3DNow)
+#elif defined(HAVE_3DNOW)
vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.hasMMX)
+#elif defined(HAVE_MMX)
vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase,
dststride);
- else
+#else
vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase,
dststride);
+#endif
#else
vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase,
dststride);
#endif
#else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if defined(HAVE_MMX2)
vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
-#elif defined (HAVE_3DNOW)
+#elif defined(HAVE_3DNOW)
vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
-#elif defined (HAVE_MMX)
+#elif defined(HAVE_MMX)
vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase,
dststride);
#elif defined(ARCH_X86) || defined(ARCH_X86_64)
vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase,
dststride);
@@ -197,23 +197,24 @@
#ifdef RUNTIME_CPUDETECT
#ifdef CAN_COMPILE_X86_ASM
// ordered by speed / fastest first
- if(gCpuCaps.hasMMX2)
+#if defined(HAVE_MMX2)
vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.has3DNow)
+#elif defined(HAVE_3DNOW)
vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.hasMMX)
+#elif defined(HAVE_MMX)
vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase,
dststride);
- else
+#else
vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase,
dststride);
+#endif
#else
vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase,
dststride);
#endif
#else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if defined(HAVE_MMX2)
vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
-#elif defined (HAVE_3DNOW)
+#elif defined(HAVE_3DNOW)
vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
-#elif defined (HAVE_MMX)
+#elif defined(HAVE_MMX)
vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase,
dststride);
#elif defined(ARCH_X86) || defined(ARCH_X86_64)
vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase,
dststride);
@@ -227,19 +228,20 @@
#ifdef RUNTIME_CPUDETECT
#ifdef CAN_COMPILE_X86_ASM
// ordered by speed / fastest first
- if(gCpuCaps.hasMMX2)
+#if defined(HAVE_MMX2)
vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.has3DNow)
+#elif defined(HAVE_3DNOW)
vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
- else if(gCpuCaps.hasMMX)
+#elif defined(HAVE_MMX)
vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase,
dststride);
- else
+#else
vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase,
dststride);
+#endif
#else
vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase,
dststride);
#endif
#else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if defined(HAVE_MMX2)
vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase,
dststride);
#elif defined (HAVE_3DNOW)
vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase,
dststride);
@@ -272,23 +274,24 @@
#ifdef RUNTIME_CPUDETECT
#ifdef CAN_COMPILE_X86_ASM
// ordered per speed fasterst first
- if(gCpuCaps.hasMMX2)
+#if defined(HAVE_MMX2)
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2)
Optimized OnScreenDisplay\n");
- else if(gCpuCaps.has3DNow)
+#elif defined(HAVE_3DNOW)
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow)
Optimized OnScreenDisplay\n");
- else if(gCpuCaps.hasMMX)
+#elif defined(HAVE_MMX)
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized
OnScreenDisplay\n");
- else
+#else
mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized
OnScreenDisplay\n");
+#endif
#else
mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized
OnScreenDisplay\n");
#endif
#else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if defined(HAVE_MMX2)
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2)
Optimized OnScreenDisplay\n");
-#elif defined (HAVE_3DNOW)
+#elif defined(HAVE_3DNOW)
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow)
Optimized OnScreenDisplay\n");
-#elif defined (HAVE_MMX)
+#elif defined(HAVE_MMX)
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized
OnScreenDisplay\n");
#elif defined(ARCH_X86) || defined(ARCH_X86_64)
mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized
OnScreenDisplay\n");
### ok, here I forced eax, ecx, and edx usage to prevent ebx from being
used. Now
### that I look at it though, I probably should have __PIC__
conditionaled that..
### anyways, output registers are memory addresses instead (direct
access to the
### memory location of y, b, and d
--- MPlayer-1.0pre6a/libavcodec/common.h 2004-12-24
06:24:08.000000000 +0900
+++ MPlayer-1.0pre6a/libavcodec/common.h 2005-03-25
12:33:20.000000000 +0900
@@ -1256,14 +1256,15 @@
#if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT)
+
#define COPY3_IF_LT(x,y,a,b,c,d)\
asm volatile (\
"cmpl %0, %3 \n\t"\
"cmovl %3, %0 \n\t"\
"cmovl %4, %1 \n\t"\
"cmovl %5, %2 \n\t"\
- : "+r" (x), "+r" (a), "+r" (c)\
- : "r" (y), "r" (b), "r" (d)\
+ : "+m" (x), "+m" (a), "+m" (c)\
+ : "a" (y), "c" (b), "d" (d)\
);
#else
#define COPY3_IF_LT(x,y,a,b,c,d)\
### a quick __PIC__ conditional to make it skip optimizations
### that make pic + x86 cry
--- MPlayer-1.0pre6a/libvo/osd_template.c 2004-10-21
20:55:20.000000000 +0900
+++ MPlayer-1.0pre6a/libvo/osd_template.c 2005-03-25
14:04:00.000000000 +0900
@@ -293,7 +293,7 @@
#endif
for(y=0;y<h;y++){
register int x;
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if defined(ARCH_X86) && !defined(__PIC__) || defined(ARCH_X86_64)
#ifdef HAVE_MMX
#ifdef HAVE_3DNOW
asm volatile(
And that's all. Constructive criticism welcomed.
--
Chris White <chriswhite at gentoo.org>
------------------------
Sound | Video | PPC
ChrisWhite @ irc.freenode.net
cpw @ irc.freenode.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050325/e64b0623/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list