Commit ce722764 authored by Sam Hocevar's avatar Sam Hocevar
Browse files

. d�tection d'un processeur MMX.

 . l'output fb remet le terminal comme il faut en sortant.
 . s�paration du flag MMX et de l'architecture dans le Makefile
parent 2ad5fa64
......@@ -26,9 +26,8 @@ VIDEO=X11
#VIDEO=BEOS
#VIDEO=DGA
# Target architecture and optimization
#ARCH=
ARCH=MMX
# Target architecture
ARCH=X86
#ARCH=PPC
#ARCH=SPARC
......@@ -37,6 +36,10 @@ SYS=LINUX
#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
......@@ -126,19 +129,13 @@ CCFLAGS += -O6
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
......@@ -166,10 +163,12 @@ LCFLAGS += -Wall
# 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
......@@ -276,15 +275,17 @@ C_OBJ = $(interface_obj) \
#
# 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
......
......@@ -11,31 +11,4 @@
* 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"*/
......@@ -14,7 +14,7 @@
#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"
......
......@@ -97,6 +97,7 @@ static void Version ( void );
static void InitSignalHandler ( void );
static void SignalHandler ( int i_signal );
static int TestMMX ( void );
/*****************************************************************************
* main: parse command line, start interface and spawn threads
......@@ -116,6 +117,13 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
/*
* 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 */
{
......@@ -496,5 +504,73 @@ static void SignalHandler( int i_signal )
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
*****************************************************************************/
/*****************************************************************************
......@@ -133,9 +133,11 @@ int vout_SysManage( vout_thread_t *p_vout )
*****************************************************************************/
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 );
......@@ -218,12 +220,9 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
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;
......@@ -247,7 +246,7 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
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;
}
......@@ -303,8 +302,8 @@ static void FBCloseDisplay( vout_thread_t *p_vout )
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 );
}
/*****************************************************************************
......
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