From 9d05d3dd308c4655673a710d0c10f09cac9c0d83 Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Sun, 6 Mar 2005 03:52:01 +0000 Subject: [PATCH] Don't synchronize after each frame. Allow the GPU to be one frame ahead of the CPU for more parallelism of CPU and GPU. Unfortunately there seems to be some broken hardware (like my ProSavageDDR) on which status register updates are delayed sometimes. This leads to very jerky animation if the hardware can buffer more than the current frame. A new option "sync_frames" can be used as a remedy on such broken hardware. --- src/mesa/drivers/dri/savage/savage_xmesa.c | 12 ++++++++++-- src/mesa/drivers/dri/savage/savagecontext.h | 1 + src/mesa/drivers/dri/savage/savageioctl.c | 18 ++++++------------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 8e11ef24995..522c6275c48 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -69,6 +69,11 @@ DRI_CONF_OPT_BEGIN(enable_fastpath,bool,def) \ DRI_CONF_DESC(en,"Use fast path for unclipped primitives") \ DRI_CONF_DESC(de,"Schneller Codepfad für ungeschnittene Polygone") \ DRI_CONF_OPT_END +#define SAVAGE_SYNC_FRAMES(def) \ +DRI_CONF_OPT_BEGIN(sync_frames,bool,def) \ + DRI_CONF_DESC(en,"Synchronize with graphics hardware after each frame") \ + DRI_CONF_DESC(de,"Synchronisiere nach jedem Frame mit Grafikhardware") \ +DRI_CONF_OPT_END /* Configuration */ @@ -80,16 +85,17 @@ DRI_CONF_BEGIN DRI_CONF_FLOAT_DEPTH(false) DRI_CONF_SECTION_END DRI_CONF_SECTION_PERFORMANCE - DRI_CONF_MAX_TEXTURE_UNITS(2,1,2) SAVAGE_ENABLE_VDMA(true) SAVAGE_ENABLE_FASTPATH(true) + SAVAGE_SYNC_FRAMES(false) + DRI_CONF_MAX_TEXTURE_UNITS(2,1,2) DRI_CONF_TEXTURE_HEAPS(DRI_CONF_TEXTURE_HEAPS_ALL) DRI_CONF_SECTION_END DRI_CONF_SECTION_DEBUG DRI_CONF_NO_RAST(false) DRI_CONF_SECTION_END DRI_CONF_END; -static const GLuint __driNConfigOptions = 8; +static const GLuint __driNConfigOptions = 9; #ifdef USE_NEW_INTERFACE static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; @@ -499,6 +505,8 @@ savageCreateContext( const __GLcontextModes *mesaVis, else imesa->enable_vdma = driQueryOptionb(&imesa->optionCache, "enable_vdma"); + imesa->sync_frames = driQueryOptionb(&imesa->optionCache, "sync_frames"); + /* Configure swrast to match hardware characteristics: */ _tnl_allow_pixel_fog( ctx, GL_FALSE ); diff --git a/src/mesa/drivers/dri/savage/savagecontext.h b/src/mesa/drivers/dri/savage/savagecontext.h index 3bf688ce10c..30a97150a8c 100644 --- a/src/mesa/drivers/dri/savage/savagecontext.h +++ b/src/mesa/drivers/dri/savage/savagecontext.h @@ -301,6 +301,7 @@ struct savage_context_t { GLboolean float_depth; GLboolean enable_fastpath; GLboolean enable_vdma; + GLboolean sync_frames; }; #define SAVAGE_CONTEXT(ctx) ((savageContextPtr)(ctx->DriverCtx)) diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c index 5399963cb97..9f3a028428f 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.c +++ b/src/mesa/drivers/dri/savage/savageioctl.c @@ -423,12 +423,6 @@ static void savageDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all, _swrast_Clear( ctx, mask, all, cx, cy, cw, ch ); } - -/* This is necessary to avoid very jerky animation on my ProSavageDDR. - * Seems to work fine on other Savages though. Make this configurable! - */ -#define SYNC_FRAMES 1 - /* * Copy the back buffer to the front buffer. */ @@ -449,9 +443,9 @@ void savageSwapBuffers( __DRIdrawablePrivate *dPriv ) FLUSH_BATCH(imesa); -#if SYNC_FRAMES - imesa->lastSwap = savageEmitEvent( imesa, 0 ); -#endif + if (imesa->sync_frames) + imesa->lastSwap = savageEmitEvent( imesa, 0 ); + if (imesa->lastSwap != 0) savageWaitEvent( imesa, imesa->lastSwap ); @@ -463,9 +457,9 @@ void savageSwapBuffers( __DRIdrawablePrivate *dPriv ) imesa->inSwap = GL_FALSE; } -#if !SYNC_FRAMES - imesa->lastSwap = savageEmitEvent( imesa, 0 ); -#endif + if (!imesa->sync_frames) + /* don't sync, but limit the lag to one frame. */ + imesa->lastSwap = savageEmitEvent( imesa, 0 ); } unsigned int savageEmitEventLocked( savageContextPtr imesa, unsigned int flags ) -- 2.30.2