Mesa (main): intel: Add and use max_constant_urb_size_kb
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Sep 27 21:06:14 UTC 2021
Module: Mesa
Branch: main
Commit: 37f03e89f22dd2139bbdec1888ac1b9a51e4df12
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=37f03e89f22dd2139bbdec1888ac1b9a51e4df12
Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date: Thu Sep 23 22:59:40 2021 -0700
intel: Add and use max_constant_urb_size_kb
This knowledge was repeated in multiple places so move the values to
intel_device_info struct.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Acked-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13014>
---
src/gallium/drivers/crocus/crocus_state.c | 9 ++-------
src/intel/common/intel_urb_config.c | 3 +--
src/intel/dev/intel_device_info.c | 3 +++
src/intel/dev/intel_device_info.h | 6 ++++++
src/intel/dev/intel_device_info_test.c | 2 ++
src/intel/vulkan/genX_cmd_buffer.c | 9 ++-------
src/mesa/drivers/dri/i965/gfx7_urb.c | 3 +--
7 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/src/gallium/drivers/crocus/crocus_state.c b/src/gallium/drivers/crocus/crocus_state.c
index 0b6545176f5..273a259ef7f 100644
--- a/src/gallium/drivers/crocus/crocus_state.c
+++ b/src/gallium/drivers/crocus/crocus_state.c
@@ -1321,13 +1321,8 @@ emit_pipeline_select(struct crocus_batch *batch, uint32_t pipeline)
static void
crocus_alloc_push_constants(struct crocus_batch *batch)
{
-#if GFX_VERx10 == 75
- const unsigned push_constant_kb = batch->screen->devinfo.gt == 3 ? 32 : 16;
-#elif GFX_VER == 8
- const unsigned push_constant_kb = 32;
-#else
- const unsigned push_constant_kb = 16;
-#endif
+ const unsigned push_constant_kb =
+ batch->screen->devinfo.max_constant_urb_size_kb;
unsigned size_per_stage = push_constant_kb / 5;
/* For now, we set a static partitioning of the push constant area,
diff --git a/src/intel/common/intel_urb_config.c b/src/intel/common/intel_urb_config.c
index 283e521ec92..f7fabde8cb0 100644
--- a/src/intel/common/intel_urb_config.c
+++ b/src/intel/common/intel_urb_config.c
@@ -87,8 +87,7 @@ intel_get_urb_config(const struct intel_device_info *devinfo,
if (devinfo->ver >= 12)
urb_size_kB -= 4 * devinfo->l3_banks;
- const unsigned push_constant_kB =
- (devinfo->ver >= 8 || (devinfo->is_haswell && devinfo->gt == 3)) ? 32 : 16;
+ const unsigned push_constant_kB = devinfo->max_constant_urb_size_kb;
const bool active[4] = { true, tess_present, tess_present, gs_present };
diff --git a/src/intel/dev/intel_device_info.c b/src/intel/dev/intel_device_info.c
index 5e9e86ba8e0..5cf6e0e7112 100644
--- a/src/intel/dev/intel_device_info.c
+++ b/src/intel/dev/intel_device_info.c
@@ -219,6 +219,7 @@ static const struct intel_device_info intel_device_info_snb_gt2 = {
.has_64bit_float = true, \
.has_surface_tile_offset = true, \
.timestamp_frequency = 12500000, \
+ .max_constant_urb_size_kb = 16, \
.cs_prefetch_size = 512
static const struct intel_device_info intel_device_info_ivb_gt1 = {
@@ -394,6 +395,7 @@ static const struct intel_device_info intel_device_info_hsw_gt3 = {
[MESA_SHADER_GEOMETRY] = 640,
},
},
+ .max_constant_urb_size_kb = 32,
.simulator_id = 9,
};
@@ -419,6 +421,7 @@ static const struct intel_device_info intel_device_info_hsw_gt3 = {
.max_gs_threads = 504, \
.max_wm_threads = 384, \
.timestamp_frequency = 12500000, \
+ .max_constant_urb_size_kb = 32, \
.cs_prefetch_size = 512
static const struct intel_device_info intel_device_info_bdw_gt1 = {
diff --git a/src/intel/dev/intel_device_info.h b/src/intel/dev/intel_device_info.h
index d6bce7d90b6..b26296bcb9d 100644
--- a/src/intel/dev/intel_device_info.h
+++ b/src/intel/dev/intel_device_info.h
@@ -265,6 +265,12 @@ struct intel_device_info
unsigned max_entries[4];
} urb;
+ /* Maximum size in Kb that can be allocated to constants in the URB, this
+ * is usually divided among the stages for implementing push constants.
+ * See 3DSTATE_PUSH_CONSTANT_ALLOC_*.
+ */
+ unsigned max_constant_urb_size_kb;
+
/**
* Size of the command streamer prefetch. This is important to know for
* self modifying batches.
diff --git a/src/intel/dev/intel_device_info_test.c b/src/intel/dev/intel_device_info_test.c
index 8ff22cf0999..06e51ace785 100644
--- a/src/intel/dev/intel_device_info_test.c
+++ b/src/intel/dev/intel_device_info_test.c
@@ -28,6 +28,8 @@ main(int argc, char *argv[])
assert(devinfo.num_thread_per_eu != 0);
assert(devinfo.timestamp_frequency != 0);
assert(devinfo.cs_prefetch_size > 0);
+
+ assert(devinfo.ver < 7 || devinfo.max_constant_urb_size_kb > 0);
}
return 0;
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 9b091203255..d24bb822744 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2501,13 +2501,8 @@ cmd_buffer_alloc_push_constants(struct anv_cmd_buffer *cmd_buffer)
if (stages == cmd_buffer->state.gfx.push_constant_stages)
return;
-#if GFX_VER >= 8
- const unsigned push_constant_kb = 32;
-#elif GFX_VERx10 == 75
- const unsigned push_constant_kb = cmd_buffer->device->info.gt == 3 ? 32 : 16;
-#else
- const unsigned push_constant_kb = 16;
-#endif
+ const unsigned push_constant_kb =
+ cmd_buffer->device->info.max_constant_urb_size_kb;
const unsigned num_stages =
util_bitcount(stages & VK_SHADER_STAGE_ALL_GRAPHICS);
diff --git a/src/mesa/drivers/dri/i965/gfx7_urb.c b/src/mesa/drivers/dri/i965/gfx7_urb.c
index 0f06d26d82e..79c28c15658 100644
--- a/src/mesa/drivers/dri/i965/gfx7_urb.c
+++ b/src/mesa/drivers/dri/i965/gfx7_urb.c
@@ -71,8 +71,7 @@ gfx7_allocate_push_constants(struct brw_context *brw)
bool tess_present = brw->programs[MESA_SHADER_TESS_EVAL];
unsigned avail_size = 16;
- unsigned multiplier =
- (devinfo->ver >= 8 || (devinfo->is_haswell && devinfo->gt == 3)) ? 2 : 1;
+ unsigned multiplier = devinfo->max_constant_urb_size_kb / 16;
int stages = 2 + gs_present + 2 * tess_present;
More information about the mesa-commit
mailing list