/** A map from pipeline statistics counter IDs to MMIO addresses. */
const int *statistics_registers;
+ /** The number of active monitors using OA counters. */
+ unsigned oa_users;
+
/**
* Mapping from a uint32_t offset within an OA snapshot to the ID of
* the counter which MI_REPORT_PERF_COUNT stores there.
brw_dump_perf_monitors(struct brw_context *brw)
{
struct gl_context *ctx = &brw->ctx;
- DBG("Monitors:\n");
+ DBG("Monitors: (OA users = %d)\n", brw->perfmon.oa_users);
_mesa_HashWalk(ctx->PerfMonitor.Monitors, dump_perf_monitor_callback, brw);
}
/******************************************************************************/
+static bool
+monitor_needs_oa(struct brw_context *brw,
+ struct gl_perf_monitor_object *m)
+{
+ return m->ActiveGroups[OA_COUNTERS];
+}
+
/**
* Initialize a monitor to sane starting state; throw away old buffers.
*/
reinitialize_perf_monitor(brw, monitor);
+ if (monitor_needs_oa(brw, m)) {
+ ++brw->perfmon.oa_users;
+ }
+
if (monitor_needs_statistics_registers(brw, m)) {
monitor->pipeline_stats_bo =
drm_intel_bo_alloc(brw->bufmgr, "perf. monitor stats bo", 4096, 64);
DBG("End(%d)\n", m->Name);
+ if (monitor_needs_oa(brw, m)) {
+ --brw->perfmon.oa_users;
+ }
+
if (monitor_needs_statistics_registers(brw, m)) {
/* Take ending snapshots. */
snapshot_statistics_registers(brw, monitor,