diff options
author | Kenneth Graunke <[email protected]> | 2013-11-13 13:14:46 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-11-21 15:01:14 -0800 |
commit | 834c9575b281f72385085fc1b9adca3893c9c71e (patch) | |
tree | 32480343f1b05bc1bc433923c907628d4170f758 /src/mesa | |
parent | 367c7c2d7cbc9a53805162d335405b3b08d46c2d (diff) |
i965: Add functions to start and stop the OA counters.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_performance_monitor.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_performance_monitor.c b/src/mesa/drivers/dri/i965/brw_performance_monitor.c index fbce35bfb9a..85c395b3aed 100644 --- a/src/mesa/drivers/dri/i965/brw_performance_monitor.c +++ b/src/mesa/drivers/dri/i965/brw_performance_monitor.c @@ -604,6 +604,48 @@ monitor_needs_oa(struct brw_context *brw, } /** + * Enable the Observability Architecture counters by whacking OACONTROL. + */ +static void +start_oa_counters(struct brw_context *brw) +{ + unsigned counter_format; + + /* Pick the counter format which gives us all the counters. */ + switch (brw->gen) { + case 6: + counter_format = 1; /* 0b001 */ + break; + case 7: + counter_format = 5; /* 0b101 */ + break; + default: + assert(!"Tried to enable OA counters on an unsupported generation."); + return; + } + + BEGIN_BATCH(3); + OUT_BATCH(MI_LOAD_REGISTER_IMM | (3 - 2)); + OUT_BATCH(OACONTROL); + OUT_BATCH(counter_format << OACONTROL_COUNTER_SELECT_SHIFT | + OACONTROL_ENABLE_COUNTERS); + ADVANCE_BATCH(); +} + +/** + * Disable OA counters. + */ +static void +stop_oa_counters(struct brw_context *brw) +{ + BEGIN_BATCH(3); + OUT_BATCH(MI_LOAD_REGISTER_IMM | (3 - 2)); + OUT_BATCH(OACONTROL); + OUT_BATCH(0); + ADVANCE_BATCH(); +} + +/** * The amount of batch space it takes to emit an MI_REPORT_PERF_COUNT snapshot, * including the required PIPE_CONTROL flushes. * |