• Chris Wilson's avatar
    drm/i915: Wait on external rendering for GEM objects · c13d87ea
    Chris Wilson authored
    When transitioning to the GTT or CPU domain we wait on all rendering
    from i915 to complete (with the optimisation of allowing concurrent read
    access by both the GPU and client). We don't yet ensure all rendering
    from third parties (tracked by implicit fences on the dma-buf) is
    complete. Since implicitly tracked rendering by third parties will
    ignore our cache-domain tracking, we have to always wait upon rendering
    from third-parties when transitioning to direct access to the backing
    store. We still rely on clients notifying us of cache domain changes
    (i.e. they need to move to the GTT read or write domain after doing a CPU
    access before letting the third party render again).
    
    v2:
    This introduces a potential WARN_ON into i915_gem_object_free() as the
    current i915_vma_unbind() calls i915_gem_object_wait_rendering(). To
    hit this path we first need to render with the GPU, have a dma-buf
    attached with an unsignaled fence and then interrupt the wait. It does
    get fixed later in the series (when i915_vma_unbind() only waits on the
    active VMA and not all, including third-party, rendering.
    
    To offset that risk, use the __i915_vma_unbind_no_wait hack.
    
    Testcase: igt/prime_vgem/basic-fence-read
    Testcase: igt/prime_vgem/basic-fence-mmap
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/1469002875-2335-8-git-send-email-chris@chris-wilson.co.uk
    c13d87ea
i915_gem.c 128 KB