Commit c1ba1b49 authored by Sam Hocevar's avatar Sam Hocevar

  * CPU detection under BeOS.
  * Fixed XVideo port selection.
  * New stupid plugin: "--filter wall" for split-image playback :-)
     (will evolve into a real image wall plugin when I have time)
parent 22899aa9
...@@ -66,6 +66,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \ ...@@ -66,6 +66,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
fb/fb \ fb/fb \
filter/filter_bob \ filter/filter_bob \
filter/filter_invert \ filter/filter_invert \
filter/filter_wall \
ggi/ggi \ ggi/ggi \
glide/glide \ glide/glide \
gtk/gnome \ gtk/gnome \
......
...@@ -5488,7 +5488,7 @@ fi ...@@ -5488,7 +5488,7 @@ fi
ARCH=${target_cpu} ARCH=${target_cpu}
BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec" BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert" PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert filter_wall"
MMX_MODULES="memcpymmx idctmmx motionmmx" MMX_MODULES="memcpymmx idctmmx motionmmx"
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext" MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
......
...@@ -310,7 +310,7 @@ dnl ...@@ -310,7 +310,7 @@ dnl
dnl default modules dnl default modules
dnl dnl
BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec" BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert" PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert filter_wall"
dnl dnl
dnl Accelerated modules dnl Accelerated modules
......
...@@ -9,12 +9,14 @@ ...@@ -9,12 +9,14 @@
PLUGIN_BOB = bob.o PLUGIN_BOB = bob.o
PLUGIN_INVERT = invert.o PLUGIN_INVERT = invert.o
PLUGIN_WALL = wall.o
BUILTIN_BOB = $(PLUGIN_BOB:%.o=BUILTIN_%.o) BUILTIN_BOB = $(PLUGIN_BOB:%.o=BUILTIN_%.o)
BUILTIN_INVERT = $(PLUGIN_INVERT:%.o=BUILTIN_%.o) BUILTIN_INVERT = $(PLUGIN_INVERT:%.o=BUILTIN_%.o)
BUILTIN_WALL = $(PLUGIN_WALL:%.o=BUILTIN_%.o)
PLUGIN_C = $(PLUGIN_BOB) $(PLUGIN_INVERT) PLUGIN_C = $(PLUGIN_BOB) $(PLUGIN_INVERT) $(PLUGIN_WALL)
BUILTIN_C = $(BUILTIN_BOB) $(BUILTIN_INVERT) BUILTIN_C = $(BUILTIN_BOB) $(BUILTIN_INVERT) $(BUILTIN_WALL)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C) ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
# #
...@@ -41,3 +43,10 @@ include ../../Makefile.modules ...@@ -41,3 +43,10 @@ include ../../Makefile.modules
ar r $@ $^ ar r $@ $^
$(RANLIB) $@ $(RANLIB) $@
../filter_wall.so: $(PLUGIN_WALL)
$(CC) -o $@ $^ $(PLCFLAGS)
../filter_wall.a: $(BUILTIN_WALL)
ar r $@ $^
$(RANLIB) $@
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_xvideo.c: Xvideo video output display method * vout_xvideo.c: Xvideo video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: vout_xvideo.c,v 1.39 2001/12/16 16:18:36 sam Exp $ * $Id: vout_xvideo.c,v 1.40 2001/12/17 03:38:21 sam Exp $
* *
* Authors: Shane Harper <shanegh@optusnet.com.au> * Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -609,6 +609,8 @@ static int GetXVideoPort( Display *dpy ) ...@@ -609,6 +609,8 @@ static int GetXVideoPort( Display *dpy )
/* No special xv port has been requested so try all of them */ /* No special xv port has been requested so try all of them */
for( i_adaptor = 0; i_adaptor < i_num_adaptors; ++i_adaptor ) for( i_adaptor = 0; i_adaptor < i_num_adaptors; ++i_adaptor )
{ {
XvImageFormatValues *p_formats;
int i_format, i_num_formats;
int i_port; int i_port;
/* If we requested an adaptor and it's not this one, we aren't /* If we requested an adaptor and it's not this one, we aren't
...@@ -625,94 +627,100 @@ static int GetXVideoPort( Display *dpy ) ...@@ -625,94 +627,100 @@ static int GetXVideoPort( Display *dpy )
continue; continue;
} }
for( i_port = p_adaptor[i_adaptor].base_id; /* Check that port supports YUV12 planar format... */
i_port < p_adaptor[i_adaptor].base_id p_formats = XvListImageFormats( dpy, p_adaptor[i_adaptor].base_id,
+ p_adaptor[i_adaptor].num_ports; &i_num_formats );
i_port++ )
for( i_format = 0; i_format < i_num_formats; i_format++ )
{ {
XvImageFormatValues *p_formats; XvEncodingInfo *p_enc;
int i_format, i_num_formats; int i_enc, i_num_encodings;
XvAttribute *p_attr;
int i_attr, i_num_attributes;
/* If we already found a port, we aren't interested */ /* If this is not the format we want, forget it */
if( i_selected_port != -1 ) if( p_formats[ i_format ].id != GUID_YUV12_PLANAR )
{ {
continue; continue;
} }
/* Check that port supports YUV12 planar format... */ /* Look for the first available port supporting this format */
p_formats = XvListImageFormats( dpy, i_port, &i_num_formats ); for( i_port = p_adaptor[i_adaptor].base_id;
( i_port < p_adaptor[i_adaptor].base_id
for( i_format = 0; i_format < i_num_formats; i_format++ ) + p_adaptor[i_adaptor].num_ports )
&& ( i_selected_port == -1 );
i_port++ )
{ {
XvEncodingInfo *p_enc; if( XvGrabPort( dpy, i_port, CurrentTime ) == Success )
int i_enc, i_num_encodings;
XvAttribute *p_attr;
int i_attr, i_num_attributes;
if( p_formats[ i_format ].id != GUID_YUV12_PLANAR )
{ {
continue; i_selected_port = i_port;
} }
}
/* Found a matching port, print a description of this port */ /* If no free port was found, forget it */
i_selected_port = i_port; if( i_selected_port == -1 )
{
continue;
}
intf_WarnMsg( 3, "vout: GetXVideoPort found adaptor %i port %i", /* If we found a port, print information about it */
i_adaptor, i_port); intf_WarnMsg( 3, "vout: GetXVideoPort found adaptor %i, port %i",
intf_WarnMsg( 3, " image format 0x%x (%4.4s) %s supported", i_adaptor, i_selected_port );
p_formats[ i_format ].id, intf_WarnMsg( 3, " image format 0x%x (%4.4s) %s supported",
(char *)&p_formats[ i_format ].id, p_formats[ i_format ].id,
( p_formats[ i_format ].format (char *)&p_formats[ i_format ].id,
== XvPacked ) ? "packed" : "planar" ); ( p_formats[ i_format ].format
== XvPacked ) ? "packed" : "planar" );
intf_WarnMsg( 4, " encoding list:" ); intf_WarnMsg( 4, " encoding list:" );
if( XvQueryEncodings( dpy, i_port, &i_num_encodings, &p_enc ) if( XvQueryEncodings( dpy, i_selected_port,
!= Success ) &i_num_encodings, &p_enc )
{ != Success )
intf_WarnMsg( 4, " XvQueryEncodings failed" ); {
continue; intf_WarnMsg( 4, " XvQueryEncodings failed" );
} continue;
}
for( i_enc = 0; i_enc < i_num_encodings; i_enc++ )
{
intf_WarnMsg( 4, " id=%ld, name=%s, size=%ldx%ld,"
" numerator=%d, denominator=%d",
p_enc[i_enc].encoding_id, p_enc[i_enc].name,
p_enc[i_enc].width, p_enc[i_enc].height,
p_enc[i_enc].rate.numerator,
p_enc[i_enc].rate.denominator );
}
if( p_enc != NULL ) for( i_enc = 0; i_enc < i_num_encodings; i_enc++ )
{ {
XvFreeEncodingInfo( p_enc ); intf_WarnMsg( 4, " id=%ld, name=%s, size=%ldx%ld,"
} " numerator=%d, denominator=%d",
p_enc[i_enc].encoding_id, p_enc[i_enc].name,
p_enc[i_enc].width, p_enc[i_enc].height,
p_enc[i_enc].rate.numerator,
p_enc[i_enc].rate.denominator );
}
intf_WarnMsg( 4, " attribute list:" ); if( p_enc != NULL )
p_attr = XvQueryPortAttributes( dpy, i_port, {
&i_num_attributes ); XvFreeEncodingInfo( p_enc );
for( i_attr = 0; i_attr < i_num_attributes; i_attr++ ) }
{
intf_WarnMsg( 4,
" name=%s, flags=[%s%s ], min=%i, max=%i",
p_attr[i_attr].name,
(p_attr[i_attr].flags & XvGettable) ? " get" : "",
(p_attr[i_attr].flags & XvSettable) ? " set" : "",
p_attr[i_attr].min_value, p_attr[i_attr].max_value );
}
if( p_attr != NULL ) intf_WarnMsg( 4, " attribute list:" );
{ p_attr = XvQueryPortAttributes( dpy, i_selected_port,
XFree( p_attr ); &i_num_attributes );
} for( i_attr = 0; i_attr < i_num_attributes; i_attr++ )
{
intf_WarnMsg( 4,
" name=%s, flags=[%s%s ], min=%i, max=%i",
p_attr[i_attr].name,
(p_attr[i_attr].flags & XvGettable) ? " get" : "",
(p_attr[i_attr].flags & XvSettable) ? " set" : "",
p_attr[i_attr].min_value, p_attr[i_attr].max_value );
} }
if( p_formats != NULL ) if( p_attr != NULL )
{ {
XFree( p_formats ); XFree( p_attr );
} }
} }
if( p_formats != NULL )
{
XFree( p_formats );
}
} }
if( i_num_adaptors > 0 ) if( i_num_adaptors > 0 )
...@@ -724,12 +732,12 @@ static int GetXVideoPort( Display *dpy ) ...@@ -724,12 +732,12 @@ static int GetXVideoPort( Display *dpy )
{ {
if( i_requested_adaptor == -1 ) if( i_requested_adaptor == -1 )
{ {
intf_WarnMsg( 3, "vout: no XVideo port found supporting YUV12" ); intf_WarnMsg( 3, "vout: no free XVideo port found for YV12" );
} }
else else
{ {
intf_WarnMsg( 3, "vout: XVideo adaptor %i does not support YUV12", intf_WarnMsg( 3, "vout: XVideo adaptor %i does not have a free "
i_requested_adaptor ); "XVideo port for YV12", i_requested_adaptor );
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* and spawn threads. * and spawn threads.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.138 2001/12/16 16:18:36 sam Exp $ * $Id: main.c,v 1.139 2001/12/17 03:38:21 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -155,16 +155,6 @@ ...@@ -155,16 +155,6 @@
#define SHORT_HELP 1 #define SHORT_HELP 1
#define LONG_HELP 2 #define LONG_HELP 2
/* Needed for x86 CPU capabilities detection */
#define cpuid( a ) \
asm volatile ( "cpuid" \
: "=a" ( i_eax ), \
"=b" ( i_ebx ), \
"=c" ( i_ecx ), \
"=d" ( i_edx ) \
: "a" ( a ) \
: "cc" );
/* Long options */ /* Long options */
static const struct option longopts[] = static const struct option longopts[] =
{ {
...@@ -218,7 +208,7 @@ static const struct option longopts[] = ...@@ -218,7 +208,7 @@ static const struct option longopts[] =
{ "dvdsubtitle", 1, 0, 's' }, { "dvdsubtitle", 1, 0, 's' },
{ "dvdcss-method", 1, 0, OPT_DVDCSS_METHOD }, { "dvdcss-method", 1, 0, OPT_DVDCSS_METHOD },
{ "dvdcss-verbose", 1, 0, OPT_DVDCSS_VERBOSE }, { "dvdcss-verbose", 1, 0, OPT_DVDCSS_VERBOSE },
/* Input options */ /* Input options */
{ "input", 1, 0, OPT_INPUT }, { "input", 1, 0, OPT_INPUT },
{ "channels", 0, 0, OPT_CHANNELS }, { "channels", 0, 0, OPT_CHANNELS },
...@@ -289,7 +279,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -289,7 +279,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
p_vout_bank = &vout_bank; p_vout_bank = &vout_bank;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
/* /*
* Support for getext * Support for getext
*/ */
#if defined( HAVE_LOCALE_H ) && defined( HAVE_LC_MESSAGES ) #if defined( HAVE_LOCALE_H ) && defined( HAVE_LC_MESSAGES )
...@@ -307,17 +297,17 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -307,17 +297,17 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
textdomain( PACKAGE ); textdomain( PACKAGE );
#endif #endif
/* /*
* Initialize threads system * Initialize threads system
*/ */
vlc_threads_init( ); vlc_threads_init( );
/* /*
* Test if our code is likely to run on this CPU * Test if our code is likely to run on this CPU
*/ */
p_main->i_cpu_capabilities = CPUCapabilities(); p_main->i_cpu_capabilities = CPUCapabilities();
/* /*
* System specific initialization code * System specific initialization code
*/ */
...@@ -856,13 +846,13 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -856,13 +846,13 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
break; break;
/* Misc options */ /* Misc options */
case OPT_SYNCHRO: case OPT_SYNCHRO:
main_PutPszVariable( VPAR_SYNCHRO_VAR, optarg ); main_PutPszVariable( VPAR_SYNCHRO_VAR, optarg );
break; break;
case OPT_MEMCPY: case OPT_MEMCPY:
main_PutPszVariable( MEMCPY_METHOD_VAR, optarg ); main_PutPszVariable( MEMCPY_METHOD_VAR, optarg );
break; break;
/* Decoder options */ /* Decoder options */
case OPT_MPEG_ADEC: case OPT_MPEG_ADEC:
main_PutPszVariable( ADEC_MPEG_VAR, optarg ); main_PutPszVariable( ADEC_MPEG_VAR, optarg );
...@@ -1144,7 +1134,7 @@ static void InstructionSignalHandler( int i_signal ) ...@@ -1144,7 +1134,7 @@ static void InstructionSignalHandler( int i_signal )
/* Acknowledge the signal received */ /* Acknowledge the signal received */
i_illegal = 1; i_illegal = 1;
#ifdef HAVE_SIGRELSE #ifdef HAVE_SIGRELSE
sigrelse( i_signal ); sigrelse( i_signal );
#endif #endif
...@@ -1160,15 +1150,7 @@ static int CPUCapabilities( void ) ...@@ -1160,15 +1150,7 @@ static int CPUCapabilities( void )
{ {
volatile int i_capabilities = CPU_CAPABILITY_NONE; volatile int i_capabilities = CPU_CAPABILITY_NONE;
#if defined( SYS_BEOS ) #if defined( SYS_DARWIN )
i_capabilities |= CPU_CAPABILITY_FPU
| CPU_CAPABILITY_486
| CPU_CAPABILITY_586
| CPU_CAPABILITY_MMX;
return( i_capabilities );
#elif defined( SYS_DARWIN )
struct host_basic_info hi; struct host_basic_info hi;
kern_return_t ret; kern_return_t ret;
host_name_port_t host; host_name_port_t host;
...@@ -1204,27 +1186,43 @@ static int CPUCapabilities( void ) ...@@ -1204,27 +1186,43 @@ static int CPUCapabilities( void )
volatile unsigned int i_eax, i_ebx, i_ecx, i_edx; volatile unsigned int i_eax, i_ebx, i_ecx, i_edx;
volatile boolean_t b_amd; volatile boolean_t b_amd;
/* Needed for x86 CPU capabilities detection */
# define cpuid( a ) \
asm volatile ( "pushl %%ebx\n\t" \
"cpuid\n\t" \
"movl %%ebx,%1\n\t" \
"popl %%ebx\n\t" \
: "=a" ( i_eax ), \
"=r" ( i_ebx ), \
"=c" ( i_ecx ), \
"=d" ( i_edx ) \
: "a" ( a ) \
: "cc" );
i_capabilities |= CPU_CAPABILITY_FPU; i_capabilities |= CPU_CAPABILITY_FPU;
signal( SIGILL, InstructionSignalHandler ); signal( SIGILL, InstructionSignalHandler );
/* test for a 486 CPU */ /* test for a 486 CPU */
asm volatile ( "pushfl\n\t" asm volatile ( "pushl %%ebx\n\t"
"pushfl\n\t"
"popl %%eax\n\t" "popl %%eax\n\t"
"movl %%eax, %%ebx\n\t" "movl %%eax, %%ebx\n\t"
"xorl $0x200000, %%eax\n\t" "xorl $0x200000, %%eax\n\t"
"pushl %%eax\n\t" "pushl %%eax\n\t"
"popfl\n\t" "popfl\n\t"
"pushfl\n\t" "pushfl\n\t"
"popl %%eax" "popl %%eax\n\t"
"movl %%ebx,%1\n\t"
"popl %%ebx\n\t"
: "=a" ( i_eax ), : "=a" ( i_eax ),
"=b" ( i_ebx ) "=r" ( i_ebx )
: :
: "cc" ); : "cc" );
if( i_eax == i_ebx ) if( i_eax == i_ebx )
{ {
signal( SIGILL, NULL ); signal( SIGILL, NULL );
return( i_capabilities ); return( i_capabilities );
} }
...@@ -1235,7 +1233,7 @@ static int CPUCapabilities( void ) ...@@ -1235,7 +1233,7 @@ static int CPUCapabilities( void )
if( !i_eax ) if( !i_eax )
{ {
signal( SIGILL, NULL ); signal( SIGILL, NULL );
return( i_capabilities ); return( i_capabilities );
} }
...@@ -1251,7 +1249,7 @@ static int CPUCapabilities( void ) ...@@ -1251,7 +1249,7 @@ static int CPUCapabilities( void )
if( ! (i_edx & 0x00800000) ) if( ! (i_edx & 0x00800000) )
{ {
signal( SIGILL, NULL ); signal( SIGILL, NULL );
return( i_capabilities ); return( i_capabilities );
} }
...@@ -1285,13 +1283,13 @@ static int CPUCapabilities( void ) ...@@ -1285,13 +1283,13 @@ static int CPUCapabilities( void )
} }
#endif #endif
} }
/* test for additional capabilities */ /* test for additional capabilities */
cpuid( 0x80000000 ); cpuid( 0x80000000 );
if( i_eax < 0x80000001 ) if( i_eax < 0x80000001 )
{ {
signal( SIGILL, NULL ); signal( SIGILL, NULL );
return( i_capabilities ); return( i_capabilities );
} }
...@@ -1308,7 +1306,7 @@ static int CPUCapabilities( void ) ...@@ -1308,7 +1306,7 @@ static int CPUCapabilities( void )
__asm__ __volatile__ ( "pfadd %%mm0,%%mm0\n" "femms\n" : : ); __asm__ __volatile__ ( "pfadd %%mm0,%%mm0\n" "femms\n" : : );
} }
if( i_illegal == 0 ) if( i_illegal == 0 )
{ {
i_capabilities |= CPU_CAPABILITY_3DNOW; i_capabilities |= CPU_CAPABILITY_3DNOW;
} }
...@@ -1320,7 +1318,7 @@ static int CPUCapabilities( void ) ...@@ -1320,7 +1318,7 @@ static int CPUCapabilities( void )
i_capabilities |= CPU_CAPABILITY_MMXEXT; i_capabilities |= CPU_CAPABILITY_MMXEXT;
} }
signal( SIGILL, NULL ); signal( SIGILL, NULL );
return( i_capabilities ); return( i_capabilities );
#elif defined( __powerpc__ ) #elif defined( __powerpc__ )
...@@ -1346,7 +1344,7 @@ static int CPUCapabilities( void ) ...@@ -1346,7 +1344,7 @@ static int CPUCapabilities( void )
} }
#endif #endif
signal( SIGILL, NULL ); signal( SIGILL, NULL );
return( i_capabilities ); return( i_capabilities );
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment