From c30194e9ec54e325ecd59d9989f408f30f462184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Fri, 24 Feb 2023 10:58:36 -0800 Subject: [PATCH] intel: Allocate mesh shader URB space before task shader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A future platform requires that mesh shader URB space be allocated before task shader URB space. If task shader is enabled, it will align the mesh shader URB size to 8Kb and give the remaning back to task shader. Otherwise, no aligment is needed, and mesh shader will have all the URB space. BSpec: 56229, 56230 Signed-off-by: José Roberto de Souza Reviewed-by: Marcin Ślusarz Part-of: --- src/intel/common/intel_urb_config.c | 33 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/intel/common/intel_urb_config.c b/src/intel/common/intel_urb_config.c index f593f8c5d20..be9c68f0067 100644 --- a/src/intel/common/intel_urb_config.c +++ b/src/intel/common/intel_urb_config.c @@ -339,16 +339,32 @@ intel_get_mesh_urb_config(const struct intel_device_info *devinfo, } const unsigned one_task_urb_kb = ALIGN(r.task_entry_size_64b * 64, 1024) / 1024; + unsigned task_urb_kb = MAX2(total_urb_kb * task_urb_share, one_task_urb_kb); + unsigned mesh_urb_kb = total_urb_kb - task_urb_kb; - const unsigned task_urb_kb = ALIGN(MAX2(total_urb_kb * task_urb_share, one_task_urb_kb), 8); - - const unsigned mesh_urb_kb = total_urb_kb - task_urb_kb; + if (r.task_entry_size_64b > 0) { + mesh_urb_kb = ROUND_DOWN_TO(mesh_urb_kb, 8); + task_urb_kb = total_urb_kb - mesh_urb_kb; + } /* TODO(mesh): Could we avoid allocating URB for Mesh if rasterization is * disabled? */ unsigned next_address_8kb = DIV_ROUND_UP(push_constant_kb, 8); + r.mesh_entries = MIN2((mesh_urb_kb * 16) / r.mesh_entry_size_64b, 1548); + /* 3DSTATE_URB_ALLOC_MESH_BODY says + * + * MESH Number of URB Entries must be divisible by 8 if the MESH URB + * Entry Allocation Size is less than 9 512-bit URB entries. + */ + if (r.mesh_entry_size_64b < 9) + r.mesh_entries = ROUND_DOWN_TO(r.mesh_entries, 8); + + r.mesh_starting_address_8kb = next_address_8kb; + assert(mesh_urb_kb % 8 == 0); + next_address_8kb += mesh_urb_kb / 8; + if (r.task_entry_size_64b > 0) { r.task_entries = MIN2((task_urb_kb * 16) / r.task_entry_size_64b, 1548); @@ -361,19 +377,8 @@ intel_get_mesh_urb_config(const struct intel_device_info *devinfo, r.task_entries = ROUND_DOWN_TO(r.task_entries, 8); r.task_starting_address_8kb = next_address_8kb; - - assert(task_urb_kb % 8 == 0); - next_address_8kb += task_urb_kb / 8; } - r.mesh_entries = MIN2((mesh_urb_kb * 16) / r.mesh_entry_size_64b, 1548); - - /* Similar restriction to TASK. */ - if (r.mesh_entry_size_64b < 9) - r.mesh_entries = ROUND_DOWN_TO(r.mesh_entries, 8); - - r.mesh_starting_address_8kb = next_address_8kb; - r.deref_block_size = r.mesh_entries > 32 ? INTEL_URB_DEREF_BLOCK_SIZE_MESH : INTEL_URB_DEREF_BLOCK_SIZE_PER_POLY;