From: Jason Ekstrand Date: Thu, 16 Jan 2020 23:02:26 +0000 (-0600) Subject: intel: Take a gen_l3_config in gen_get_urb_config X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=73a684964b392c4df84373e8419e355267d57ff5;p=mesa.git intel: Take a gen_l3_config in gen_get_urb_config Instead of making each driver pass in the same push constant size and do it's own L3$ config URB size calculation, just make them pass in their L3$ configuration. Cc: "20.0" mesa-stable@lists.freedesktop.org Reviewed-by: Kenneth Graunke Part-of: --- diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 9467f5d1742..2593bf45b2a 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -7225,15 +7225,12 @@ genX(emit_urb_setup)(struct iris_context *ice, bool tess_present, bool gs_present) { const struct gen_device_info *devinfo = &batch->screen->devinfo; - const struct gen_l3_config *l3_config = batch->screen->l3_config_3d; - const unsigned push_size_kB = 32; unsigned entries[4]; unsigned start[4]; ice->shaders.last_vs_entry_size = size[MESA_SHADER_VERTEX]; - gen_get_urb_config(devinfo, 1024 * push_size_kB, - 1024 * gen_get_l3_config_urb_size(devinfo, l3_config), + gen_get_urb_config(devinfo, batch->screen->l3_config_3d, tess_present, gs_present, size, entries, start); diff --git a/src/intel/common/gen_l3_config.h b/src/intel/common/gen_l3_config.h index 33da8bb19de..36414321c49 100644 --- a/src/intel/common/gen_l3_config.h +++ b/src/intel/common/gen_l3_config.h @@ -93,7 +93,7 @@ gen_get_l3_config_urb_size(const struct gen_device_info *devinfo, void gen_dump_l3_config(const struct gen_l3_config *cfg, FILE *fp); void gen_get_urb_config(const struct gen_device_info *devinfo, - unsigned push_constant_bytes, unsigned urb_size_bytes, + const struct gen_l3_config *l3_cfg, bool tess_present, bool gs_present, const unsigned entry_size[4], unsigned entries[4], unsigned start[4]); diff --git a/src/intel/common/gen_urb_config.c b/src/intel/common/gen_urb_config.c index 1440dd713e9..ba96966dff1 100644 --- a/src/intel/common/gen_urb_config.c +++ b/src/intel/common/gen_urb_config.c @@ -59,19 +59,23 @@ */ void gen_get_urb_config(const struct gen_device_info *devinfo, - unsigned push_constant_bytes, unsigned urb_size_bytes, + const struct gen_l3_config *l3_cfg, bool tess_present, bool gs_present, const unsigned entry_size[4], unsigned entries[4], unsigned start[4]) { + const unsigned urb_size_kB = gen_get_l3_config_urb_size(devinfo, l3_cfg); + const unsigned push_constant_kB = + (devinfo->gen >= 8 || (devinfo->is_haswell && devinfo->gt == 3)) ? 32 : 16; + const bool active[4] = { true, tess_present, tess_present, gs_present }; /* URB allocations must be done in 8k chunks. */ - const unsigned chunk_size_bytes = 8192; + const unsigned chunk_size_kB = 8; + const unsigned chunk_size_bytes = chunk_size_kB * 1024; - const unsigned push_constant_chunks = - push_constant_bytes / chunk_size_bytes; - const unsigned urb_chunks = urb_size_bytes / chunk_size_bytes; + const unsigned push_constant_chunks = push_constant_kB / chunk_size_kB; + const unsigned urb_chunks = urb_size_kB / chunk_size_kB; /* From p35 of the Ivy Bridge PRM (section 1.7.1: 3DSTATE_URB_GS): * diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 0a91e1d009c..92bb04d07d3 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -262,18 +262,10 @@ genX(emit_urb_setup)(struct anv_device *device, struct anv_batch *batch, const unsigned entry_size[4]) { const struct gen_device_info *devinfo = &device->info; -#if GEN_IS_HASWELL - const unsigned push_constant_kb = devinfo->gt == 3 ? 32 : 16; -#else - const unsigned push_constant_kb = GEN_GEN >= 8 ? 32 : 16; -#endif - - const unsigned urb_size_kb = gen_get_l3_config_urb_size(devinfo, l3_config); unsigned entries[4]; unsigned start[4]; - gen_get_urb_config(devinfo, - 1024 * push_constant_kb, 1024 * urb_size_kb, + gen_get_urb_config(devinfo, l3_config, active_stages & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, active_stages & VK_SHADER_STAGE_GEOMETRY_BIT, diff --git a/src/mesa/drivers/dri/i965/gen7_urb.c b/src/mesa/drivers/dri/i965/gen7_urb.c index e7259fc1b8d..e04c29c833b 100644 --- a/src/mesa/drivers/dri/i965/gen7_urb.c +++ b/src/mesa/drivers/dri/i965/gen7_urb.c @@ -208,8 +208,6 @@ gen7_upload_urb(struct brw_context *brw, unsigned vs_size, bool gs_present, bool tess_present) { const struct gen_device_info *devinfo = &brw->screen->devinfo; - const int push_size_kB = - (devinfo->gen >= 8 || (devinfo->is_haswell && devinfo->gt == 3)) ? 32 : 16; /* BRW_NEW_{VS,TCS,TES,GS}_PROG_DATA */ struct brw_vue_prog_data *prog_data[4] = { @@ -249,7 +247,7 @@ gen7_upload_urb(struct brw_context *brw, unsigned vs_size, unsigned entries[4]; unsigned start[4]; - gen_get_urb_config(devinfo, 1024 * push_size_kB, 1024 * brw->urb.size, + gen_get_urb_config(devinfo, brw->l3.config, tess_present, gs_present, entry_size, entries, start); if (devinfo->gen == 7 && !devinfo->is_haswell && !devinfo->is_baytrail)