intel/perf: fix calculation of used counter space
authorMarcin Ślusarz <marcin.slusarz@intel.com>
Wed, 10 Jun 2020 13:29:53 +0000 (15:29 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 10 Aug 2020 13:41:29 +0000 (13:41 +0000)
It matters only when counters are not ordered by offset.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5788>

src/intel/perf/gen_perf_query.c

index 57b01203a6f0cfb8fe67df8eb403660b49bae557..755ec9a83dd3f7e12ef1228e3fe43609cfb6492e 100644 (file)
@@ -1469,7 +1469,9 @@ get_oa_counter_data(struct gen_perf_context *perf_ctx,
             /* So far we aren't using uint32, double or bool32... */
             unreachable("unexpected counter data type");
          }
-         written = counter->offset + counter_size;
+
+         if (counter->offset + counter_size > written)
+            written = counter->offset + counter_size;
       }
    }