[Mesa-dev] [PATCH 4/8] i965: extend query/counter structs for OA queries
Robert Bragg
robert at sixbynine.org
Fri Feb 24 13:57:59 UTC 2017
In preparation for generating code from brw_oa_hsw.xml for describing OA
performance counter queries this adds some OA specific members to
brw_perf_query that our generated code will initialize:
- The oa_metric_set_id is the ID we will pass to
DRM_IOCTL_I915_PERF_OPEN, and is an ID got via sysfs under:
/sys/class/drm/<card>/metrics/<guid/id
- The oa_format is the OA report layout we will request from the kernel
- The accumulator offsets determine where the different groups of A, B
and C counters are located within an intermediate 64bit 'accumulator'
buffer.
Additionally brw_perf_query_counter now has 64bit or float _read()
callback members for OA counters.
Signed-off-by: Robert Bragg <robert at sixbynine.org>
---
src/mesa/drivers/dri/i965/brw_context.h | 12 ++++++++++++
src/mesa/drivers/dri/i965/brw_performance_query.h | 10 +++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 68d2fbfc23..cc5ec78f8c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -660,9 +660,21 @@ struct brw_perf_query_info
{
enum brw_query_kind kind;
const char *name;
+ const char *guid;
struct brw_perf_query_counter *counters;
int n_counters;
size_t data_size;
+
+ /* OA specific */
+ uint64_t oa_metrics_set_id;
+ int oa_format;
+
+ /* For indexing into the accumulator[] ... */
+ int gpu_time_offset;
+ int gpu_clock_offset;
+ int a_offset;
+ int b_offset;
+ int c_offset;
};
/**
diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.h b/src/mesa/drivers/dri/i965/brw_performance_query.h
index 8f1f96060b..c9454f98ea 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query.h
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.h
@@ -44,6 +44,14 @@ struct brw_perf_query_counter
size_t offset;
size_t size;
- struct brw_pipeline_stat pipeline_stat;
+ union {
+ uint64_t (*oa_counter_read_uint64)(struct brw_context *brw,
+ const struct brw_perf_query_info *query,
+ uint64_t *accumulator);
+ float (*oa_counter_read_float)(struct brw_context *brw,
+ const struct brw_perf_query_info *query,
+ uint64_t *accumulator);
+ struct brw_pipeline_stat pipeline_stat;
+ };
};
--
2.11.1
More information about the mesa-dev
mailing list