• Chris Wilson's avatar
    drm/i915/gem: Use chained reloc batches · 964a9b0f
    Chris Wilson authored
    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: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200501192945.22215-1-chris@chris-wilson.co.uk
    964a9b0f
i915_gem_execbuffer.c 77.7 KB