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>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user