From b328dded7513c6092861197f6ba2edf9341e46d3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 30 May 2005 06:15:29 +0000 Subject: [PATCH] Pull hardware locking out into SpanRenderStart/Finish rather than HW_LOCK/UNLOCK. Provides a 61% performance improvement in no_rast=true quake3 (n=2, 320x240, 16bpp, p4 1ghz), and a factor of 3 improvement in no_rast glxgears. --- src/mesa/drivers/dri/mga/mgaspan.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c index 4279dfd95bc..8487f4b83f6 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.c +++ b/src/mesa/drivers/dri/mga/mgaspan.c @@ -36,6 +36,7 @@ #define DBG 0 #define LOCAL_VARS \ + mgaContextPtr mmesa = MGA_CONTEXT(ctx); \ __DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \ mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ __DRIscreenPrivate *sPriv = mmesa->driScreen; \ @@ -55,6 +56,7 @@ #define LOCAL_DEPTH_VARS \ + mgaContextPtr mmesa = MGA_CONTEXT(ctx); \ __DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \ mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ __DRIscreenPrivate *sPriv = mmesa->driScreen; \ @@ -81,11 +83,7 @@ } -#define HW_LOCK() \ - mgaContextPtr mmesa = MGA_CONTEXT(ctx); \ - FLUSH_BATCH(mmesa); \ - LOCK_HARDWARE_QUIESCENT(mmesa); - +#define HW_LOCK() #define HW_CLIPLOOP() \ do { \ @@ -100,10 +98,7 @@ } \ } while (0) -#define HW_UNLOCK() \ - UNLOCK_HARDWARE(mmesa); - - +#define HW_UNLOCK() @@ -220,6 +215,20 @@ static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer, ? mmesa->driDrawable : mmesa->driReadable; } +void mgaSpanRenderStart( GLcontext *ctx ) +{ + mgaContextPtr mmesa = MGA_CONTEXT(ctx); + FLUSH_BATCH( mmesa ); + LOCK_HARDWARE_QUIESCENT( mmesa ); +} + +void mgaSpanRenderFinish( GLcontext *ctx ) +{ + mgaContextPtr mmesa = MGA_CONTEXT(ctx); + _swrast_flush( ctx ); + UNLOCK_HARDWARE( mmesa ); +} + /** * Initialize the driver callbacks for the read / write span functions. * @@ -269,10 +278,11 @@ void mgaDDInitSpanFuncs( GLcontext *ctx ) #endif break; } + swdd->SpanRenderStart = mgaSpanRenderStart; + swdd->SpanRenderFinish = mgaSpanRenderFinish; } - /** * Plug in the Get/Put routines for the given driRenderbuffer. */ -- 2.30.2