[Mesa-dev] [PATCH 06/17] i965: Drop a useless ret == 0 check.

Kenneth Graunke kenneth at whitecape.org
Wed Sep 6 00:09:39 UTC 2017


Prior to the previous patch, we would pwrite the batchbuffer contents,
and wanted to skip the execbuffer if that failed.  Now, we write things
directly to the map, so we don't need this check.
---
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 40 ++++++++++++---------------
 1 file changed, 18 insertions(+), 22 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 9b37470f926..df094bb6047 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -199,8 +199,6 @@ intel_batchbuffer_reset_to_saved(struct brw_context *brw)
 void
 intel_batchbuffer_free(struct intel_batchbuffer *batch)
 {
-   free(batch->cpu_map);
-
    for (int i = 0; i < batch->exec_count; i++) {
       brw_bo_unreference(batch->exec_bos[i]);
    }
@@ -642,31 +640,29 @@ do_flush_locked(struct brw_context *brw, int in_fence_fd, int *out_fence_fd)
       if (batch->needs_sol_reset)
          flags |= I915_EXEC_GEN7_SOL_RESET;
 
-      if (ret == 0) {
-         uint32_t hw_ctx = batch->ring == RENDER_RING ? brw->hw_ctx : 0;
-
-         struct drm_i915_gem_exec_object2 *entry = &batch->validation_list[0];
-         assert(entry->handle == batch->bo->gem_handle);
-         entry->relocation_count = batch->reloc_count;
-         entry->relocs_ptr = (uintptr_t) batch->relocs;
+      uint32_t hw_ctx = batch->ring == RENDER_RING ? brw->hw_ctx : 0;
 
-         if (batch->use_batch_first) {
-            flags |= I915_EXEC_BATCH_FIRST | I915_EXEC_HANDLE_LUT;
-         } else {
-            /* Move the batch to the end of the validation list */
-            struct drm_i915_gem_exec_object2 tmp;
-            const unsigned index = batch->exec_count - 1;
+      struct drm_i915_gem_exec_object2 *entry = &batch->validation_list[0];
+      assert(entry->handle == batch->bo->gem_handle);
+      entry->relocation_count = batch->reloc_count;
+      entry->relocs_ptr = (uintptr_t) batch->relocs;
 
-            tmp = *entry;
-            *entry = batch->validation_list[index];
-            batch->validation_list[index] = tmp;
-         }
+      if (batch->use_batch_first) {
+         flags |= I915_EXEC_BATCH_FIRST | I915_EXEC_HANDLE_LUT;
+      } else {
+         /* Move the batch to the end of the validation list */
+         struct drm_i915_gem_exec_object2 tmp;
+         const unsigned index = batch->exec_count - 1;
 
-         ret = execbuffer(dri_screen->fd, batch, hw_ctx,
-                          4 * USED_BATCH(*batch),
-                          in_fence_fd, out_fence_fd, flags);
+         tmp = *entry;
+         *entry = batch->validation_list[index];
+         batch->validation_list[index] = tmp;
       }
 
+      ret = execbuffer(dri_screen->fd, batch, hw_ctx,
+                       4 * USED_BATCH(*batch),
+                       in_fence_fd, out_fence_fd, flags);
+
       throttle(brw);
    }
 
-- 
2.14.1



More information about the mesa-dev mailing list