[Mesa-dev] [PATCH 2/7] i965: Replace open-coded store/load SO_WRITE_OFFSET to/from mem

Chris Wilson chris at chris-wilson.co.uk
Fri Dec 9 10:54:18 UTC 2016


Rather than emit the instructions directions, make use of the helpers
brw_store_register_mem32() and brw_load_register_mem()

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 src/mesa/drivers/dri/i965/hsw_sol.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/hsw_sol.c b/src/mesa/drivers/dri/i965/hsw_sol.c
index 87d4ab531b..2f1112699b 100644
--- a/src/mesa/drivers/dri/i965/hsw_sol.c
+++ b/src/mesa/drivers/dri/i965/hsw_sol.c
@@ -204,15 +204,10 @@ hsw_pause_transform_feedback(struct gl_context *ctx,
       brw_emit_mi_flush(brw);
 
       /* Save the SOL buffer offset register values. */
-      for (int i = 0; i < BRW_MAX_XFB_STREAMS; i++) {
-         BEGIN_BATCH(3);
-         OUT_BATCH(MI_STORE_REGISTER_MEM | (3 - 2));
-         OUT_BATCH(GEN7_SO_WRITE_OFFSET(i));
-         OUT_RELOC(brw_obj->offset_bo,
-                   I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
-                   i * sizeof(uint32_t));
-         ADVANCE_BATCH();
-      }
+      for (int i = 0; i < BRW_MAX_XFB_STREAMS; i++)
+         brw_store_register_mem32(brw, brw_obj->offset_bo,
+                                  GEN7_SO_WRITE_OFFSET(i),
+                                  i * sizeof(uint32_t));
    }
 
    /* Add any primitives written to our tally */
@@ -232,15 +227,11 @@ hsw_resume_transform_feedback(struct gl_context *ctx,
 
    if (brw->is_haswell) {
       /* Reload the SOL buffer offset registers. */
-      for (int i = 0; i < BRW_MAX_XFB_STREAMS; i++) {
-         BEGIN_BATCH(3);
-         OUT_BATCH(GEN7_MI_LOAD_REGISTER_MEM | (3 - 2));
-         OUT_BATCH(GEN7_SO_WRITE_OFFSET(i));
-         OUT_RELOC(brw_obj->offset_bo,
-                   I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
-                   i * sizeof(uint32_t));
-         ADVANCE_BATCH();
-      }
+      for (int i = 0; i < BRW_MAX_XFB_STREAMS; i++)
+         brw_load_register_mem(brw, GEN7_SO_WRITE_OFFSET(i),
+                               brw_obj->offset_bo,
+                               I915_GEM_DOMAIN_INSTRUCTION, 0,
+                               i * sizeof(uint32_t));
    }
 
    /* Store the new starting value of the SO_NUM_PRIMS_WRITTEN counters. */
-- 
2.11.0



More information about the mesa-dev mailing list