i965: Expose write_reg() as brw_store_register_mem64().
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 28 May 2013 02:51:35 +0000 (19:51 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 23 Oct 2013 08:06:26 +0000 (01:06 -0700)
Writing a 64-bit register value to memory is sufficiently complicated
that it makes sense to reuse this function rather than duplicating it.

Exposing it outside of gen6_queryobj.c means it needs a more descriptive
function name.  It could probably be moved to brw_util.c or somewhere
else, but this works too.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/gen6_queryobj.c

index 3b95922d997d1e03088a479326ae8dd71fbf8dde..0229cc5b89a33ddb09d7d7d83e8e14df48898aea 100644 (file)
@@ -1460,6 +1460,8 @@ void brw_emit_query_end(struct brw_context *brw);
 
 /** gen6_queryobj.c */
 void gen6_init_queryobj_functions(struct dd_function_table *functions);
+void brw_store_register_mem64(struct brw_context *brw,
+                              drm_intel_bo *bo, uint32_t reg, int idx);
 
 /*======================================================================
  * brw_state_dump.c
index dd5cfc2bff2d4f90ae7ce17ea55425659f4528b9..add4df94ea3fa65fb22068d3f8d6c435ca349ceb 100644 (file)
@@ -103,9 +103,9 @@ write_depth_count(struct brw_context *brw, drm_intel_bo *query_bo, int idx)
  * Callers must explicitly flush the pipeline to ensure the desired value is
  * available.
  */
-static void
-write_reg(struct brw_context *brw,
-          drm_intel_bo *query_bo, uint32_t reg, int idx)
+void
+brw_store_register_mem64(struct brw_context *brw,
+                         drm_intel_bo *bo, uint32_t reg, int idx)
 {
    assert(brw->gen >= 6);
 
@@ -115,14 +115,14 @@ write_reg(struct brw_context *brw,
    BEGIN_BATCH(3);
    OUT_BATCH(MI_STORE_REGISTER_MEM | (3 - 2));
    OUT_BATCH(reg);
-   OUT_RELOC(query_bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+   OUT_RELOC(bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
              idx * sizeof(uint64_t));
    ADVANCE_BATCH();
 
    BEGIN_BATCH(3);
    OUT_BATCH(MI_STORE_REGISTER_MEM | (3 - 2));
    OUT_BATCH(reg + sizeof(uint32_t));
-   OUT_RELOC(query_bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+   OUT_RELOC(bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
              sizeof(uint32_t) + idx * sizeof(uint64_t));
    ADVANCE_BATCH();
 }
@@ -133,19 +133,19 @@ write_primitives_generated(struct brw_context *brw,
 {
    intel_batchbuffer_emit_mi_flush(brw);
 
-   write_reg(brw, query_bo, CL_INVOCATION_COUNT, idx);
+   brw_store_register_mem64(brw, query_bo, CL_INVOCATION_COUNT, idx);
 }
 
 static void
 write_xfb_primitives_written(struct brw_context *brw,
-                             drm_intel_bo *query_bo, int idx)
+                             drm_intel_bo *bo, int idx)
 {
    intel_batchbuffer_emit_mi_flush(brw);
 
    if (brw->gen >= 7) {
-      write_reg(brw, query_bo, GEN7_SO_NUM_PRIMS_WRITTEN(0), idx);
+      brw_store_register_mem64(brw, bo, GEN7_SO_NUM_PRIMS_WRITTEN(0), idx);
    } else {
-      write_reg(brw, query_bo, GEN6_SO_NUM_PRIMS_WRITTEN, idx);
+      brw_store_register_mem64(brw, bo, GEN6_SO_NUM_PRIMS_WRITTEN, idx);
    }
 }