Commit 4c2488cf authored by Christian König's avatar Christian König

drm/i915: stop using seqcount for fence pruning

After waiting for a reservation object use reservation_object_test_signaled_rcu
to opportunistically prune the fences on the object.

This allows removal of the seqcount handling in the reservation object.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/322032/?series=64786&rev=1
parent 96e95496
...@@ -35,7 +35,6 @@ i915_gem_object_wait_reservation(struct reservation_object *resv, ...@@ -35,7 +35,6 @@ i915_gem_object_wait_reservation(struct reservation_object *resv,
unsigned int flags, unsigned int flags,
long timeout) long timeout)
{ {
unsigned int seq = __read_seqcount_begin(&resv->seq);
struct dma_fence *excl; struct dma_fence *excl;
bool prune_fences = false; bool prune_fences = false;
...@@ -83,15 +82,12 @@ i915_gem_object_wait_reservation(struct reservation_object *resv, ...@@ -83,15 +82,12 @@ i915_gem_object_wait_reservation(struct reservation_object *resv,
/* /*
* Opportunistically prune the fences iff we know they have *all* been * Opportunistically prune the fences iff we know they have *all* been
* signaled and that the reservation object has not been changed (i.e. * signaled.
* no new fences have been added).
*/ */
if (prune_fences && !__read_seqcount_retry(&resv->seq, seq)) { if (prune_fences && reservation_object_trylock(resv)) {
if (reservation_object_trylock(resv)) { if (reservation_object_test_signaled_rcu(resv, true))
if (!__read_seqcount_retry(&resv->seq, seq)) reservation_object_add_excl_fence(resv, NULL);
reservation_object_add_excl_fence(resv, NULL); reservation_object_unlock(resv);
reservation_object_unlock(resv);
}
} }
return timeout; return timeout;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment