From: Jason Ekstrand Date: Thu, 24 Sep 2015 00:16:40 +0000 (-0700) Subject: anv/batch_chain: Clean up the reloc list swapping code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=76be58efce858614d10709ac2952329495d1ed8f;p=mesa.git anv/batch_chain: Clean up the reloc list swapping code --- diff --git a/src/vulkan/anv_batch_chain.c b/src/vulkan/anv_batch_chain.c index 77a5bd6f9ec..b8f08b9cd8a 100644 --- a/src/vulkan/anv_batch_chain.c +++ b/src/vulkan/anv_batch_chain.c @@ -895,21 +895,19 @@ anv_cmd_buffer_prepare_execbuf(struct anv_cmd_buffer *cmd_buffer) */ if (first_batch_bo->bo.index != cmd_buffer->execbuf2.bo_count - 1) { uint32_t idx = first_batch_bo->bo.index; + uint32_t last_idx = cmd_buffer->execbuf2.bo_count - 1; struct drm_i915_gem_exec_object2 tmp_obj = cmd_buffer->execbuf2.objects[idx]; assert(cmd_buffer->execbuf2.bos[idx] == &first_batch_bo->bo); - cmd_buffer->execbuf2.objects[idx] = - cmd_buffer->execbuf2.objects[cmd_buffer->execbuf2.bo_count - 1]; - cmd_buffer->execbuf2.bos[idx] = - cmd_buffer->execbuf2.bos[cmd_buffer->execbuf2.bo_count - 1]; + cmd_buffer->execbuf2.objects[idx] = cmd_buffer->execbuf2.objects[last_idx]; + cmd_buffer->execbuf2.bos[idx] = cmd_buffer->execbuf2.bos[last_idx]; cmd_buffer->execbuf2.bos[idx]->index = idx; - cmd_buffer->execbuf2.objects[cmd_buffer->execbuf2.bo_count - 1] = tmp_obj; - cmd_buffer->execbuf2.bos[cmd_buffer->execbuf2.bo_count - 1] = - &first_batch_bo->bo; - first_batch_bo->bo.index = cmd_buffer->execbuf2.bo_count - 1; + cmd_buffer->execbuf2.objects[last_idx] = tmp_obj; + cmd_buffer->execbuf2.bos[last_idx] = &first_batch_bo->bo; + first_batch_bo->bo.index = last_idx; } /* Now we go through and fixup all of the relocation lists to point to