[Mesa-dev] [PATCH 04/27] i965: Introduce a "render ring prelude" hook.

Kenneth Graunke kenneth at whitecape.org
Wed Nov 13 17:52:09 PST 2013


The new intel_batchbuffer_emit_render_ring_prelude() hook will be called
when switching from BLT or UNKNOWN_RING to RENDER_RING.  This provides a
place to emit state that should go at the start of each render ring
batch, with minimal overhead.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: Eric Anholt <eric at anholt.net>
Cc: Carl Worth <cworth at cworth.org>
Cc: Juha-Pekka Heikkilä <juha-pekka.heikkila at intel.com>
---
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 5 +++++
 src/mesa/drivers/dri/i965/intel_batchbuffer.h | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index ab01c02..7598955 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -179,6 +179,11 @@ do_batch_dump(struct brw_context *brw)
    }
 }
 
+void
+intel_batchbuffer_emit_render_ring_prelude(struct brw_context *brw)
+{
+}
+
 /**
  * Called when starting a new batch buffer.
  */
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
index 170211b..38149f3 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
@@ -24,6 +24,7 @@ extern "C" {
 
 struct intel_batchbuffer;
 
+void intel_batchbuffer_emit_render_ring_prelude(struct brw_context *brw);
 void intel_batchbuffer_init(struct brw_context *brw);
 void intel_batchbuffer_free(struct brw_context *brw);
 void intel_batchbuffer_save_state(struct brw_context *brw);
@@ -117,10 +118,14 @@ intel_batchbuffer_require_space(struct brw_context *brw, GLuint sz,
    if (intel_batchbuffer_space(brw) < sz)
       intel_batchbuffer_flush(brw);
 
+   enum brw_gpu_ring prev_ring = brw->batch.ring;
    /* The intel_batchbuffer_flush() calls above might have changed
     * brw->batch.ring to UNKNOWN_RING, so we need to set it here at the end.
     */
    brw->batch.ring = ring;
+
+   if (unlikely(prev_ring == UNKNOWN_RING && ring == RENDER_RING))
+      intel_batchbuffer_emit_render_ring_prelude(brw);
 }
 
 static INLINE void
-- 
1.8.3.2



More information about the mesa-dev mailing list