util: Shut down Perfetto before driver unload
Shut down Perfetto before unloading the driver to fix a crash caused by an internal Perfetto thread that kept running after dlclose() took away its code. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4909 Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17454>
This commit is contained in:
parent
1a07a07a50
commit
0ff4f5a7e9
|
@ -27,6 +27,12 @@
|
|||
|
||||
#include "u_perfetto.h"
|
||||
|
||||
static void
|
||||
util_perfetto_fini(void)
|
||||
{
|
||||
perfetto::Tracing::Shutdown();
|
||||
}
|
||||
|
||||
static void
|
||||
util_perfetto_init_once(void)
|
||||
{
|
||||
|
@ -34,6 +40,7 @@ util_perfetto_init_once(void)
|
|||
perfetto::TracingInitArgs args;
|
||||
args.backends = perfetto::kSystemBackend;
|
||||
perfetto::Tracing::Initialize(args);
|
||||
atexit(&util_perfetto_fini);
|
||||
}
|
||||
|
||||
static once_flag perfetto_once_flag = ONCE_FLAG_INIT;
|
||||
|
|
Loading…
Reference in New Issue