If the caller wants to overwrite the currently tracked fence, with
itself, as far as the tracking is concerned it is a no-op, so simply
allow it.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
---
 drivers/gpu/drm/i915/i915_active.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_active.c 
b/drivers/gpu/drm/i915/i915_active.c
index 207383dda84d..cde984744f20 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -759,7 +759,9 @@ __i915_active_fence_set(struct i915_active_fence *active,
 
        prev = rcu_dereference_protected(active->fence, active_is_held(active));
        if (prev) {
-               GEM_BUG_ON(prev == fence);
+               if (unlikely(prev == fence))
+                       goto unlock;
+
                spin_lock_nested(prev->lock, SINGLE_DEPTH_NESTING);
                __list_del_entry(&active->cb.node);
                spin_unlock(prev->lock); /* serialise with prev->cb_list */
@@ -781,6 +783,7 @@ __i915_active_fence_set(struct i915_active_fence *active,
        rcu_assign_pointer(active->fence, fence);
        list_add_tail(&active->cb.node, &fence->cb_list);
 
+unlock:
        spin_unlock_irqrestore(fence->lock, flags);
 
        return prev;
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to