egl: Make RefCount atomic
Once we relax the locking, we will be doing _eglPutFoo() outside of the big display lock. Signed-off-by: Rob Clark <robdclark@chromium.org> Acked-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18050>
This commit is contained in:
@@ -442,8 +442,7 @@ void
|
||||
_eglGetResource(_EGLResource *res)
|
||||
{
|
||||
assert(res && res->RefCount > 0);
|
||||
/* hopefully a resource is always manipulated with its display locked */
|
||||
res->RefCount++;
|
||||
p_atomic_inc(&res->RefCount);
|
||||
}
|
||||
|
||||
|
||||
@@ -454,8 +453,7 @@ EGLBoolean
|
||||
_eglPutResource(_EGLResource *res)
|
||||
{
|
||||
assert(res && res->RefCount > 0);
|
||||
res->RefCount--;
|
||||
return (!res->RefCount);
|
||||
return p_atomic_dec_zero(&res->RefCount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user