mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
freedreno/drm: Only initialize memory data source when Perfetto is active
FdMemoryDataSource was being registered as a Perfetto data source unconditionally which led to anything calling fd_device_new(...) attempting to do this even when they might not have Perfetto initialized which is done as a part of util_perfetto_init, without which trying to register the event causes a SEGFAULT. Fixes:c7045e3e63("perfetto: unify init") Signed-off-by: Mark Collins <mark@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36993> (cherry picked from commit098521559d)
This commit is contained in:
parent
1ce7aca953
commit
17621e7943
2 changed files with 12 additions and 4 deletions
|
|
@ -854,7 +854,7 @@
|
|||
"description": "freedreno/drm: Only initialize memory data source when Perfetto is active",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "c7045e3e6331c207065b77285ea9e786276ca0d2",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -50,17 +50,25 @@ class FdMemoryDataSource : public perfetto::DataSource<FdMemoryDataSource> {
|
|||
PERFETTO_DECLARE_DATA_SOURCE_STATIC_MEMBERS(FdMemoryDataSource);
|
||||
PERFETTO_DEFINE_DATA_SOURCE_STATIC_MEMBERS(FdMemoryDataSource);
|
||||
|
||||
bool fd_drm_perfetto_active = false;
|
||||
|
||||
extern "C" void
|
||||
fd_drm_perfetto_init(void)
|
||||
{
|
||||
perfetto::DataSourceDescriptor dsd;
|
||||
dsd.set_name("gpu.memory.msm");
|
||||
FdMemoryDataSource::Register(dsd);
|
||||
if (!fd_drm_perfetto_active && util_perfetto_is_tracing_enabled()) {
|
||||
perfetto::DataSourceDescriptor dsd;
|
||||
dsd.set_name("gpu.memory.msm");
|
||||
FdMemoryDataSource::Register(dsd);
|
||||
fd_drm_perfetto_active = true;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
fd_alloc_log(struct fd_bo *bo, enum fd_alloc_category from, enum fd_alloc_category to)
|
||||
{
|
||||
if (!fd_drm_perfetto_active)
|
||||
return;
|
||||
|
||||
/* Special case for BOs that back heap chunks, they don't immediately
|
||||
* transition to active, despite what the caller thinks:
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue