diff --git a/src/intel/perf/intel_perf.c b/src/intel/perf/intel_perf.c index 33218874610..80660fb3eda 100644 --- a/src/intel/perf/intel_perf.c +++ b/src/intel/perf/intel_perf.c @@ -53,8 +53,6 @@ #define FILE_DEBUG_FLAG DEBUG_PERFMON -#define OA_REPORT_INVALID_CTX_ID (0xffffffff) - static bool is_dir_or_link(const struct dirent *entry, const char *parent_dir) { @@ -1052,8 +1050,8 @@ intel_perf_query_result_accumulate(struct intel_perf_query_result *result, { int i; - if (result->hw_id == OA_REPORT_INVALID_CTX_ID && - start[2] != OA_REPORT_INVALID_CTX_ID) + if (result->hw_id == INTEL_PERF_INVALID_CTX_ID && + start[2] != INTEL_PERF_INVALID_CTX_ID) result->hw_id = start[2]; if (result->reports_accumulated == 0) result->begin_timestamp = start[1]; @@ -1229,7 +1227,7 @@ void intel_perf_query_result_clear(struct intel_perf_query_result *result) { memset(result, 0, sizeof(*result)); - result->hw_id = OA_REPORT_INVALID_CTX_ID; /* invalid */ + result->hw_id = INTEL_PERF_INVALID_CTX_ID; } void diff --git a/src/intel/perf/intel_perf.h b/src/intel/perf/intel_perf.h index 74aa3620b48..6f8c1a50ea2 100644 --- a/src/intel/perf/intel_perf.h +++ b/src/intel/perf/intel_perf.h @@ -50,6 +50,8 @@ struct intel_device_info; struct intel_perf_config; struct intel_perf_query_info; +#define INTEL_PERF_INVALID_CTX_ID (0xffffffff) + enum intel_perf_counter_type { INTEL_PERF_COUNTER_TYPE_EVENT, INTEL_PERF_COUNTER_TYPE_DURATION_NORM, diff --git a/src/intel/perf/intel_perf_query.c b/src/intel/perf/intel_perf_query.c index cc1981a1f8d..cff3138f577 100644 --- a/src/intel/perf/intel_perf_query.c +++ b/src/intel/perf/intel_perf_query.c @@ -375,9 +375,11 @@ intel_perf_open(struct intel_perf_context *perf_ctx, uint64_t properties[DRM_I915_PERF_PROP_MAX * 2]; uint32_t p = 0; - /* Single context sampling */ - properties[p++] = DRM_I915_PERF_PROP_CTX_HANDLE; - properties[p++] = ctx_id; + /* Single context sampling if valid context id. */ + if (ctx_id != INTEL_PERF_INVALID_CTX_ID) { + properties[p++] = DRM_I915_PERF_PROP_CTX_HANDLE; + properties[p++] = ctx_id; + } /* Include OA reports in samples */ properties[p++] = DRM_I915_PERF_PROP_SAMPLE_OA;