OSDN Git Service

Pull hardware locking out into SpanRenderStart/Finish rather than
authorEric Anholt <anholt@FreeBSD.org>
Mon, 30 May 2005 06:15:29 +0000 (06:15 +0000)
committerEric Anholt <anholt@FreeBSD.org>
Mon, 30 May 2005 06:15:29 +0000 (06:15 +0000)
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

index 4279dfd..8487f4b 100644 (file)
@@ -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;                       \
    }
 
 
-#define HW_LOCK()                              \
-   mgaContextPtr mmesa = MGA_CONTEXT(ctx);     \
-   FLUSH_BATCH(mmesa);                         \
-   LOCK_HARDWARE_QUIESCENT(mmesa);
-
+#define HW_LOCK()
 
 #define HW_CLIPLOOP()                                          \
   do {                                                         \
     }                                          \
   } 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.
  */