anv: Return earlier in anv_reloc_list functions
Xe KMD don't need relocs, so calling a nop function and avoiding the CPU cycles and memory waste with reloc. Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24411>
This commit is contained in:

committed by
Marge Bot

parent
d9d284d050
commit
f49989148a
@@ -53,10 +53,12 @@
|
||||
|
||||
VkResult
|
||||
anv_reloc_list_init(struct anv_reloc_list *list,
|
||||
const VkAllocationCallbacks *alloc)
|
||||
const VkAllocationCallbacks *alloc,
|
||||
bool uses_relocs)
|
||||
{
|
||||
assert(alloc != NULL);
|
||||
memset(list, 0, sizeof(*list));
|
||||
list->uses_relocs = uses_relocs;
|
||||
list->alloc = alloc;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@@ -113,8 +115,8 @@ anv_reloc_list_grow_deps(struct anv_reloc_list *list,
|
||||
}
|
||||
|
||||
VkResult
|
||||
anv_reloc_list_add_bo(struct anv_reloc_list *list,
|
||||
struct anv_bo *target_bo)
|
||||
anv_reloc_list_add_bo_impl(struct anv_reloc_list *list,
|
||||
struct anv_bo *target_bo)
|
||||
{
|
||||
uint32_t idx = target_bo->gem_handle;
|
||||
VkResult result = anv_reloc_list_grow_deps(list,
|
||||
@@ -254,7 +256,8 @@ anv_batch_bo_create(struct anv_cmd_buffer *cmd_buffer,
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_alloc;
|
||||
|
||||
result = anv_reloc_list_init(&bbo->relocs, &cmd_buffer->vk.pool->alloc);
|
||||
const bool uses_relocs = cmd_buffer->device->physical->uses_relocs;
|
||||
result = anv_reloc_list_init(&bbo->relocs, &cmd_buffer->vk.pool->alloc, uses_relocs);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_bo_alloc;
|
||||
|
||||
@@ -849,8 +852,9 @@ anv_cmd_buffer_init_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer)
|
||||
if (!success)
|
||||
goto fail_seen_bbos;
|
||||
|
||||
const bool uses_relocs = cmd_buffer->device->physical->uses_relocs;
|
||||
result = anv_reloc_list_init(&cmd_buffer->surface_relocs,
|
||||
&cmd_buffer->vk.pool->alloc);
|
||||
&cmd_buffer->vk.pool->alloc, uses_relocs);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_bt_blocks;
|
||||
|
||||
|
@@ -1359,6 +1359,8 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
|
||||
device->info.kmd_type,
|
||||
&u64_ignore);
|
||||
|
||||
device->uses_relocs = device->info.kmd_type != INTEL_KMD_TYPE_XE;
|
||||
|
||||
device->always_flush_cache = INTEL_DEBUG(DEBUG_STALL) ||
|
||||
driQueryOptionb(&instance->dri_options, "always_flush_cache");
|
||||
|
||||
|
@@ -264,8 +264,9 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
|
||||
pipeline->batch.relocs = &pipeline->batch_relocs;
|
||||
pipeline->batch.status = VK_SUCCESS;
|
||||
|
||||
const bool uses_relocs = device->physical->uses_relocs;
|
||||
result = anv_reloc_list_init(&pipeline->batch_relocs,
|
||||
pipeline->batch.alloc);
|
||||
pipeline->batch.alloc, uses_relocs);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
|
@@ -945,6 +945,8 @@ struct anv_physical_device {
|
||||
*/
|
||||
bool indirect_descriptors;
|
||||
|
||||
bool uses_relocs;
|
||||
|
||||
struct {
|
||||
uint32_t family_count;
|
||||
struct anv_queue_family families[ANV_MAX_QUEUE_FAMILIES];
|
||||
@@ -1432,17 +1434,25 @@ void anv_vma_free(struct anv_device *device,
|
||||
uint64_t address, uint64_t size);
|
||||
|
||||
struct anv_reloc_list {
|
||||
bool uses_relocs;
|
||||
uint32_t dep_words;
|
||||
BITSET_WORD * deps;
|
||||
const VkAllocationCallbacks *alloc;
|
||||
};
|
||||
|
||||
VkResult anv_reloc_list_init(struct anv_reloc_list *list,
|
||||
const VkAllocationCallbacks *alloc);
|
||||
const VkAllocationCallbacks *alloc,
|
||||
bool uses_relocs);
|
||||
void anv_reloc_list_finish(struct anv_reloc_list *list);
|
||||
|
||||
VkResult anv_reloc_list_add_bo(struct anv_reloc_list *list,
|
||||
struct anv_bo *target_bo);
|
||||
VkResult
|
||||
anv_reloc_list_add_bo_impl(struct anv_reloc_list *list, struct anv_bo *target_bo);
|
||||
|
||||
static inline VkResult
|
||||
anv_reloc_list_add_bo(struct anv_reloc_list *list, struct anv_bo *target_bo)
|
||||
{
|
||||
return list->uses_relocs ? anv_reloc_list_add_bo_impl(list, target_bo) : VK_SUCCESS;
|
||||
}
|
||||
|
||||
struct anv_batch_bo {
|
||||
/* Link in the anv_cmd_buffer.owned_batch_bos list */
|
||||
|
@@ -167,7 +167,8 @@ anv_device_utrace_flush_cmd_buffers(struct anv_queue *queue,
|
||||
if (result != VK_SUCCESS)
|
||||
goto error_batch_buf;
|
||||
|
||||
result = anv_reloc_list_init(&submit->relocs, &device->vk.alloc);
|
||||
const bool uses_relocs = device->physical->uses_relocs;
|
||||
result = anv_reloc_list_init(&submit->relocs, &device->vk.alloc, uses_relocs);
|
||||
if (result != VK_SUCCESS)
|
||||
goto error_reloc_list;
|
||||
|
||||
@@ -463,7 +464,8 @@ anv_queue_trace(struct anv_queue *queue, const char *label, bool frame, bool beg
|
||||
if (result != VK_SUCCESS)
|
||||
goto error_sync;
|
||||
|
||||
result = anv_reloc_list_init(&submit->relocs, &device->vk.alloc);
|
||||
const bool uses_relocs = device->physical->uses_relocs;
|
||||
result = anv_reloc_list_init(&submit->relocs, &device->vk.alloc, uses_relocs);
|
||||
if (result != VK_SUCCESS)
|
||||
goto error_batch_bo;
|
||||
|
||||
|
Reference in New Issue
Block a user