intel/perf: fix crash when no perf queries are supported

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: ec1fa1d51f ("intel/perf: fix raw query kernel metric selection")
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7024>
(cherry picked from commit 79f3544412)
This commit is contained in:
Lionel Landwerlin 2020-10-06 11:38:54 +03:00 committed by Dylan Baker
parent a19b215ad6
commit e29629de7d
2 changed files with 2 additions and 2 deletions

View file

@ -2524,7 +2524,7 @@
"description": "intel/perf: fix crash when no perf queries are supported",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "ec1fa1d51ff614c19d08c949482b40c060de48c9"
},

View file

@ -781,7 +781,7 @@ load_oa_metrics(struct gen_perf_config *perf, int fd,
break;
}
}
if (perf->fallback_raw_oa_metric == 0)
if (perf->fallback_raw_oa_metric == 0 && perf->n_queries > 0)
perf->fallback_raw_oa_metric = perf->queries[perf->n_queries - 1].oa_metrics_set_id;
}