OSDN Git Service

drm/i915/gem: Use chained reloc batches
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 1 May 2020 19:29:43 +0000 (20:29 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 1 May 2020 21:56:15 +0000 (22:56 +0100)
commit964a9b0f611ee7fedc90641bfcc2efe6ce6206aa
tree473e88ea9e937a7a841d2d309437f1d7f80fbed5
parent9f909e215fea0652023b9ed09d3d7bfe10386423
drm/i915/gem: Use chained reloc batches

The ring is a precious resource: we anticipate to only use a few hundred
bytes for a request, and only try to reserve that before we start. If we
go beyond our guess in building the request, then instead of waiting at
the start of execbuf before we hold any locks or other resources, we
may trigger a wait inside a critical region. One example is in using gpu
relocations, where currently we emit a new MI_BB_START from the ring
every time we overflow a page of relocation entries. However, instead of
insert the command into the precious ring, we can chain the next page of
relocation entries as MI_BB_START from the end of the previous.

v2: Delay the emit_bb_start until after all the chained vma
synchronisation is complete. Since the buffer pool batches are idle, this
_should_ be a no-op, but one day we may some fancy async GPU bindings
for new vma!

v3: Use pool/batch consitently, once we start thinking in terms of the
batch vma, use batch->obj.
v4: Explain the magic number 4.

Tvrtko spotted that we lose propagation of the error for failing to
submit the relocation request; that's easier to fix up in the next
patch.

Testcase: igt/gem_exec_reloc/basic-many-active
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200501192945.22215-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c