Commit d81e21d5 authored by Vincent Seguin's avatar Vincent Seguin

Mise au point du driver GGI.

parent 57429088
...@@ -215,7 +215,7 @@ endif ...@@ -215,7 +215,7 @@ endif
ifeq ($(ARCH),MMX) ifeq ($(ARCH),MMX)
ASM_OBJ = video_decoder_ref/idctmmx.o \ ASM_OBJ = video_decoder_ref/idctmmx.o \
video_output/yuv-mmx.o video_output/yuv_mmx.o
endif endif
C_OBJ = $(interface_obj) \ C_OBJ = $(interface_obj) \
......
...@@ -388,7 +388,7 @@ static void Usage( void ) ...@@ -388,7 +388,7 @@ static void Usage( void )
); );
/* Options */ /* Options */
intf_Msg("Options:" \ intf_Msg("Options:\n" \
" -h, --help print usage\n" \ " -h, --help print usage\n" \
" -g, --grayscale grayscale video\n" \ " -g, --grayscale grayscale video\n" \
" --noaudio disable audio\n" \ " --noaudio disable audio\n" \
...@@ -396,7 +396,7 @@ static void Usage( void ) ...@@ -396,7 +396,7 @@ static void Usage( void )
" --mono disable stereo\n" " --mono disable stereo\n"
" --novideo disable video\n" \ " --novideo disable video\n" \
" --color color video\n" \ " --color color video\n" \
" --novlans disable vlans\n" \ " --novlans disable vlans\n" \
); );
/* Interface parameters */ /* Interface parameters */
...@@ -408,7 +408,7 @@ static void Usage( void ) ...@@ -408,7 +408,7 @@ static void Usage( void )
intf_Msg("Audio parameters:\n" \ intf_Msg("Audio parameters:\n" \
" " AOUT_DSP_VAR "=<filename> dsp device path\n" \ " " AOUT_DSP_VAR "=<filename> dsp device path\n" \
" " AOUT_STEREO_VAR "={1|0} stereo or mono output\n" \ " " AOUT_STEREO_VAR "={1|0} stereo or mono output\n" \
" " AOUT_RATE_VAR "=<rate> output rate\n" \ " " AOUT_RATE_VAR "=<rate> output rate\n" \
); );
/* Video parameters */ /* Video parameters */
......
...@@ -32,8 +32,14 @@ typedef struct vout_sys_s ...@@ -32,8 +32,14 @@ typedef struct vout_sys_s
/* GGI system informations */ /* GGI system informations */
ggi_visual_t p_display; /* display device */ ggi_visual_t p_display; /* display device */
/* Buffer index */ /* Buffers informations */
int i_buffer_index; int i_buffer_index; /* buffer index */
ggi_directbuffer * pp_buffer[2]; /* buffers */
boolean_t b_must_acquire; /* must be acquired before writing */
/* Characters size */
int i_char_width;
int i_char_height;
} vout_sys_t; } vout_sys_t;
/******************************************************************************* /*******************************************************************************
...@@ -77,7 +83,13 @@ int vout_SysCreate( vout_thread_t *p_vout ) ...@@ -77,7 +83,13 @@ int vout_SysCreate( vout_thread_t *p_vout )
*******************************************************************************/ *******************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_SysInit( vout_thread_t *p_vout )
{ {
/* Acquire first buffer */
p_vout->p_sys->i_buffer_index = 0; p_vout->p_sys->i_buffer_index = 0;
if( p_vout->p_sys->b_must_acquire )
{
ggiResourceAcquire( p_vout->p_sys->pp_buffer[ 0 ]->resource, GGI_ACTYPE_WRITE );
}
return( 0 ); return( 0 );
} }
...@@ -88,7 +100,11 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -88,7 +100,11 @@ int vout_SysInit( vout_thread_t *p_vout )
*******************************************************************************/ *******************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_SysEnd( vout_thread_t *p_vout )
{ {
; /* Release buffer */
if( p_vout->p_sys->b_must_acquire )
{
ggiResourceRelease( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->resource );
}
} }
/******************************************************************************* /*******************************************************************************
...@@ -126,13 +142,24 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -126,13 +142,24 @@ int vout_SysManage( vout_thread_t *p_vout )
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_SysDisplay( vout_thread_t *p_vout )
{ {
/* Change display frame */ /* Change display frame */
if( p_vout->p_sys->b_must_acquire )
{
ggiResourceRelease( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->resource );
}
ggiFlush( p_vout->p_sys->p_display ); // ?? ggiFlush( p_vout->p_sys->p_display ); // ??
ggiSetDisplayFrame( p_vout->p_sys->p_display, p_vout->p_sys->i_buffer_index ); ggiSetDisplayFrame( p_vout->p_sys->p_display,
p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->frame );
/* Swap buffers and change write frame */ /* Swap buffers and change write frame */
p_vout->p_sys->i_buffer_index = ++p_vout->p_sys->i_buffer_index & 1; p_vout->p_sys->i_buffer_index = ++p_vout->p_sys->i_buffer_index & 1;
ggiSetWriteFrame( p_vout->p_sys->p_display, p_vout->p_sys->i_buffer_index ); if( p_vout->p_sys->b_must_acquire )
} {
ggiResourceAcquire( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->resource,
GGI_ACTYPE_WRITE );
}
ggiSetWriteFrame( p_vout->p_sys->p_display,
p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->frame );
}
/******************************************************************************* /*******************************************************************************
* vout_SysGetPicture: get current display buffer informations * vout_SysGetPicture: get current display buffer informations
...@@ -140,9 +167,41 @@ void vout_SysDisplay( vout_thread_t *p_vout ) ...@@ -140,9 +167,41 @@ void vout_SysDisplay( vout_thread_t *p_vout )
* This function returns the address of the current display buffer. * This function returns the address of the current display buffer.
*******************************************************************************/ *******************************************************************************/
byte_t * vout_SysGetPicture( vout_thread_t *p_vout ) byte_t * vout_SysGetPicture( vout_thread_t *p_vout )
{
return( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->write );
}
/*******************************************************************************
* vout_SysPrint: print simple text on a picture
*******************************************************************************
* This function will print a simple text on the picture. It is designed to
* print debugging or general informations, not to render subtitles.
*******************************************************************************/
void vout_SysPrint( vout_thread_t *p_vout, int i_x, int i_y, int i_halign,
int i_valign, unsigned char *psz_text )
{ {
//???? /* Update upper left coordinates according to alignment */
// return( p_vout->p_sys->p_ximage[ p_vout->p_sys->i_buffer_index ].data ); switch( i_halign )
{
case 0: /* centered */
i_x -= p_vout->p_sys->i_char_width * strlen( psz_text ) / 2;
break;
case 1: /* right aligned */
i_x -= p_vout->p_sys->i_char_width * strlen( psz_text );
break;
}
switch( i_valign )
{
case 0: /* centered */
i_y -= p_vout->p_sys->i_char_height / 2;
break;
case 1: /* bottom aligned */
i_y -= p_vout->p_sys->i_char_height;
break;
}
/* Print text */
ggiPuts( p_vout->p_sys->p_display, i_x, i_y, psz_text );
} }
/* following functions are local */ /* following functions are local */
...@@ -156,6 +215,9 @@ byte_t * vout_SysGetPicture( vout_thread_t *p_vout ) ...@@ -156,6 +215,9 @@ byte_t * vout_SysGetPicture( vout_thread_t *p_vout )
static int GGIOpenDisplay( vout_thread_t *p_vout ) static int GGIOpenDisplay( vout_thread_t *p_vout )
{ {
ggi_mode mode; /* mode descriptor */ ggi_mode mode; /* mode descriptor */
ggi_color col_fg; /* foreground color */
ggi_color col_bg; /* background color */
int i_index; /* all purposes index */
/* Initialize library */ /* Initialize library */
if( ggiInit() ) if( ggiInit() )
...@@ -176,7 +238,7 @@ static int GGIOpenDisplay( vout_thread_t *p_vout ) ...@@ -176,7 +238,7 @@ static int GGIOpenDisplay( vout_thread_t *p_vout )
/* Find most appropriate mode */ /* Find most appropriate mode */
mode.frames = 2; /* 2 buffers */ mode.frames = 2; /* 2 buffers */
mode.visible.x = p_vout->i_width; /* minimum width */ mode.visible.x = p_vout->i_width; /* minimum width */
mode.visible.y = p_vout->i_width; /* maximum width */ mode.visible.y = p_vout->i_height; /* minimum height */
mode.virt.x = GGI_AUTO; mode.virt.x = GGI_AUTO;
mode.virt.y = GGI_AUTO; mode.virt.y = GGI_AUTO;
mode.size.x = GGI_AUTO; mode.size.x = GGI_AUTO;
...@@ -198,9 +260,75 @@ static int GGIOpenDisplay( vout_thread_t *p_vout ) ...@@ -198,9 +260,75 @@ static int GGIOpenDisplay( vout_thread_t *p_vout )
return( 1 ); return( 1 );
} }
/* Check buffers properties */
p_vout->p_sys->b_must_acquire = 0;
for( i_index = 0; i_index < 2; i_index++ )
{
/* Get buffer address */
p_vout->p_sys->pp_buffer[ i_index ] =
ggiDBGetBuffer( p_vout->p_sys->p_display, i_index );
if( p_vout->p_sys->pp_buffer[ i_index ] == NULL )
{
intf_ErrMsg("error: double buffering is not possible\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Check buffer properties */
if( ! (p_vout->p_sys->pp_buffer[ i_index ]->type & GGI_DB_SIMPLE_PLB) ||
(p_vout->p_sys->pp_buffer[ i_index ]->page_size != 0) ||
(p_vout->p_sys->pp_buffer[ i_index ]->write == NULL ) ||
(p_vout->p_sys->pp_buffer[ i_index ]->noaccess != 0) ||
(p_vout->p_sys->pp_buffer[ i_index ]->align != 0) )
{
intf_ErrMsg("error: incorrect video memory type\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Check if buffer needs to be acquired before write */
if( ggiResourceMustAcquire( p_vout->p_sys->pp_buffer[ i_index ]->resource ) )
{
p_vout->p_sys->b_must_acquire = 1;
}
}
#ifdef DEBUG
if( p_vout->p_sys->b_must_acquire )
{
intf_DbgMsg("buffers must be acquired\n");
}
#endif
/* Get font size */
if( ggiGetCharSize( p_vout->p_sys->p_display, &p_vout->p_sys->i_char_width,
&p_vout->p_sys->i_char_height ) )
{
intf_ErrMsg("error: can't get font size\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Set graphic context colors */
col_fg.r = col_fg.g = col_fg.b = -1;
col_bg.r = col_bg.g = col_bg.b = 0;
if( ggiSetGCForeground(p_vout->p_sys->p_display,
ggiMapColor(p_vout->p_sys->p_display,&col_fg)) ||
ggiSetGCBackground(p_vout->p_sys->p_display,
ggiMapColor(p_vout->p_sys->p_display,&col_bg)) )
{
intf_ErrMsg("error: can't set colors\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Set thread information */ /* Set thread information */
p_vout->i_width = mode.visible.x; p_vout->i_width = mode.visible.x;
p_vout->i_height = mode.visible.y; p_vout->i_height = mode.visible.y;
p_vout->i_bytes_per_line = p_vout->p_sys->pp_buffer[ 0 ]->buffer.plb.stride;
switch( mode.graphtype ) switch( mode.graphtype )
{ {
case GT_15BIT: case GT_15BIT:
......
...@@ -177,7 +177,11 @@ vout_thread_t * vout_CreateThread ( ...@@ -177,7 +177,11 @@ vout_thread_t * vout_CreateThread (
/* Initialize some fields used by the system-dependant method - these fields will /* Initialize some fields used by the system-dependant method - these fields will
* probably be modified by the method */ * probably be modified by the method */
#ifdef DEBUG
p_vout->b_info = 1;
#else
p_vout->b_info = 0; p_vout->b_info = 0;
#endif
p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR, p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR,
VOUT_GRAYSCALE_DEFAULT ); VOUT_GRAYSCALE_DEFAULT );
p_vout->i_width = i_width; p_vout->i_width = i_width;
......
/* /*******************************************************************************
*------------------------------------------------------------------------- * yuv_mmx.S: YUV transformation, optimized for MMX processors
*cxm12161 -- This function performs YUV12-to-RGB16 color conversion for H26x. * (c)1999 VideoLAN
*******************************************************************************
* Following functions are defined:
* vout_YUV420_16_MMX
* This function performs YUV12-to-RGB16 color conversion for H26x.
* It handles any format in which there are three fields, the low * It handles any format in which there are three fields, the low
* order field being B and fully contained in the low order byte, the * order field being B and fully contained in the low order byte, the
* second field being G and being somewhere in bits 4 through 11, * second field being G and being somewhere in bits 4 through 11,
...@@ -15,7 +19,7 @@ ...@@ -15,7 +19,7 @@
* Height may be any amount, but must be a multiple of two. The U * Height may be any amount, but must be a multiple of two. The U
* and V planes may have a different pitch than the Y plane, subject * and V planes may have a different pitch than the Y plane, subject
* to the same limitations. * to the same limitations.
*/ *******************************************************************************/
//.include iammx.inc //.include iammx.inc
//.include locals.inc //.include locals.inc
...@@ -85,9 +89,8 @@ sixbitu: .quad 0xc0c0c0c0c0c0c0c0 ...@@ -85,9 +89,8 @@ sixbitu: .quad 0xc0c0c0c0c0c0c0c0
#define GUpperLimit 140 #define GUpperLimit 140
#define BUpperLimit 148 #define BUpperLimit 148
/* /*
* extern void C MMX_YUV12ToRGB16 ( * extern void C vout_YUV420_16_MMX (
* U8* YPlane, * U8* YPlane,
* U8* UPlane, * U8* UPlane,
* U8* VPlane, * U8* VPlane,
...@@ -113,8 +116,8 @@ sixbitu: .quad 0xc0c0c0c0c0c0c0c0 ...@@ -113,8 +116,8 @@ sixbitu: .quad 0xc0c0c0c0c0c0c0c0
* RGB655 = 3 * RGB655 = 3
*/ */
.globl yuv_2_rgb .globl vout_YUV420_16_MMX
yuv_2_rgb: vout_YUV420_16_MMX:
pushl %esi pushl %esi
pushl %edi pushl %edi
......
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