perfetto: unify init

util_perfetto_init() was called in some places, util_cpu_trace_init()
was called in other places, and some places used tracing without ever
calling either of them

util_cpu_trace_init() is now guaranteed to be called:
* on gallium screen create
* on VK instance create

thus no driver/frontend/etc should ever need to call this manually

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36628>
This commit is contained in:
Mike Blumenkrantz 2025-08-07 06:53:42 -04:00 committed by Marge Bot
parent f53bf77d47
commit c7045e3e63
11 changed files with 3 additions and 26 deletions

View file

@ -406,9 +406,6 @@ 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));
@ -473,9 +470,6 @@ 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)
@ -490,9 +484,6 @@ 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);
}
@ -666,7 +657,6 @@ 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();

View file

@ -53,8 +53,6 @@ PERFETTO_DEFINE_DATA_SOURCE_STATIC_MEMBERS(FdMemoryDataSource);
extern "C" void
fd_drm_perfetto_init(void)
{
util_perfetto_init();
perfetto::DataSourceDescriptor dsd;
dsd.set_name("gpu.memory.msm");
FdMemoryDataSource::Register(dsd);

View file

@ -345,8 +345,6 @@ extern "C" {
void
tu_perfetto_init(void)
{
util_perfetto_init();
{
perfetto::DataSourceDescriptor dsd;
#if DETECT_OS_ANDROID

View file

@ -32,6 +32,7 @@
#include "util/u_string.h"
#include "util/xmlconfig.h"
#include "util/driconf.h"
#include "util/perf/cpu_trace.h"
#include <string.h>
@ -169,6 +170,8 @@ pipe_loader_create_screen_vk(struct pipe_loader_device *dev, bool sw_vk, bool dr
{
struct pipe_screen_config config;
util_cpu_trace_init();
pipe_loader_load_options(dev);
config.driver_name_is_inferred = driver_name_is_inferred;
config.options_info = &dev->option_info;

View file

@ -261,8 +261,6 @@ extern "C" {
void
fd_perfetto_init(void)
{
util_perfetto_init();
perfetto::DataSourceDescriptor dsd;
#if DETECT_OS_ANDROID
// Android tooling expects this data source name

View file

@ -966,8 +966,6 @@ panfrost_create_screen(int fd, const struct pipe_screen_config *config,
screen->max_afbc_packing_ratio = debug_get_num_option(
"PAN_MAX_AFBC_PACKING_RATIO", DEFAULT_MAX_AFBC_PACKING_RATIO);
util_cpu_trace_init();
if (panfrost_open_device(screen, fd, dev)) {
ralloc_free(screen);
return NULL;

View file

@ -316,7 +316,6 @@ void si_ds_end_submit(struct si_ds_queue *queue, uint64_t start_ts)
static void si_driver_ds_init_once(void)
{
#ifdef HAVE_PERFETTO
util_perfetto_init();
perfetto::DataSourceDescriptor dsd;
#if DETECT_OS_ANDROID
// Android tooling expects this data source name

View file

@ -767,8 +767,6 @@ v3d_screen_create(int fd, const struct pipe_screen_config *config,
struct v3d_screen *screen = rzalloc(NULL, struct v3d_screen);
struct pipe_screen *pscreen;
util_cpu_trace_init();
pscreen = &screen->base;
pscreen->destroy = v3d_screen_destroy;

View file

@ -466,8 +466,6 @@ vc4_screen_create(int fd, const struct pipe_screen_config *config,
struct pipe_screen *pscreen;
int err;
util_cpu_trace_init();
pscreen = &screen->base;
pscreen->destroy = vc4_screen_destroy;

View file

@ -594,7 +594,6 @@ static void
intel_driver_ds_init_once(void)
{
#ifdef HAVE_PERFETTO
util_perfetto_init();
perfetto::DataSourceDescriptor dsd;
#if DETECT_OS_ANDROID
// Android tooling expects this data source name

View file

@ -304,8 +304,6 @@ panvk_utrace_perfetto_init(struct panvk_device *dev, uint32_t queue_count)
for (uint32_t i = 0; i < ARRAY_SIZE(utp->stage_iids); i++)
utp->stage_iids[i] = next_iid++;
util_perfetto_init();
static once_flag register_ds_once = ONCE_FLAG_INIT;
call_once(&register_ds_once, register_data_source);
}