From 855515859ec1d94737ea91167220ba7b568c144d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 5 Mar 2010 12:56:40 -0800 Subject: [PATCH] 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 file changed, 10 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index 5e0ea916b4e..e5ad2617ab9 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: -- 2.30.2