Mesa (master): intel: Only do batchbuffer debug if --enable-debug is used.

Eric Anholt anholt at kemper.freedesktop.org
Fri Mar 5 23:25:24 UTC 2010


Module: Mesa
Branch: master
Commit: 855515859ec1d94737ea91167220ba7b568c144d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=855515859ec1d94737ea91167220ba7b568c144d

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Mar  5 12:56:40 2010 -0800

intel: Only do batchbuffer debug if --enable-debug is used.

This saves 6.6KB on the 965 driver, and appears to speed
firefox-talos-gfx up by 1-2%.  Unlike many other asserts in the
driver, when we make a mistake that would trigger one of these it
generally shows up all the time for developers, so turning it off for
release seems fine.

---

 src/mesa/drivers/dri/intel/intel_batchbuffer.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index 5e0ea91..e5ad261 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -24,11 +24,13 @@ struct intel_batchbuffer
 
    GLuint size;
 
+#ifdef DEBUG
    /** Tracking of BEGIN_BATCH()/OUT_BATCH()/ADVANCE_BATCH() debugging */
    struct {
       GLuint total;
       GLubyte *start_ptr;
    } emit;
+#endif
 
    GLuint dirty_state;
    GLuint reserved_space;
@@ -97,7 +99,9 @@ intel_batchbuffer_space(struct intel_batchbuffer *batch)
 static INLINE void
 intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch, GLuint dword)
 {
+#ifdef DEBUG
    assert(intel_batchbuffer_space(batch) >= 4);
+#endif
    *(GLuint *) (batch->ptr) = dword;
    batch->ptr += 4;
 }
@@ -112,7 +116,9 @@ static INLINE void
 intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
                                 GLuint sz)
 {
+#ifdef DEBUG
    assert(sz < batch->size - 8);
+#endif
    if (intel_batchbuffer_space(batch) < sz)
       intel_batchbuffer_flush(batch);
 }
@@ -121,15 +127,18 @@ static INLINE void
 intel_batchbuffer_begin(struct intel_batchbuffer *batch, int n)
 {
    intel_batchbuffer_require_space(batch, n * 4);
+#ifdef DEBUG
    assert(batch->map);
    assert(batch->emit.start_ptr == NULL);
    batch->emit.total = n * 4;
    batch->emit.start_ptr = batch->ptr;
+#endif
 }
 
 static INLINE void
 intel_batchbuffer_advance(struct intel_batchbuffer *batch)
 {
+#ifdef DEBUG
    unsigned int _n = batch->ptr - batch->emit.start_ptr;
    assert(batch->emit.start_ptr != NULL);
    if (_n != batch->emit.total) {
@@ -138,6 +147,7 @@ intel_batchbuffer_advance(struct intel_batchbuffer *batch)
       abort();
    }
    batch->emit.start_ptr = NULL;
+#endif
 }
 
 /* Here are the crusty old macros, to be removed:




More information about the mesa-commit mailing list