Mesa (staging/19.3): intel/perf: fix invalid hw_id in query results

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 4 21:41:12 UTC 2019


Module: Mesa
Branch: staging/19.3
Commit: d362ba77ce870cec0d8ee88f29ef8fe2a7d5d964
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d362ba77ce870cec0d8ee88f29ef8fe2a7d5d964

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Tue Dec  3 16:08:12 2019 +0200

intel/perf: fix invalid hw_id in query results

Accumulation happens between 2 reports, it can be between a start/end
report from another context. So only consider updating the hw_id of
the results when it's not already valid and that we have a valid value
to put in there.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: 41b54b5faf ("i965: move OA accumulation code to intel/perf")
Reviewed-by: Mark Janes <mark.a.janes at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
(cherry picked from commit acea59dbf8056b46444c820115d86c42d0411686)

---

 src/intel/perf/gen_perf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/intel/perf/gen_perf.c b/src/intel/perf/gen_perf.c
index f40d9acd870..6221af3d0f1 100644
--- a/src/intel/perf/gen_perf.c
+++ b/src/intel/perf/gen_perf.c
@@ -71,6 +71,8 @@
 #define MAP_READ  (1 << 0)
 #define MAP_WRITE (1 << 1)
 
+#define OA_REPORT_INVALID_CTX_ID (0xffffffff)
+
 /**
  * Periodic OA samples are read() into these buffer structures via the
  * i915 perf kernel interface and appended to the
@@ -1137,7 +1139,9 @@ gen_perf_query_result_accumulate(struct gen_perf_query_result *result,
 {
    int i, idx = 0;
 
-   result->hw_id = start[2];
+   if (result->hw_id == OA_REPORT_INVALID_CTX_ID &&
+       start[2] != OA_REPORT_INVALID_CTX_ID)
+      result->hw_id = start[2];
    result->reports_accumulated++;
 
    switch (query->oa_format) {
@@ -1175,7 +1179,7 @@ void
 gen_perf_query_result_clear(struct gen_perf_query_result *result)
 {
    memset(result, 0, sizeof(*result));
-   result->hw_id = 0xffffffff; /* invalid */
+   result->hw_id = OA_REPORT_INVALID_CTX_ID; /* invalid */
 }
 
 static void




More information about the mesa-commit mailing list