intel/perf: allow opening perf stream with no context filtering

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10216>
This commit is contained in:
Lionel Landwerlin 2021-05-05 23:24:47 +03:00 committed by Marge Bot
parent b18a4bb8c6
commit fba189a349
3 changed files with 10 additions and 8 deletions

View file

@ -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

View file

@ -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,

View file

@ -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;