Mesa (master): i965: perf: factorize code for availability
Lionel Landwerlin
llandwerlin at kemper.freedesktop.org
Fri Nov 3 15:06:16 UTC 2017
Module: Mesa
Branch: master
Commit: 285a2192f93f09f5dc806dce0326281768539f55
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=285a2192f93f09f5dc806dce0326281768539f55
Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date: Tue Jul 25 17:19:08 2017 +0100
i965: perf: factorize code for availability
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_oa.py | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_oa.py b/src/mesa/drivers/dri/i965/brw_oa.py
index 91f7ecb573..8c35923462 100644
--- a/src/mesa/drivers/dri/i965/brw_oa.py
+++ b/src/mesa/drivers/dri/i965/brw_oa.py
@@ -325,6 +325,21 @@ semantic_type_map = {
"ratio": "event"
}
+def output_availability(set, availability, counter_name):
+ expression = splice_rpn_expression(set, counter_name, availability)
+ lines = expression.split(' && ')
+ n_lines = len(lines)
+ if n_lines == 1:
+ c("if (" + lines[0] + ") {")
+ else:
+ c("if (" + lines[0] + " &&")
+ c_indent(4)
+ for i in range(1, (n_lines - 1)):
+ c(lines[i] + " &&")
+ c(lines[(n_lines - 1)] + ") {")
+ c_outdent(4)
+
+
def output_counter_report(set, counter, current_offset):
data_type = counter.get('data_type')
data_type_uc = data_type.upper()
@@ -343,18 +358,7 @@ def output_counter_report(set, counter, current_offset):
availability = counter.get('availability')
if availability:
- expression = splice_rpn_expression(set, counter, availability)
- lines = expression.split(' && ')
- n_lines = len(lines)
- if n_lines == 1:
- c("if (" + lines[0] + ") {")
- else:
- c("if (" + lines[0] + " &&")
- c_indent(4)
- for i in range(1, (n_lines - 1)):
- c(lines[i] + " &&")
- c(lines[(n_lines - 1)] + ") {")
- c_outdent(4)
+ output_availability(set, availability, counter.get('name'))
c_indent(3)
c("counter = &query->counters[query->n_counters++];\n")
More information about the mesa-commit
mailing list