aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoff Lang <geofflang@chromium.org>2024-04-24 16:46:01 -0400
committerAngle LUCI CQ <angle-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-04-26 10:58:45 +0000
commit884dc38077b6e8f827b0f13a54b61f64dc20ecfa (patch)
tree1112aba0385ae8b28df318583b975f4b02357d00
parentbea8d9dd8f591d01b43981747b6c8940927470ec (diff)
downloadangle-884dc38077b6e8f827b0f13a54b61f64dc20ecfa.tar.gz
EGL: Make eglGetCurrent(Context|Surface|Display) lockless.
These functions access only egl::Thread state. Bug: angleproject:8434 Change-Id: I3dd6cd1f4fd145613f0be824e4f6e13815422997 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5485526 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
-rw-r--r--scripts/code_generation_hashes/GL_EGL_entry_points.json4
-rwxr-xr-xscripts/generate_entry_points.py4
-rw-r--r--src/libGLESv2/entry_points_egl_autogen.cpp48
3 files changed, 23 insertions, 33 deletions
diff --git a/scripts/code_generation_hashes/GL_EGL_entry_points.json b/scripts/code_generation_hashes/GL_EGL_entry_points.json
index 9d018b3bd0..3161e4b2e0 100644
--- a/scripts/code_generation_hashes/GL_EGL_entry_points.json
+++ b/scripts/code_generation_hashes/GL_EGL_entry_points.json
@@ -6,7 +6,7 @@
"scripts/entry_point_packed_gl_enums.json":
"57a3a729fd25032bc336f4b6a55bc238",
"scripts/generate_entry_points.py":
- "07f568a7df66934387bf05759110c934",
+ "c811134a03d12777acd1bb85da21ce92",
"scripts/gl_angle_ext.xml":
"197e07a917d5bba6dfa2840fb1b58e7e",
"scripts/registry_xml.py":
@@ -130,7 +130,7 @@
"src/libGLESv2/entry_points_cl_autogen.h":
"dde2f94c3004874a7da995dae69da811",
"src/libGLESv2/entry_points_egl_autogen.cpp":
- "753e22c68aa2f60c02c9bda707b554e7",
+ "7b164c4311aba60564509540b1ed8303",
"src/libGLESv2/entry_points_egl_autogen.h":
"3bc7a8df9deadd7cfd615d0cfad0c6a8",
"src/libGLESv2/entry_points_egl_ext_autogen.cpp":
diff --git a/scripts/generate_entry_points.py b/scripts/generate_entry_points.py
index 59d62d8bd8..be01613d38 100755
--- a/scripts/generate_entry_points.py
+++ b/scripts/generate_entry_points.py
@@ -1607,7 +1607,9 @@ def is_context_private_state_command(api, name):
def is_lockless_egl_entry_point(cmd_name):
- if cmd_name in ["eglGetError"]:
+ if cmd_name in [
+ "eglGetError", "eglGetCurrentContext", "eglGetCurrentSurface", "eglGetCurrentDisplay"
+ ]:
return True
return False
diff --git a/src/libGLESv2/entry_points_egl_autogen.cpp b/src/libGLESv2/entry_points_egl_autogen.cpp
index e4b20fd4bf..54a0591d67 100644
--- a/src/libGLESv2/entry_points_egl_autogen.cpp
+++ b/src/libGLESv2/entry_points_egl_autogen.cpp
@@ -355,19 +355,15 @@ EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay()
Thread *thread = egl::GetCurrentThread();
EGLDisplay returnValue;
- {
- ANGLE_SCOPED_GLOBAL_LOCK();
- EGL_EVENT(GetCurrentDisplay, "");
- {
- ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCurrentDisplay, thread);
- ANGLE_EGL_VALIDATE(thread, GetCurrentDisplay, nullptr, EGLDisplay);
+ EGL_EVENT(GetCurrentDisplay, "");
- returnValue = GetCurrentDisplay(thread);
- }
+ ANGLE_EGL_VALIDATE(thread, GetCurrentDisplay, nullptr, EGLDisplay);
+
+ returnValue = GetCurrentDisplay(thread);
+
+ ANGLE_CAPTURE_EGL(GetCurrentDisplay, true, thread, returnValue);
- ANGLE_CAPTURE_EGL(GetCurrentDisplay, true, thread, returnValue);
- }
ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
return returnValue;
}
@@ -377,19 +373,15 @@ EGLSurface EGLAPIENTRY EGL_GetCurrentSurface(EGLint readdraw)
Thread *thread = egl::GetCurrentThread();
EGLSurface returnValue;
- {
- ANGLE_SCOPED_GLOBAL_LOCK();
- EGL_EVENT(GetCurrentSurface, "readdraw = %d", readdraw);
- {
- ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCurrentSurface, thread);
- ANGLE_EGL_VALIDATE(thread, GetCurrentSurface, nullptr, EGLSurface, readdraw);
+ EGL_EVENT(GetCurrentSurface, "readdraw = %d", readdraw);
- returnValue = GetCurrentSurface(thread, readdraw);
- }
+ ANGLE_EGL_VALIDATE(thread, GetCurrentSurface, nullptr, EGLSurface, readdraw);
+
+ returnValue = GetCurrentSurface(thread, readdraw);
+
+ ANGLE_CAPTURE_EGL(GetCurrentSurface, true, thread, readdraw, returnValue);
- ANGLE_CAPTURE_EGL(GetCurrentSurface, true, thread, readdraw, returnValue);
- }
ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
return returnValue;
}
@@ -958,19 +950,15 @@ EGLContext EGLAPIENTRY EGL_GetCurrentContext()
Thread *thread = egl::GetCurrentThread();
EGLContext returnValue;
- {
- ANGLE_SCOPED_GLOBAL_LOCK();
- EGL_EVENT(GetCurrentContext, "");
- {
- ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCurrentContext, thread);
- ANGLE_EGL_VALIDATE(thread, GetCurrentContext, nullptr, EGLContext);
+ EGL_EVENT(GetCurrentContext, "");
- returnValue = GetCurrentContext(thread);
- }
+ ANGLE_EGL_VALIDATE(thread, GetCurrentContext, nullptr, EGLContext);
+
+ returnValue = GetCurrentContext(thread);
+
+ ANGLE_CAPTURE_EGL(GetCurrentContext, true, thread, returnValue);
- ANGLE_CAPTURE_EGL(GetCurrentContext, true, thread, returnValue);
- }
ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
return returnValue;
}