mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
pps: init driver in OnSetup
Initialization of driver has been moved to register_data_source() from OnSetup() by:a739889789("pps: Report available counters when gpu.counters* data source is registered") With above change, pps will destroy driver when collecting data stops (pps may keep running) then the driver will become nullptr when user try to collect data again. This will cause segmentation fault in OnSetup(). So this remove driver = nullptr in OnStop() and init driver in OnSetup() to make sure driver exists when pps-producer run more than once. Fixes:a739889789("pps: Report available counters when gpu.counters* data source is registered") Signed-off-by: Julia Zhang <Julia.Zhang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36548> (cherry picked from commit20b809f1f0)
This commit is contained in:
parent
1cfa5a474b
commit
a245b6cd72
2 changed files with 4 additions and 2 deletions
|
|
@ -3684,7 +3684,7 @@
|
|||
"description": "pps: init driver in OnSetup",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "a739889789f454b755ae9ff36cc4998835fee5e1",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ float ms(const std::chrono::nanoseconds &t)
|
|||
|
||||
void GpuDataSource::OnSetup(const SetupArgs &args)
|
||||
{
|
||||
if (!driver->init_perfcnt())
|
||||
PPS_LOG_ERROR("Failed to initialize %s driver", driver->drm_device.name.c_str());
|
||||
|
||||
// Parse perfetto config
|
||||
const std::string &config_raw = args.config->gpu_counter_config_raw();
|
||||
perfetto::protos::pbzero::GpuCounterConfig::Decoder config(config_raw);
|
||||
|
|
@ -111,7 +114,6 @@ void GpuDataSource::OnStop(const StopArgs &args)
|
|||
stop_closure();
|
||||
|
||||
driver->disable_perfcnt();
|
||||
driver = nullptr;
|
||||
|
||||
std::lock_guard<std::mutex> lock(started_m);
|
||||
started = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue