From 99f3178a249525d333c5b27d755a0f99a81b3c17 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 17 Jan 2020 11:37:31 -0600 Subject: [PATCH] iris: Store the L3$ configs in the screen We only calculate them based on device info and never change them so this seems like a reasonable place to put them. We could also put them in the context, but that's not accessible from iris_init_*_context. Cc: "20.0" mesa-stable@lists.freedesktop.org Reviewed-by: Jordan Justen Reviewed-by: Kenneth Graunke Part-of: --- src/gallium/drivers/iris/iris_screen.c | 15 +++++++++++++++ src/gallium/drivers/iris/iris_screen.h | 4 ++++ src/gallium/drivers/iris/iris_state.c | 16 ++-------------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index 736d849feb8..fd7f5f70165 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -53,6 +53,7 @@ #include "iris_screen.h" #include "intel/compiler/brw_compiler.h" #include "intel/common/gen_gem.h" +#include "intel/common/gen_l3_config.h" #include "iris_monitor.h" static void @@ -575,6 +576,17 @@ iris_getparam_integer(struct iris_screen *screen, int param) return -1; } +static const struct gen_l3_config * +iris_get_default_l3_config(const struct gen_device_info *devinfo, + bool compute) +{ + bool wants_dc_cache = true; + bool has_slm = compute; + const struct gen_l3_weights w = + gen_get_default_l3_weights(devinfo, wants_dc_cache, has_slm); + return gen_get_l3_config(devinfo, w); +} + static void iris_shader_debug_log(void *data, const char *fmt, ...) { @@ -673,6 +685,9 @@ iris_screen_create(int fd, const struct pipe_screen_config *config) screen->compiler->supports_shader_constants = true; screen->compiler->compact_params = false; + screen->l3_config_3d = iris_get_default_l3_config(&screen->devinfo, false); + screen->l3_config_cs = iris_get_default_l3_config(&screen->devinfo, true); + iris_disk_cache_init(screen); slab_create_parent(&screen->transfer_pool, diff --git a/src/gallium/drivers/iris/iris_screen.h b/src/gallium/drivers/iris/iris_screen.h index 60ff15904a7..34f6fd1c16b 100644 --- a/src/gallium/drivers/iris/iris_screen.h +++ b/src/gallium/drivers/iris/iris_screen.h @@ -34,6 +34,7 @@ struct iris_bo; struct iris_monitor_config; +struct gen_l3_config; #define READ_ONCE(x) (*(volatile __typeof__(x) *)&(x)) #define WRITE_ONCE(x, v) *(volatile __typeof__(x) *)&(x) = (v) @@ -80,6 +81,9 @@ struct iris_screen { struct brw_compiler *compiler; struct iris_monitor_config *monitor_cfg; + const struct gen_l3_config *l3_config_3d; + const struct gen_l3_config *l3_config_cs; + /** * A buffer containing nothing useful, for hardware workarounds that * require scratch writes or reads from some unimportant memory. diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index cde76bb9fb8..d6413faa8b1 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -766,18 +766,6 @@ iris_emit_l3_config(struct iris_batch *batch, _iris_emit_lri(batch, L3_ALLOCATION_REG_num, reg_val); } -static void -iris_emit_default_l3_config(struct iris_batch *batch, bool compute) -{ - const struct gen_device_info *devinfo = &batch->screen->devinfo; - bool wants_dc_cache = true; - bool has_slm = compute; - const struct gen_l3_weights w = - gen_get_default_l3_weights(devinfo, wants_dc_cache, has_slm); - const struct gen_l3_config *cfg = gen_get_l3_config(devinfo, w); - iris_emit_l3_config(batch, cfg); -} - #if GEN_GEN == 9 static void iris_enable_obj_preemption(struct iris_batch *batch, bool enable) @@ -912,7 +900,7 @@ iris_init_render_context(struct iris_batch *batch) emit_pipeline_select(batch, _3D); - iris_emit_default_l3_config(batch, false); + iris_emit_l3_config(batch, batch->screen->l3_config_3d); init_state_base_address(batch); @@ -1031,7 +1019,7 @@ iris_init_compute_context(struct iris_batch *batch) emit_pipeline_select(batch, GPGPU); #endif - iris_emit_default_l3_config(batch, true); + iris_emit_l3_config(batch, batch->screen->l3_config_cs); init_state_base_address(batch); -- 2.30.2