From: Sam Hocevar Date: Thu, 10 Feb 2000 03:15:16 +0000 (+0000) Subject: . double buffering avec locks pour 3dfx X-Git-Tag: 0.1.99e~110 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3c7673b96f34fe8aa8e162159da7d93f2ed68275;p=vlc . double buffering avec locks pour 3dfx . gestion des touches pour l'interface 3dfx . proprification de la gestion des touches en framebuffer --- diff --git a/src/interface/intf_3dfx.c b/src/interface/intf_3dfx.c index eb75b94dec..713b34ac7b 100644 --- a/src/interface/intf_3dfx.c +++ b/src/interface/intf_3dfx.c @@ -14,6 +14,7 @@ #include #include /* close() */ #include /* for input.h */ +#include /* Glide kbhit() and getch() */ #include /* open() */ #include @@ -93,6 +94,15 @@ void intf_SysDestroy( intf_thread_t *p_intf ) ******************************************************************************/ void intf_SysManage( intf_thread_t *p_intf ) { - ; + unsigned int buf; + + /* very Linux specific - see tlib.c in Glide for other versions */ + while( kbhit() ) + { + if( intf_ProcessKey(p_intf, (int)buf = getch()) ) + { + printf("unhandled key '%c' (%i)\n", (char) buf, buf ); + } + } } diff --git a/src/video_output/video_3dfx.c b/src/video_output/video_3dfx.c index 27c2ac8670..52af642ad0 100644 --- a/src/video_output/video_3dfx.c +++ b/src/video_output/video_3dfx.c @@ -44,9 +44,7 @@ ******************************************************************************/ typedef struct vout_sys_s { - GrBuffer_t p_buffer; /* current buffer */ - GrLfbInfo_t p_backbufinfo; /* back buffer info */ - GrLfbInfo_t p_frontbufinfo; /* front buffer info */ + GrLfbInfo_t p_buffer_info; /* back buffer info */ /* Dummy video memory */ byte_t * p_video; /* base adress */ @@ -132,14 +130,16 @@ int vout_SysManage( vout_thread_t *p_vout ) ******************************************************************************/ void vout_SysDisplay( vout_thread_t *p_vout ) { - //grRenderBuffer( GR_BUFFER_FRONTBUFFER ); + grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER ); - /* swap the buffers */ -/* grBufferSwap( 1 ); + grBufferSwap( 0 ); - p_vout->p_sys->p_buffer - = ( p_vout->p_sys->p_buffer == GR_BUFFER_FRONTBUFFER ) ? - GR_BUFFER_BACKBUFFER : GR_BUFFER_FRONTBUFFER;*/ + if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER, + GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, + &p_vout->p_sys->p_buffer_info) == FXFALSE ) + { + intf_ErrMsg( "vout error: can't take 3dfx back buffer lock\n" ); + } } /* following functions are local */ @@ -153,6 +153,7 @@ static int GlideOpenDisplay( vout_thread_t *p_vout ) static char version[80]; GrHwConfiguration hwconfig; GrScreenResolution_t resolution = GR_RESOLUTION_640x480; + GrLfbInfo_t p_front_buffer_info; /* front buffer info */ p_vout->i_width = WIDTH; p_vout->i_height = HEIGHT; @@ -192,7 +193,7 @@ static int GlideOpenDisplay( vout_thread_t *p_vout ) } /* disable dithering */ - grDitherMode( GR_DITHER_DISABLE ); + //grDitherMode( GR_DITHER_DISABLE ); /* clear both buffers */ grRenderBuffer( GR_BUFFER_BACKBUFFER ); @@ -201,34 +202,34 @@ static int GlideOpenDisplay( vout_thread_t *p_vout ) grBufferClear( 0, 0, 0 ); grRenderBuffer( GR_BUFFER_BACKBUFFER ); - p_vout->p_sys->p_backbufinfo.size = sizeof( GrLfbInfo_t ); - p_vout->p_sys->p_frontbufinfo.size = sizeof( GrLfbInfo_t ); + p_vout->p_sys->p_buffer_info.size = sizeof( GrLfbInfo_t ); + p_front_buffer_info.size = sizeof( GrLfbInfo_t ); - /* lock the buffers */ + /* lock the buffers to find their adresses */ if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_FRONTBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, - &p_vout->p_sys->p_frontbufinfo) == FXFALSE ) + &p_front_buffer_info) == FXFALSE ) { intf_ErrMsg( "vout error: can't take 3dfx front buffer lock\n" ); grGlideShutdown(); return( 1 ); } + grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_FRONTBUFFER ); -/* if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER, + if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, - &p_vout->p_sys->p_backbufinfo) == FXFALSE ) + &p_vout->p_sys->p_buffer_info) == FXFALSE ) { intf_ErrMsg( "vout error: can't take 3dfx back buffer lock\n" ); grGlideShutdown(); return( 1 ); - }*/ + } - p_vout->p_sys->p_buffer = GR_BUFFER_BACKBUFFER; grBufferClear( 0, 0, 0 ); /* Set and initialize buffers */ - vout_SetBuffers( p_vout, p_vout->p_sys->p_frontbufinfo.lfbPtr, - p_vout->p_sys->p_frontbufinfo.lfbPtr ); + vout_SetBuffers( p_vout, p_vout->p_sys->p_buffer_info.lfbPtr, + p_front_buffer_info.lfbPtr ); return( 0 ); } @@ -242,8 +243,7 @@ static int GlideOpenDisplay( vout_thread_t *p_vout ) static void GlideCloseDisplay( vout_thread_t *p_vout ) { /* unlock the hidden buffer */ - //grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER ); - grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_FRONTBUFFER ); + grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER ); /* shutdown Glide */ grGlideShutdown(); diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index f0c5414282..1dd0005676 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -84,23 +84,23 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_ /* Initialize thread properties - thread id and locks will be initialized * later */ p_vout->b_die = 0; - p_vout->b_error = 0; + p_vout->b_error = 0; p_vout->b_active = 0; p_vout->pi_status = (pi_status != NULL) ? pi_status : &i_status; - *p_vout->pi_status = THREAD_CREATE; + *p_vout->pi_status = THREAD_CREATE; /* Initialize some fields used by the system-dependant method - these fields will * probably be modified by the method, and are only preferences */ p_vout->i_changes = 0; p_vout->i_width = i_width; p_vout->i_height = i_height; - p_vout->i_bytes_per_line = i_width * 2; + p_vout->i_bytes_per_line = i_width * 2; p_vout->i_screen_depth = 15; p_vout->i_bytes_per_pixel = 2; - p_vout->f_gamma = VOUT_GAMMA; + p_vout->f_gamma = VOUT_GAMMA; p_vout->b_grayscale = main_GetIntVariable( VOUT_GRAYSCALE_VAR, VOUT_GRAYSCALE_DEFAULT ); - p_vout->b_info = 0; + p_vout->b_info = 0; p_vout->b_interface = 0; p_vout->b_scale = 0; @@ -151,11 +151,11 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_ MaskToShift( &p_vout->i_blue_lshift, &p_vout->i_blue_rshift, p_vout->i_blue_mask ); /* Set some useful colors */ -/* p_vout->i_white_pixel = RGB2PIXEL( p_vout, 255, 255, 255 ); + p_vout->i_white_pixel = RGB2PIXEL( p_vout, 255, 255, 255 ); p_vout->i_black_pixel = RGB2PIXEL( p_vout, 0, 0, 0 ); p_vout->i_gray_pixel = RGB2PIXEL( p_vout, 128, 128, 128 ); p_vout->i_blue_pixel = RGB2PIXEL( p_vout, 0, 0, 50 ); -*/ + /* Load fonts - fonts must be initialized after the systme method since * they may be dependant of screen depth and other thread properties */ p_vout->p_default_font = vout_LoadFont( VOUT_DEFAULT_FONT );