Commit 3c7673b9 authored by Sam Hocevar's avatar Sam Hocevar

. double buffering avec locks pour 3dfx

 . gestion des touches pour l'interface 3dfx
 . proprification de la gestion des touches en framebuffer
parent c139cb70
......@@ -14,6 +14,7 @@
#include <termios.h>
#include <unistd.h> /* close() */
#include <sys/uio.h> /* for input.h */
#include <linutil.h> /* Glide kbhit() and getch() */
#include <sys/types.h> /* open() */
#include <sys/stat.h>
......@@ -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 );
}
}
}
......@@ -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();
......
......@@ -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 );
......
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