iris/gen12: Write GFX_AUX_TABLE base address register
authorJordan Justen <jordan.l.justen@intel.com>
Fri, 27 Apr 2018 23:39:30 +0000 (16:39 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Mon, 28 Oct 2019 07:09:14 +0000 (00:09 -0700)
Rework:
 * Move last_aux_map_state to iris_batch. (Nanley, Ken)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_batch.h
src/gallium/drivers/iris/iris_blorp.c
src/gallium/drivers/iris/iris_context.c
src/gallium/drivers/iris/iris_genx_protos.h
src/gallium/drivers/iris/iris_state.c

index 557ba8dbfeaed43a978f90ed2a389d45133503fd..aaa425f5736417a022ba6f3e108f96ed815e204a 100644 (file)
@@ -126,6 +126,8 @@ struct iris_batch {
 
    /** Have we emitted any draw calls to this batch? */
    bool contains_draw;
+
+   uint32_t last_aux_map_state;
 };
 
 void iris_init_batch(struct iris_batch *batch,
index d6b99c59ca7b6fbb9ac25d699e7e7beae2bb7c62..a1c0dbbcf4e9c8464b610291c3d81ff78714007f 100644 (file)
@@ -317,6 +317,10 @@ iris_blorp_exec(struct blorp_batch *blorp_batch,
                               params->y1 - params->y0, scale);
    }
 
+#if GEN_GEN >= 12
+   genX(emit_aux_map_state)(batch);
+#endif
+
    iris_handle_always_flush_cache(batch);
 
    blorp_exec(blorp_batch, params);
index 28f6be70df19a3d1ba3a8114fe47af8923aee362..7859b72efdcebeaa120037c93c0f6185ccbb8fa7 100644 (file)
@@ -98,6 +98,7 @@ iris_lost_context_state(struct iris_batch *batch)
    ice->state.current_hash_scale = 0;
    memset(ice->state.last_grid, 0, sizeof(ice->state.last_grid));
    batch->last_surface_base_address = ~0ull;
+   batch->last_aux_map_state = 0;
    ice->vtbl.lost_genx_state(ice, batch);
 }
 
index 84d4b4b324c957a91050b3b1608a014d877a7a19..6e9a7ba5f8e1e6800c0ef287223dc3bac57c69a5 100644 (file)
@@ -41,6 +41,8 @@ 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);
+
 /* iris_blorp.c */
 void genX(init_blorp)(struct iris_context *ice);
 
index ac6a5dd5fd1d31a54fa4e4b80feedc3161333bf5..c56413b268d87af8aa4f1a098179df2c96b9f568 100644 (file)
@@ -98,6 +98,7 @@
 #include "drm-uapi/i915_drm.h"
 #include "nir.h"
 #include "intel/compiler/brw_compiler.h"
+#include "intel/common/gen_aux_map.h"
 #include "intel/common/gen_l3_config.h"
 #include "intel/common/gen_sample_positions.h"
 #include "iris_batch.h"
@@ -4989,6 +4990,30 @@ iris_viewport_zmin_zmax(const struct pipe_viewport_state *vp, bool halfz,
    util_viewport_zmin_zmax(vp, halfz, zmin, zmax);
 }
 
+#if GEN_GEN >= 12
+void
+genX(emit_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;
+   uint32_t aux_map_state_num = gen_aux_map_get_state_num(aux_map_ctx);
+   if (batch->last_aux_map_state != aux_map_state_num) {
+      /* If the aux-map state number increased, then we need to rewrite the
+       * register. Rewriting the register is used to both set the aux-map
+       * 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 && ALIGN(base_addr, 32 * 1024) == base_addr);
+      iris_load_register_imm64(batch, GENX(GFX_AUX_TABLE_BASE_ADDR_num),
+                               base_addr);
+      batch->last_aux_map_state = aux_map_state_num;
+   }
+}
+#endif
+
 static void
 iris_upload_dirty_render_state(struct iris_context *ice,
                                struct iris_batch *batch,
@@ -5840,6 +5865,10 @@ iris_upload_dirty_render_state(struct iris_context *ice,
 
    if (ice->state.current_hash_scale != 1)
       genX(emit_hashing_mode)(ice, batch, UINT_MAX, UINT_MAX, 1);
+
+#if GEN_GEN >= 12
+   genX(emit_aux_map_state)(batch);
+#endif
 }
 
 static void
@@ -6092,6 +6121,10 @@ iris_upload_compute_state(struct iris_context *ice,
    if (ice->state.need_border_colors)
       iris_use_pinned_bo(batch, ice->state.border_color_pool.bo, false);
 
+#if GEN_GEN >= 12
+   genX(emit_aux_map_state)(batch);
+#endif
+
    if (dirty & IRIS_DIRTY_CS) {
       /* The MEDIA_VFE_STATE documentation for Gen8+ says:
        *