[Mesa-dev] [PATCH 1/4] i965/gen7: Use the updated interface for SO write pointer resetting.

Eric Anholt eric at anholt.net
Mon Jan 2 11:37:44 PST 2012


The new kernel patch I submitted makes the interface opt-in, so all
batchbuffers aren't preceded by the 4 MI_LOAD_REGISTER_IMMs.
---
 src/mesa/drivers/dri/i965/gen7_sol_state.c     |    2 ++
 src/mesa/drivers/dri/intel/intel_batchbuffer.c |   13 +++++++++----
 src/mesa/drivers/dri/intel/intel_context.h     |    1 +
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_sol_state.c b/src/mesa/drivers/dri/i965/gen7_sol_state.c
index 7346866..6cf68e2 100644
--- a/src/mesa/drivers/dri/i965/gen7_sol_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sol_state.c
@@ -231,6 +231,8 @@ upload_sol_state(struct brw_context *brw)
    if (active) {
       upload_3dstate_so_buffers(brw);
       upload_3dstate_so_decl_list(brw, &vue_map);
+
+      intel->batch.needs_sol_reset = true;
    }
 
    /* Finally, set up the SOL stage.  This command must always follow updates to
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index cb23dbc..90effd2 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -85,6 +85,7 @@ intel_batchbuffer_reset(struct intel_context *intel)
    intel->batch.reserved_space = BATCH_RESERVED;
    intel->batch.state_batch_offset = intel->batch.bo->size;
    intel->batch.used = 0;
+   intel->batch.needs_sol_reset = false;
 }
 
 void
@@ -135,16 +136,20 @@ do_flush_locked(struct intel_context *intel)
    }
 
    if (!intel->intelScreen->no_hw) {
-      int ring;
+      int flags;
 
       if (intel->gen < 6 || !batch->is_blit) {
-	 ring = I915_EXEC_RENDER;
+	 flags = I915_EXEC_RENDER;
       } else {
-	 ring = I915_EXEC_BLT;
+	 flags = I915_EXEC_BLT;
       }
 
+      if (batch->needs_sol_reset)
+	 flags |= I915_EXEC_GEN7_SOL_RESET;
+
       if (ret == 0)
-	 ret = drm_intel_bo_mrb_exec(batch->bo, 4*batch->used, NULL, 0, 0, ring);
+	 ret = drm_intel_bo_mrb_exec(batch->bo, 4*batch->used, NULL, 0, 0,
+				     flags);
    }
 
    if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) {
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 5fe8e24..9fb2902 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -233,6 +233,7 @@ struct intel_context
 
       uint32_t state_batch_offset;
       bool is_blit;
+      bool needs_sol_reset;
 
       struct {
 	 uint16_t used;
-- 
1.7.7.3



More information about the mesa-dev mailing list