diff options
author | Kenneth Graunke <[email protected]> | 2013-11-02 19:44:49 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-11-21 15:01:14 -0800 |
commit | b05b1eff1c974c897d99f8ae1b3cb480ee39ef67 (patch) | |
tree | 99a16cebb85b2d0381749d27f2dd8075fda64c1d | |
parent | 7329f8dd10673a474554fd881eb09d6908496e0f (diff) |
i965: Track the number of monitors that need OA counters.
Using the OA counters requires some per-batch work. When starting and
ending a batch, it's useful to know whether any monitors are actually
interested in OA data.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_performance_monitor.c | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 43d0bbf7a5e..cb92b282324 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1403,6 +1403,9 @@ struct brw_context /** 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. diff --git a/src/mesa/drivers/dri/i965/brw_performance_monitor.c b/src/mesa/drivers/dri/i965/brw_performance_monitor.c index 850dba78abc..1e04938ad76 100644 --- a/src/mesa/drivers/dri/i965/brw_performance_monitor.c +++ b/src/mesa/drivers/dri/i965/brw_performance_monitor.c @@ -518,7 +518,7 @@ void 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); } @@ -588,6 +588,13 @@ gather_statistics_results(struct brw_context *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. */ @@ -618,6 +625,10 @@ brw_begin_perf_monitor(struct gl_context *ctx, 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); @@ -641,6 +652,10 @@ brw_end_perf_monitor(struct gl_context *ctx, 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, |