summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2018-06-01 14:26:45 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2018-06-01 16:34:26 -0700
commit64e619674e9b6b9c8101353cd8cda6e064d84199 (patch)
tree5648198ae4a1ba733a968a200ad780dd56b15c3c
parentc7be17c8d32ca583be975d8c239585f3a6bbc39b (diff)
downloadmesa-64e619674e9b6b9c8101353cd8cda6e064d84199.tar.gz
mesa-64e619674e9b6b9c8101353cd8cda6e064d84199.tar.xz
anv: Don't even bother processing relocs if we have softpin
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
-rw-r--r--src/intel/vulkan/anv_batch_chain.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index de629c12f7..c47a81c8a4 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -996,6 +996,8 @@ struct anv_execbuf {
/* Allocated length of the 'objects' and 'bos' arrays */
uint32_t array_length;
+ bool has_relocs;
+
uint32_t fence_count;
uint32_t fence_array_length;
struct drm_i915_gem_exec_fence * fences;
@@ -1099,6 +1101,7 @@ anv_execbuf_add_bo(struct anv_execbuf *exec,
* this BO. Go ahead and set the relocations and then walk the list
* of relocations and add them all.
*/
+ exec->has_relocs = true;
obj->relocation_count = relocs->num_relocs;
obj->relocs_ptr = (uintptr_t) relocs->relocs;
@@ -1300,6 +1303,9 @@ static bool
relocate_cmd_buffer(struct anv_cmd_buffer *cmd_buffer,
struct anv_execbuf *exec)
{
+ if (!exec->has_relocs)
+ return true;
+
static int userspace_relocs = -1;
if (userspace_relocs < 0)
userspace_relocs = env_var_as_boolean("ANV_USERSPACE_RELOCS", true);
@@ -1403,14 +1409,20 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf,
first_batch_bo->bo.index = last_idx;
}
+ /* If we are pinning our BOs, we shouldn't have to relocate anything */
+ if (cmd_buffer->device->instance->physicalDevice.use_softpin)
+ assert(!execbuf->has_relocs);
+
/* Now we go through and fixup all of the relocation lists to point to
* the correct indices in the object array. We have to do this after we
* reorder the list above as some of the indices may have changed.
*/
- u_vector_foreach(bbo, &cmd_buffer->seen_bbos)
- anv_cmd_buffer_process_relocs(cmd_buffer, &(*bbo)->relocs);
+ if (execbuf->has_relocs) {
+ u_vector_foreach(bbo, &cmd_buffer->seen_bbos)
+ anv_cmd_buffer_process_relocs(cmd_buffer, &(*bbo)->relocs);
- anv_cmd_buffer_process_relocs(cmd_buffer, &cmd_buffer->surface_relocs);
+ anv_cmd_buffer_process_relocs(cmd_buffer, &cmd_buffer->surface_relocs);
+ }
if (!cmd_buffer->device->info.has_llc) {
__builtin_ia32_mfence();