• Thomas Hellström's avatar
    drm/i915/ttm: Implement asynchronous TTM moves · 6385eb7a
    Thomas Hellström authored
    Don't wait sync while migrating, but rather make the GPU blit await the
    dependencies and add a moving fence to the object.
    
    This also enables asynchronous VRAM management in that on eviction,
    rather than waiting for the moving fence to expire before freeing VRAM,
    it is freed immediately and the fence is stored with the VRAM manager and
    handed out to newly allocated objects to await before clears and swapins,
    or for kernel objects before setting up gpu vmas or mapping.
    
    To collect dependencies before migrating, add a set of utilities that
    coalesce these to a single dma_fence.
    
    What is still missing for fully asynchronous operation is asynchronous vma
    unbinding, which is still to be implemented.
    
    This commit substantially reduces execution time in the gem_lmem_swapping
    test.
    
    v2:
    - Make a couple of functions static.
    v4:
    - Fix some style issues (Matthew Auld)
    - Audit and add more checks for ghost objects (Matthew Auld)
    - Add more documentation for the i915_deps utility (Mattew Auld)
    - Simplify the i915_deps_sync() function
    v6:
    - Re-check for fence signaled before returning -EBUSY (Matthew Auld)
    - Use dma_resv_iter_is_exclusive() (Matthew Auld)
    - Await all dma-resv fences before a migration blit (Matthew Auld)
    Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
    Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20211122214554.371864-6-thomas.hellstrom@linux.intel.com
    6385eb7a
i915_gem_ttm.c 29.5 KB