egl: Add some locking asserts

Make it obvious if we screw up while reworking locking.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18111>
This commit is contained in:
Rob Clark 2022-08-11 10:01:01 -07:00 committed by Marge Bot
parent a020e9e70a
commit 7fcdc07aaa
2 changed files with 9 additions and 0 deletions

View file

@ -934,6 +934,8 @@ _eglNativeSurfaceAlreadyUsed(_EGLDisplay *disp, void *native_surface)
{
_EGLResource *list;
simple_mtx_assert_locked(&disp->Mutex);
list = disp->ResourceLists[_EGL_RESOURCE_SURFACE];
while (list) {
_EGLSurface *surf = (_EGLSurface *) list;

View file

@ -313,6 +313,8 @@ _eglReleaseDisplayResources(_EGLDisplay *display)
_EGLResource *list;
const _EGLDriver *drv = display->Driver;
simple_mtx_assert_locked(&display->Mutex);
list = display->ResourceLists[_EGL_RESOURCE_CONTEXT];
while (list) {
_EGLContext *ctx = (_EGLContext *) list;
@ -400,6 +402,8 @@ _eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *disp)
{
_EGLResource *list = disp->ResourceLists[type];
simple_mtx_assert_locked(&disp->Mutex);
if (!res)
return EGL_FALSE;
@ -462,6 +466,7 @@ void
_eglLinkResource(_EGLResource *res, _EGLResourceType type)
{
assert(res->Display);
simple_mtx_assert_locked(&res->Display->Mutex);
res->IsLinked = EGL_TRUE;
res->Next = res->Display->ResourceLists[type];
@ -478,6 +483,8 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type)
{
_EGLResource *prev;
simple_mtx_assert_locked(&res->Display->Mutex);
prev = res->Display->ResourceLists[type];
if (prev != res) {
while (prev) {