summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2018-06-04 03:09:59 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-06-04 11:05:27 -0700
commit96cefc2cbc08a461bf725172207a199ce8bd53c5 (patch)
treec3326f1f01290d3c28faa1695642dc3dfc0e9bbf
parent8952c4370da5231ad950033ac553050662d3b63c (diff)
i965: Fix batch-last mode to properly swap BOs.
On pre-4.13 kernels, which don't support I915_EXEC_BATCH_FIRST, we move the validation list entry to the end...but incorrectly left the exec_bo array alone, causing a mismatch where exec_bos[0] no longer corresponded with validation_list[0] (and similarly for the last entry). One example of resulting breakage is that we'd update bo->gtt_offset based on the wrong buffer. This wreaked total havoc when trying to use softpin, and likely caused unnecessary relocations in the normal case. Fixes: 29ba502a4e28471f67e4e904ae503157087efd20 (i965: Use I915_EXEC_BATCH_FIRST when available.) Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (cherry picked from commit b3ba47c5926b3a5850403b1ab0df37815a203d9d)
-rw-r--r--src/mesa/drivers/dri/i965/intel_batchbuffer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index a29159e41ba..b60d7d61572 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -969,11 +969,16 @@ submit_batch(struct brw_context *brw, int in_fence_fd, int *out_fence_fd)
} else {
/* Move the batch to the end of the validation list */
struct drm_i915_gem_exec_object2 tmp;
+ struct brw_bo *tmp_bo;
const unsigned index = batch->exec_count - 1;
tmp = *entry;
*entry = batch->validation_list[index];
batch->validation_list[index] = tmp;
+
+ tmp_bo = batch->exec_bos[0];
+ batch->exec_bos[0] = batch->exec_bos[index];
+ batch->exec_bos[index] = tmp_bo;
}
ret = execbuffer(dri_screen->fd, batch, hw_ctx,