egl: Refactor init of CPU tracing in EGL for Android
eglGetPlatformDisplay is called by Android's Zygote when preloading EGL at boot. When Perfetto is initialized by `util_cpu_trace_init`, it launches side threads to handle tasks. Unfortunately, Zygote does not tolerate unexpected threads created within its PID. As a result, Zygote aborts and Android devices fail to boot. Signed-off-by: Renato Pereyra <renatopereyra@chromium.org> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30360>
This commit is contained in:

committed by
Marge Bot

parent
f788c87d02
commit
97ed2e4d4b
@@ -412,7 +412,9 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay)
|
||||
_EGLDisplay *disp;
|
||||
void *native_display_ptr;
|
||||
|
||||
#if !DETECT_OS_ANDROID
|
||||
util_cpu_trace_init();
|
||||
#endif
|
||||
_EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL);
|
||||
|
||||
STATIC_ASSERT(sizeof(void *) >= sizeof(nativeDisplay));
|
||||
@@ -477,7 +479,9 @@ eglGetPlatformDisplayEXT(EGLenum platform, void *native_display,
|
||||
EGLAttrib *attrib_list;
|
||||
EGLDisplay disp;
|
||||
|
||||
#if !DETECT_OS_ANDROID
|
||||
util_cpu_trace_init();
|
||||
#endif
|
||||
_EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL);
|
||||
|
||||
if (_eglConvertIntsToAttribs(int_attribs, &attrib_list) != EGL_SUCCESS)
|
||||
@@ -492,7 +496,9 @@ PUBLIC EGLDisplay EGLAPIENTRY
|
||||
eglGetPlatformDisplay(EGLenum platform, void *native_display,
|
||||
const EGLAttrib *attrib_list)
|
||||
{
|
||||
#if !DETECT_OS_ANDROID
|
||||
util_cpu_trace_init();
|
||||
#endif
|
||||
_EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL);
|
||||
return _eglGetPlatformDisplayCommon(platform, native_display, attrib_list);
|
||||
}
|
||||
@@ -670,6 +676,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
|
||||
util_cpu_trace_init();
|
||||
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL);
|
||||
|
||||
_eglDeviceRefreshList();
|
||||
|
Reference in New Issue
Block a user