[Mesa-dev] [RFC PATCH 09/12] i965: Flush on-chip binding table to pool

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Mon Jul 8 06:17:00 PDT 2013


When the resource streamer encounters 3DSTATE_BINDING_TABLE_POINTERS_* command,
it will flush the edited state of our on-chip binding table to the pool. Previously,
the CS will just normally consume this state. But when RS is enabled, it first processes
this command before passing it to the CS causing a flush to the location specified.

We don't want the RS to keep flushing all the time when the state of on-chip binding tables
is unchanged. So make sure to flush it only when binding table state is dirty.

Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/mesa/drivers/dri/i965/gen7_vs_state.c |   10 ++++++----
 src/mesa/drivers/dri/i965/gen7_wm_state.c |   10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_vs_state.c b/src/mesa/drivers/dri/i965/gen7_vs_state.c
index 1b97e8c..b7956fd 100644
--- a/src/mesa/drivers/dri/i965/gen7_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c
@@ -40,10 +40,12 @@ upload_vs_state(struct brw_context *brw)
    gen7_emit_vs_workaround_flush(intel);
 
    /* BRW_NEW_VS_BINDING_TABLE */
-   BEGIN_BATCH(2);
-   OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_VS << 16 | (2 - 2));
-   OUT_BATCH(brw->vs.bind_bo_offset);
-   ADVANCE_BATCH();
+   if (brw->state.dirty.brw & BRW_NEW_VS_BINDING_TABLE) {
+      BEGIN_BATCH(2);
+      OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_VS << 16 | (2 - 2));
+      OUT_BATCH(brw->vs.bind_bo_offset & 0xFFC0);
+      ADVANCE_BATCH();
+   }
 
    /* CACHE_NEW_SAMPLER */
    BEGIN_BATCH(2);
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c
index b025551..faa8bab 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c
@@ -119,10 +119,12 @@ upload_ps_state(struct brw_context *brw)
       HSW_PS_MAX_THREADS_SHIFT : IVB_PS_MAX_THREADS_SHIFT;
 
    /* BRW_NEW_PS_BINDING_TABLE */
-   BEGIN_BATCH(2);
-   OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_PS << 16 | (2 - 2));
-   OUT_BATCH(brw->wm.bind_bo_offset);
-   ADVANCE_BATCH();
+   if (brw->state.dirty.brw & BRW_NEW_PS_BINDING_TABLE) {
+      BEGIN_BATCH(2);
+      OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_PS << 16 | (2 - 2));
+      OUT_BATCH(brw->wm.bind_bo_offset & 0xFFC0);
+      ADVANCE_BATCH();
+   }
 
    /* CACHE_NEW_SAMPLER */
    BEGIN_BATCH(2);
-- 
1.7.9.5



More information about the mesa-dev mailing list