intel/perf: expose timestamp begin for mdapi
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 16 Dec 2019 13:36:24 +0000 (15:36 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 16 Jan 2020 13:29:28 +0000 (15:29 +0200)
This was forgotten in the initial implementation.

v2: ensure the value is written for both GL & Vulkan queries

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3112>

src/intel/perf/gen_perf.c
src/intel/perf/gen_perf.h
src/intel/perf/gen_perf_mdapi.c

index 7ab5e685104587e59715d1e9eb87d5d15c35ffcf..fa6afb418073a2f1011adbec111305a0d85f77ac 100644 (file)
@@ -1147,6 +1147,8 @@ gen_perf_query_result_accumulate(struct gen_perf_query_result *result,
    if (result->hw_id == OA_REPORT_INVALID_CTX_ID &&
        start[2] != OA_REPORT_INVALID_CTX_ID)
       result->hw_id = start[2];
+   if (result->reports_accumulated == 0)
+      result->begin_timestamp = start[1];
    result->reports_accumulated++;
 
    switch (query->oa_format) {
index d8698c90cd9c5eac24952cb064ebe7243934ff8e..28df75c5bb1661b6b134127da64a9aff8cecc32b 100644 (file)
@@ -113,6 +113,11 @@ struct gen_perf_query_result {
     * query.
     */
    uint64_t unslice_frequency[2];
+
+   /**
+    * Timestamp of the query.
+    */
+   uint64_t begin_timestamp;
 };
 
 struct gen_perf_query_counter {
index 38ca23088d2ddb3ef7ca482f8f358f748da2a72c..0f35671930f7c8affd7f4e73957bb5b8f013967f 100644 (file)
@@ -73,6 +73,7 @@ gen_perf_query_result_write_mdapi(void *data, uint32_t data_size,
       mdapi_data->ReportsCount = result->reports_accumulated;
       mdapi_data->TotalTime =
          gen_device_info_timebase_scale(devinfo, result->accumulator[0]);
+      mdapi_data->BeginTimestamp = result->begin_timestamp;
       mdapi_data->GPUTicks = result->accumulator[1];
       mdapi_data->CoreFrequency = freq_end;
       mdapi_data->CoreFrequencyChanged = freq_end != freq_start;
@@ -101,6 +102,7 @@ gen_perf_query_result_write_mdapi(void *data, uint32_t data_size,
       mdapi_data->ReportsCount = result->reports_accumulated;
       mdapi_data->TotalTime =
          gen_device_info_timebase_scale(devinfo, result->accumulator[0]);
+      mdapi_data->BeginTimestamp = result->begin_timestamp;
       mdapi_data->GPUTicks = result->accumulator[1];
       mdapi_data->CoreFrequency = freq_end;
       mdapi_data->CoreFrequencyChanged = freq_end != freq_start;