. l'output fb remet le terminal comme il faut en sortant.
. s�paration du flag MMX et de l'architecture dans le Makefile
#VIDEO=BEOS
#VIDEO=DGA
-# Target architecture and optimization
-#ARCH=
-ARCH=MMX
+# Target architecture
+ARCH=X86
#ARCH=PPC
#ARCH=SPARC
#SYS=BSD
#SYS=BEOS
+# For x86 architecture, choose MMX support
+MMX=YES
+#MMX=NO
+
# Decoder choice - ?? old decoder will be removed soon
#DECODER=old
DECODER=new
CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
CCFLAGS += -fomit-frame-pointer
-# Optimizations for x86 familiy, without MMX
-ifeq ($(ARCH),)
+# Optimizations for x86 familiy
+ifeq ($(ARCH),X86)
CCFLAGS += -malign-double
CCFLAGS += -march=pentiumpro
#CCFLAGS += -march=pentium
endif
-# Optimization for x86 with MMX support
-ifeq ($(ARCH),MMX)
-CCFLAGS += -malign-double
-CCFLAGS += -march=pentiumpro
-endif
-
# Optimizations for PowerPC
ifeq ($(ARCH),PPC)
CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
# C compiler flags: common flags
#
-# Optimizations for x86 with MMX support
-ifeq ($(ARCH),MMX)
+# Eventual MMX optimizations for x86
+ifeq ($(ARCH),X86)
+ifeq ($(MMX), YES) # MMX is YES or AUTO
CFLAGS += -DHAVE_MMX
endif
+endif
#
# Additionnal debugging flags
#
# Assembler Objects
#
-ifeq ($(ARCH),MMX)
-ifeq ($(DECODER),old)
-ASM_OBJ = video_decoder_ref/idctmmx.o \
+ifeq ($(ARCH),X86)
+ifeq ($(MMX), YES)
+ifeq ($(DECODER),new)
+ASM_OBJ = video_decoder/idctmmx.o \
video_output/video_yuv_mmx.o
else
-ASM_OBJ = video_decoder/idctmmx.o \
+ASM_OBJ = video_decoder_ref/idctmmx.o \
video_output/video_yuv_mmx.o
endif
endif
+endif
#
# Other lists of files
* Preamble
*****************************************************************************/
#include "vlc.h"
-/*??
-#include <pthread.h>
-#include <stdio.h>
-#include <netinet/in.h>
-#include <sys/soundcard.h>
-#include <sys/uio.h>
-
-#include "config.h"
-#include "common.h"
-#include "mtime.h"
-#include "vlc_thread.h"
-
-#include "input.h"
-#include "input_vlan.h"
-
-#include "audio_output.h"
-
-#include "video.h"
-#include "video_output.h"
-
-#include "xconsole.h"
-#include "interface.h"
-#include "intf_msg.h"
-#include "control.h"
-
-#include "pgm_data.h"*/
-
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
-#include <sys/uio.h> /* for input.h */
+#include <sys/uio.h> /* for input.h */
#include "config.h"
#include "common.h"
static void InitSignalHandler ( void );
static void SignalHandler ( int i_signal );
+static int TestMMX ( void );
/*****************************************************************************
* main: parse command line, start interface and spawn threads
/*
* Read configuration, initialize messages interface and set up program
*/
+#ifdef HAVE_MMX
+ if( !TestMMX() )
+ {
+ fprintf( stderr, "Sorry, this program needs an MMX processor. Please run the non-MMX version.\n" );
+ return(0);
+ }
+#endif
p_main->p_msg = intf_MsgCreate();
if( !p_main->p_msg ) /* start messages interface */
{
p_main->p_intf->b_die = 1;
}
-
-
+#ifdef HAVE_MMX
+/*****************************************************************************
+ * TestMMX: tests if the processor has MMX support.
+ *****************************************************************************
+ * This function is called if HAVE_MMX is enabled, to check whether the
+ * cpu really supports MMX.
+ *****************************************************************************/
+static int TestMMX( void )
+{
+ int reg, dummy;
+
+ /* test for a 386 cpu */
+ asm volatile ( "pushfl
+ popl %%eax
+ movl %%eax, %%ecx
+ xorl $0x40000, %%eax
+ pushl %%eax
+ popfl
+ pushfl
+ popl %%eax
+ xorl %%ecx, %%eax
+ andl $0x40000, %%eax"
+ : "=a" ( reg ) );
+
+ if( !reg )
+ return( 0 );
+
+ /* test for a 486 cpu */
+ asm volatile ( "movl %%ecx, %%eax
+ xorl $0x200000, %%eax
+ pushl %%eax
+ popfl
+ pushfl
+ popl %%eax
+ xorl %%ecx, %%eax
+ pushl %%ecx
+ popfl
+ andl $0x200000, %%eax"
+ : "=a" ( reg ) );
+
+ if( !reg )
+ return( 0 );
+
+ /* the cpu supports the CPUID instruction - get its level */
+ asm volatile ( "cpuid"
+ : "=a" ( reg ),
+ "=b" ( dummy ),
+ "=c" ( dummy ),
+ "=d" ( dummy )
+ : "a" ( 0 ) ); /* level 0 */
+
+ /* this shouldn't happen on a normal cpu */
+ if( !reg )
+ return( 0 );
+
+ /* test for the MMX flag */
+ asm volatile ( "cpuid
+ andl $0x00800000, %%edx" /* X86_FEATURE_MMX */
+ : "=a" ( dummy ),
+ "=b" ( dummy ),
+ "=c" ( dummy ),
+ "=d" ( reg )
+ : "a" ( 1 ) ); /* level 1 */
+
+ if( !reg )
+ return( 0 );
+
+ return( 1 );
+}
+#endif
/*****************************************************************************
* vout_fb.c: Linux framebuffer video output display method
- * (c)1998 VideoLAN
+ * (c)1999 VideoLAN
*****************************************************************************/
/*****************************************************************************
*****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
- /* tout est bien affiché, on peut échanger les 2 écrans */
- p_vout->p_sys->var_info.xoffset = 0;
+ /* swap the two Y offsets */
p_vout->p_sys->var_info.yoffset = p_vout->i_buffer_index ? p_vout->p_sys->var_info.yres : 0;
+ /* the X offset should be 0, but who knows ...
+ * some other app might have played with the framebuffer */
+ p_vout->p_sys->var_info.xoffset = 0;
//ioctl( p_vout->p_sys->i_fb_dev, FBIOPUT_VSCREENINFO, &p_vout->p_sys->var_info );
ioctl( p_vout->p_sys->i_fb_dev, FBIOPAN_DISPLAY, &p_vout->p_sys->var_info );
p_vout->p_sys->fb_cmap.blue = p_vout->p_sys->fb_palette + 2 * 256 * sizeof(unsigned short);
p_vout->p_sys->fb_cmap.transp = p_vout->p_sys->fb_palette + 3 * 256 * sizeof(unsigned short);
+ /* saves the colormap */
ioctl( p_vout->p_sys->i_fb_dev, FBIOGETCMAP, &p_vout->p_sys->fb_cmap );
- /* initializes black & white palette */
- //FBInitRGBPalette( p_vout );
- //FBInitBWPalette( p_vout );
-
p_vout->i_bytes_per_pixel = 1;
p_vout->i_bytes_per_line = p_vout->i_width;
break;
default: /* unsupported screen depth */
intf_ErrMsg("vout error: screen depth %d is not supported\n",
p_vout->i_screen_depth);
- return( 1 );
+ return( 1 );
break;
}
free( p_vout->p_sys->fb_palette );
}
- // Destroy window and close display
- close( p_vout->p_sys->i_fb_dev );
+ /* Destroy window and close display */
+ close( p_vout->p_sys->i_fb_dev );
}
/*****************************************************************************