anv: Re-use one old BT block in reset_batch_bo_chain
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 28 Jan 2020 22:21:56 +0000 (16:21 -0600)
committerJason Ekstrand <jason@jlekstrand.net>
Wed, 29 Jan 2020 15:43:42 +0000 (09:43 -0600)
We intentionally throw away all but one BT block but then we set
cmd_buffer->bt_block to ANV_STATE_NULL instead of the one we hung on to.
This causes the command buffer to immediately re-emit STATE_BASE_ADDRESS
the first time a BT is needed for no good reason.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_batch_chain.c

index 5b64a53b6e1cb22472417345b1ef1a8ac41fbcb9..1d4e853a91ee9e151cf8129f5f8a5faaa4233206 100644 (file)
@@ -874,7 +874,8 @@ anv_cmd_buffer_reset_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer)
       anv_binding_table_pool_free(cmd_buffer->device, *bt_block);
    }
    assert(u_vector_length(&cmd_buffer->bt_block_states) == 1);
-   cmd_buffer->bt_next = ANV_STATE_NULL;
+   cmd_buffer->bt_next = *(struct anv_state *)u_vector_head(&cmd_buffer->bt_block_states);
+   cmd_buffer->bt_next.offset = 0;
 
    anv_reloc_list_clear(&cmd_buffer->surface_relocs);
    cmd_buffer->last_ss_pool_center = 0;