Looks like wgl doesn't have much display state to protect. But it's
ref_count should be atomic before we start removing locking from eglapi
to protect against MakeCurrent being called in parallel on multiple
threads.
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>
* to free it up correctly.
*/
if (wgl_dpy) {
- wgl_dpy->ref_count++;
+ p_atomic_inc(&wgl_dpy->ref_count);
return EGL_TRUE;
}
return EGL_FALSE;
wgl_dpy = wgl_egl_display(disp);
- wgl_dpy->ref_count++;
+ p_atomic_inc(&wgl_dpy->ref_count);
return EGL_TRUE;
}
wgl_dpy = wgl_egl_display(disp);
assert(wgl_dpy->ref_count > 0);
- wgl_dpy->ref_count--;
-
- if (wgl_dpy->ref_count > 0)
+ if (!p_atomic_dec_zero(&wgl_dpy->ref_count))
return;
_eglCleanupDisplay(disp);
* EGLDisplay is terminated and then initialized again while a
* context is still bound. See wgl_intitialize() for a more in depth
* explanation. */
- wgl_dpy->ref_count++;
+ p_atomic_inc(&wgl_dpy->ref_count);
}
}