Mesa (master): intel: Reserve enough space to finish occlusion queries on Gen6.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Aug 13 03:12:42 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Aug 10 10:26:04 2012 -0700

intel: Reserve enough space to finish occlusion queries on Gen6.

After realizing that brw_finish_batch emitted some final PIPE_CONTROLs
to record occlusion queries, Chris noted that we probably hadn't
reserved enough space to actually emit them.

Reserving a full 60 bytes seems a bit harsh, since we only need that
much if occlusion queries are actually active.  Plus, 28 bytes would be
sufficient for Gen7, and 24 for Gen4-5.

We could optimize this in the future, but it doesn't seem too critical.

NOTE: This is a candidate for stable release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53311
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i965/brw_vtbl.c           |    4 ++++
 src/mesa/drivers/dri/intel/intel_batchbuffer.h |   12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index e76b264..9951e7d 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -147,6 +147,10 @@ brw_update_draw_buffer(struct intel_context *intel)
 /**
  * called from intel_batchbuffer_flush and children before sending a
  * batchbuffer off.
+ *
+ * Note that ALL state emitted here must fit in the reserved space
+ * at the end of a batchbuffer.  If you add more GPU state, increase
+ * the BATCH_RESERVED macro.
  */
 static void brw_finish_batch(struct intel_context *intel)
 {
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index d2744e4..b8b60cd 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -11,7 +11,17 @@
 extern "C" {
 #endif
 
-#define BATCH_RESERVED 16
+/**
+ * Number of bytes to reserve for commands necessary to complete a batch.
+ *
+ * This includes:
+ * - MI_BATCHBUFFER_END (4 bytes)
+ * - Optional MI_NOOP for ensuring the batch length is qword aligned (4 bytes)
+ * - Any state emitted by vtbl->finish_batch()
+ *   - On 965+, this means ending occlusion queries (on Gen6, which has the
+ *     most workaround flushes, this can be as much as (4+4+5)*4 = 52 bytes)
+ */
+#define BATCH_RESERVED 60
 
 struct intel_batchbuffer;
 




More information about the mesa-commit mailing list