Commit 824815c4 authored by Rob Clark's avatar Rob Clark

reservation: add reservation_object_get_excl_rcu()

In the atomic modesetting path, each driver simply wants to grab a ref
to the exclusive fence from a reservation object to store in the incoming
drm_plane_state, without doing the whole RCU dance.  Since each driver
will need to do this, lets make a helper.

v2: rename to _rcu instead of _unlocked to be more consistent
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
Acked-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
parent feb46f02
...@@ -120,6 +120,24 @@ reservation_object_get_excl(struct reservation_object *obj) ...@@ -120,6 +120,24 @@ reservation_object_get_excl(struct reservation_object *obj)
reservation_object_held(obj)); reservation_object_held(obj));
} }
static inline struct fence *
reservation_object_get_excl_rcu(struct reservation_object *obj)
{
struct fence *fence;
unsigned seq;
retry:
seq = read_seqcount_begin(&obj->seq);
rcu_read_lock();
fence = rcu_dereference(obj->fence_excl);
if (read_seqcount_retry(&obj->seq, seq)) {
rcu_read_unlock();
goto retry;
}
fence = fence_get(fence);
rcu_read_unlock();
return fence;
}
int reservation_object_reserve_shared(struct reservation_object *obj); int reservation_object_reserve_shared(struct reservation_object *obj);
void reservation_object_add_shared_fence(struct reservation_object *obj, void reservation_object_add_shared_fence(struct reservation_object *obj,
struct fence *fence); struct fence *fence);
......
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