Skip to content

egl: Reduce mutli-threaded lock contention

Rob Clark requested to merge robclark/mesa:egl/lock-contention into main

This series reduces the scope of the EGL display mutex to address performance bottlenecks arising from multi-threaded EGL usage (ie. apps which use per-thread egl contexts).

The first few patches are some misc things that I found in the course of analyzing perfetto traces, and some egl cleanups. After which, the different EGL driver's have their backend display object refcounted switched to atomics, to deal with multi-threaded eglMakeCurrent() calls after the locking is relaxed. Then egl_dri2 gets it's own mutex, mostly to protect less critical paths that have not been fully audited for thread safety. And then finally the toplevel EGL display mutex is reduced to only cover protecting _egl_displays own data structures and not held across calls to backend driver.

Fixes #7039 (closed)

Merge request reports