mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-29 22:30:24 +01:00
pvr: Add calculation for spill/scratch buffers
Replace hardcoded value with hardware information-based calculation Reviewed-by: Simon Perretta <simon.perretta@imgtec.com> Signed-off-by: Radu Costas <radu.costas@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39262>
This commit is contained in:
parent
f8b8a57f2f
commit
0eb3eaa806
2 changed files with 23 additions and 9 deletions
|
|
@ -495,4 +495,16 @@ static inline uint32_t rogue_usc_indexed_pixel_output_index_scale(
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
rogue_get_total_instance_count(const struct pvr_device_info *dev_info)
|
||||
{
|
||||
/* Number of instances calculated as such:
|
||||
* USC_SLOTS * INSTANCES_PER_SLOT * MAX_NUM_CORES * NUM_CLUSTERS
|
||||
*/
|
||||
/* TODO: Optimise tile buffer size to use core_count, not max_num_cores. */
|
||||
return rogue_get_max_total_instances(dev_info) *
|
||||
rogue_get_max_num_cores(dev_info) *
|
||||
PVR_GET_FEATURE_VALUE(dev_info, num_clusters, 1);
|
||||
}
|
||||
#endif /* ROGUE_HW_UTILS_H */
|
||||
|
|
|
|||
|
|
@ -5827,10 +5827,13 @@ static VkResult pvr_setup_descriptor_mappings(
|
|||
spill_block_size = spill_block_size ? spill_block_size
|
||||
: sizeof(uint32_t);
|
||||
|
||||
size_t total_spill_mem_size =
|
||||
spill_block_size * rogue_get_total_instance_count(
|
||||
&cmd_buffer->device->pdevice->dev_info);
|
||||
struct pvr_suballoc_bo *spill_buffer_bo;
|
||||
result = pvr_arch_cmd_buffer_upload_general(cmd_buffer,
|
||||
NULL,
|
||||
spill_block_size * 2048,
|
||||
total_spill_mem_size,
|
||||
&spill_buffer_bo);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
|
|
@ -5862,15 +5865,14 @@ static VkResult pvr_setup_descriptor_mappings(
|
|||
assert(data->common.scratch);
|
||||
unsigned scratch_block_size = data->common.scratch;
|
||||
|
||||
/* TODO: 2048 is to account for each instance... do this
|
||||
* programmatically!
|
||||
*/
|
||||
size_t total_scratch_mem_size =
|
||||
scratch_block_size * rogue_get_total_instance_count(
|
||||
&cmd_buffer->device->pdevice->dev_info);
|
||||
struct pvr_suballoc_bo *scratch_buffer_bo;
|
||||
result =
|
||||
pvr_arch_cmd_buffer_upload_general(cmd_buffer,
|
||||
NULL,
|
||||
scratch_block_size * 2048,
|
||||
&scratch_buffer_bo);
|
||||
result = pvr_arch_cmd_buffer_upload_general(cmd_buffer,
|
||||
NULL,
|
||||
total_scratch_mem_size,
|
||||
&scratch_buffer_bo);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue