Module: Mesa
Branch: staging/20.0
Commit: e5e0fdf50f9552f64b1af311b88bee9c5cfc76c3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5e0fdf50f9552f64b1af311b88bee9c5cfc76c3

Author: Rafael Antognolli <[email protected]>
Date:   Tue Feb 25 15:04:08 2020 -0800

iris: Split aux map initialization from invalidation.

We can write the aux map address only once during the batch
initialization, and then only invalidate it once we modify it.

Reviewed-by: Jason Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4005>
(cherry picked from commit a7de6f1321a00316a59effeed93365f6979e6c69)

---

 .pick_status.json                           |  2 +-
 src/gallium/drivers/iris/iris_blorp.c       |  2 +-
 src/gallium/drivers/iris/iris_genx_protos.h |  2 +-
 src/gallium/drivers/iris/iris_state.c       | 39 +++++++++++++++++++++++------
 4 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index bc1da2486ae..1cbacc90be3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -6124,7 +6124,7 @@
         "description": "iris: Split aux map initialization from invalidation.",
         "nominated": false,
         "nomination_type": null,
-        "resolution": 4,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/iris/iris_blorp.c 
b/src/gallium/drivers/iris/iris_blorp.c
index ec08c25019d..3162571d8d0 100644
--- a/src/gallium/drivers/iris/iris_blorp.c
+++ b/src/gallium/drivers/iris/iris_blorp.c
@@ -302,7 +302,7 @@ iris_blorp_exec(struct blorp_batch *blorp_batch,
    }
 
 #if GEN_GEN >= 12
-   genX(emit_aux_map_state)(batch);
+   genX(invalidate_aux_map_state)(batch);
 #endif
 
    iris_handle_always_flush_cache(batch);
diff --git a/src/gallium/drivers/iris/iris_genx_protos.h 
b/src/gallium/drivers/iris/iris_genx_protos.h
index 6d59f936e37..407d77684b3 100644
--- a/src/gallium/drivers/iris/iris_genx_protos.h
+++ b/src/gallium/drivers/iris/iris_genx_protos.h
@@ -37,7 +37,7 @@ void genX(update_pma_fix)(struct iris_context *ice,
                           struct iris_batch *batch,
                           bool enable);
 
-void genX(emit_aux_map_state)(struct iris_batch *batch);
+void genX(invalidate_aux_map_state)(struct iris_batch *batch);
 
 /* iris_blorp.c */
 void genX(init_blorp)(struct iris_context *ice);
diff --git a/src/gallium/drivers/iris/iris_state.c 
b/src/gallium/drivers/iris/iris_state.c
index 34a3d646954..a7795b076bb 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -880,6 +880,11 @@ iris_alloc_push_constants(struct iris_batch *batch)
    }
 }
 
+#if GEN_GEN >= 12
+static void
+init_aux_map_state(struct iris_batch *batch);
+#endif
+
 /**
  * Upload the initial GPU state for a render context.
  *
@@ -996,6 +1001,10 @@ iris_init_render_context(struct iris_batch *batch)
    iris_emit_cmd(batch, GENX(3DSTATE_POLY_STIPPLE_OFFSET), foo);
 
    iris_alloc_push_constants(batch);
+
+#if GEN_GEN >= 12
+   init_aux_map_state(batch);
+#endif
 }
 
 static void
@@ -1025,6 +1034,11 @@ iris_init_compute_context(struct iris_batch *batch)
    if (devinfo->is_geminilake)
       init_glk_barrier_mode(batch, GLK_BARRIER_MODE_GPGPU);
 #endif
+
+#if GEN_GEN >= 12
+   init_aux_map_state(batch);
+#endif
+
 }
 
 struct iris_vertex_buffer_state {
@@ -5109,7 +5123,7 @@ iris_viewport_zmin_zmax(const struct pipe_viewport_state 
*vp, bool halfz,
 
 #if GEN_GEN >= 12
 void
-genX(emit_aux_map_state)(struct iris_batch *batch)
+genX(invalidate_aux_map_state)(struct iris_batch *batch)
 {
    struct iris_screen *screen = batch->screen;
    void *aux_map_ctx = iris_bufmgr_get_aux_map_context(screen->bufmgr);
@@ -5122,13 +5136,24 @@ genX(emit_aux_map_state)(struct iris_batch *batch)
        * translation table address, and also to invalidate any previously
        * cached translations.
        */
-      uint64_t base_addr = gen_aux_map_get_base(aux_map_ctx);
-      assert(base_addr != 0 && align64(base_addr, 32 * 1024) == base_addr);
-      iris_load_register_imm64(batch, GENX(GFX_AUX_TABLE_BASE_ADDR_num),
-                               base_addr);
+      iris_load_register_imm32(batch, GENX(GFX_CCS_AUX_INV_num), 1);
       batch->last_aux_map_state = aux_map_state_num;
    }
 }
+
+static void
+init_aux_map_state(struct iris_batch *batch)
+{
+   struct iris_screen *screen = batch->screen;
+   void *aux_map_ctx = iris_bufmgr_get_aux_map_context(screen->bufmgr);
+   if (!aux_map_ctx)
+      return;
+
+   uint64_t base_addr = gen_aux_map_get_base(aux_map_ctx);
+   assert(base_addr != 0 && align64(base_addr, 32 * 1024) == base_addr);
+   iris_load_register_imm64(batch, GENX(GFX_AUX_TABLE_BASE_ADDR_num),
+                            base_addr);
+}
 #endif
 
 struct push_bos {
@@ -6179,7 +6204,7 @@ iris_upload_dirty_render_state(struct iris_context *ice,
       genX(emit_hashing_mode)(ice, batch, UINT_MAX, UINT_MAX, 1);
 
 #if GEN_GEN >= 12
-   genX(emit_aux_map_state)(batch);
+   genX(invalidate_aux_map_state)(batch);
 #endif
 }
 
@@ -6436,7 +6461,7 @@ iris_upload_compute_state(struct iris_context *ice,
       iris_use_pinned_bo(batch, ice->state.border_color_pool.bo, false);
 
 #if GEN_GEN >= 12
-   genX(emit_aux_map_state)(batch);
+   genX(invalidate_aux_map_state)(batch);
 #endif
 
    if (dirty & IRIS_DIRTY_CS) {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to