drm/i915: Track the last-active inside the i915_vma
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 6 Jul 2018 12:31:57 +0000 (13:31 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 6 Jul 2018 17:23:07 +0000 (18:23 +0100)
commit8b293eb53a7d7605f762351918083a4e402dc784
tree6022514e2a3ddcb8069e34ad9629152e53e294e2
parent5c3f8c221c77ccdce3c2a8b96d196e5f4e2dac0c
drm/i915: Track the last-active inside the i915_vma

Using a VMA on more than one timeline concurrently is the exception
rather than the rule (using it concurrently on multiple engines). As we
expect to only use one active tracker, store the most recently used
tracker inside the i915_vma itself and only fallback to the rbtree if
we need a second or more concurrent active trackers.

v2: Comments on how we overwrite any existing last_active cache.
v3: __list_del_entry() before list_replace_init() is confusing and, much
more important, entirely redundant.
v4: Note that both last_active and the rbtree may be simultaneously
tracking this timeline, albeit with different requests, and so the vma
may be retired twice for the same timeline.
v5: No, that list_del is required!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180706123157.9645-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_vma.c
drivers/gpu/drm/i915/i915_vma.h