Mesa (master): i965: Convert reloc.target_handle into an index for I915_EXEC_HANDLE_LUT
Kenneth Graunke
kwg at kemper.freedesktop.org
Fri Aug 4 18:45:34 UTC 2017
Module: Mesa
Branch: master
Commit: 2aacd22c0b7935b40911593c3b01f0b8d12eddd4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2aacd22c0b7935b40911593c3b01f0b8d12eddd4
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Thu Aug 3 00:03:15 2017 -0700
i965: Convert reloc.target_handle into an index for I915_EXEC_HANDLE_LUT
Based on a patch by Chris Wilson (who also wrote this commit message).
Passing the index of the target buffer via the reloc.target_handle is
marginally more efficient for the kernel (it can avoid some allocations,
and can use a direct lookup rather than a hash or search). It is also
useful for ourselves as we can use the index into our exec_bos for other
tasks.
v2: Only enable HANDLE_LUT if we can use BATCH_FIRST and thereby avoid
a post-processing loop to fixup the relocations.
v3: Move kernel probing from context creation to screen init.
Use batch->use_exec_lut as it more descriptive of what's going on (Daniel)
v4: Kernel features already exists, use it for BATCH_FIRST
Rename locals to preserve current flavouring
v5: Squash in "always insert batch bo first"
v6: (by Ken) Split out BATCH_FIRST from HANDLE_LUT.
---
src/mesa/drivers/dri/i965/intel_batchbuffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index d4ffbdac8a..6e53bb19db 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -667,7 +667,7 @@ do_flush_locked(struct brw_context *brw, int in_fence_fd, int *out_fence_fd)
entry->relocs_ptr = (uintptr_t) batch->relocs;
if (batch->use_batch_first) {
- flags |= I915_EXEC_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;
@@ -821,7 +821,7 @@ brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
(struct drm_i915_gem_relocation_entry) {
.offset = batch_offset,
.delta = target_offset,
- .target_handle = target->gem_handle,
+ .target_handle = batch->use_batch_first ? index : target->gem_handle,
.presumed_offset = entry->offset,
};
More information about the mesa-commit
mailing list