anv/batch_chain: Don't call current_batch_bo() again
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 15 Jan 2016 23:48:18 +0000 (15:48 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 15 Jan 2016 23:49:32 +0000 (15:49 -0800)
We call it once at the top of the function and then hold on to the pointer.
It shouldn't have changed, so there's no reason to query for it again.

src/vulkan/anv_batch_chain.c

index 466a3624234b61070f8ad5b19d7b09b47292898b..9c80f5e3b03ff257188ce153679a2361e6428108 100644 (file)
@@ -667,8 +667,7 @@ anv_cmd_buffer_end_batch_buffer(struct anv_cmd_buffer *cmd_buffer)
        * actual ExecuteCommands implementation.
        */
       if ((cmd_buffer->batch_bos.next == cmd_buffer->batch_bos.prev) &&
-          (anv_cmd_buffer_current_batch_bo(cmd_buffer)->length <
-           ANV_CMD_BUFFER_BATCH_SIZE / 2)) {
+          (batch_bo->length < ANV_CMD_BUFFER_BATCH_SIZE / 2)) {
          /* If the secondary has exactly one batch buffer in its list *and*
           * that batch buffer is less than half of the maximum size, we're
           * probably better of simply copying it into our batch.
@@ -683,7 +682,7 @@ anv_cmd_buffer_end_batch_buffer(struct anv_cmd_buffer *cmd_buffer)
           * so we can unconditionally decrement right before adding the
           * MI_BATCH_BUFFER_START command.
           */
-         anv_cmd_buffer_current_batch_bo(cmd_buffer)->relocs.num_relocs++;
+         batch_bo->relocs.num_relocs++;
          cmd_buffer->batch.next += GEN8_MI_BATCH_BUFFER_START_length * 4;
       } else {
          cmd_buffer->exec_mode = ANV_CMD_BUFFER_EXEC_MODE_COPY_AND_CHAIN;