Mesa (staging/19.3): intel/perf: set read buffer len to 0 to identify empty buffer

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


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

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

intel/perf: set read buffer len to 0 to identify empty buffer

We always add an empty buffer in the list when creating the query.
Let's set the len appropriately so that we can recognize it when we
read OA reports up to the end of a query.

We were using an 0 timestamp value associated with the empty buffer
and incorrectly assuming this was a valid value. In turn that led to
not reading enough reports and resulted in deltas added to our counter
values which should have been discarded because those would be flagged
for a different context.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: <mesa-stable at lists.freedesktop.org>
Reviewed-by: Mark Janes <mark.a.janes at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
(cherry picked from commit 9d0a5c817ce21adabeda5153035b30609e2862b2)

---

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

diff --git a/src/intel/perf/gen_perf.c b/src/intel/perf/gen_perf.c
index 6221af3d0f1..7073afe8f44 100644
--- a/src/intel/perf/gen_perf.c
+++ b/src/intel/perf/gen_perf.c
@@ -1460,8 +1460,8 @@ get_free_sample_buf(struct gen_perf_context *perf_ctx)
 
       exec_node_init(&buf->link);
       buf->refcount = 0;
-      buf->len = 0;
    }
+   buf->len = 0;
 
    return buf;
 }
@@ -1978,7 +1978,8 @@ read_oa_samples_until(struct gen_perf_context *perf_ctx,
       exec_list_get_tail(&perf_ctx->sample_buffers);
    struct oa_sample_buf *tail_buf =
       exec_node_data(struct oa_sample_buf, tail_node, link);
-   uint32_t last_timestamp = tail_buf->last_timestamp;
+   uint32_t last_timestamp =
+      tail_buf->len == 0 ? start_timestamp : tail_buf->last_timestamp;
 
    while (1) {
       struct oa_sample_buf *buf = get_free_sample_buf(perf_ctx);




More information about the mesa-commit mailing list