intel: Allocate mesh shader URB space before task shader

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 <jose.souza@intel.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21603>
This commit is contained in:
José Roberto de Souza 2023-02-24 10:58:36 -08:00 committed by Marge Bot
parent b69ec8bde3
commit c30194e9ec

View file

@ -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;