Mesa (main): iris: provide a callback to INTEL_MEASURE to clean up snapshots

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 16 03:30:01 UTC 2022


Module: Mesa
Branch: main
Commit: 7b7474785477abb30bc75e30977d5821e471337e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b7474785477abb30bc75e30977d5821e471337e

Author: Mark Janes <markjanes at swizzler.org>
Date:   Mon May 16 13:03:25 2022 -0700

iris: provide a callback to INTEL_MEASURE to clean up snapshots

Snapshots are processed asynchronously by INTEL_MEASURE, but snapshot
memory is allocated and associated with an iris batch.  Provide a
callback that will free snapshot memory after a batch is fully
processed.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16571>

---

 src/gallium/drivers/iris/iris_measure.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/gallium/drivers/iris/iris_measure.c b/src/gallium/drivers/iris/iris_measure.c
index 930d7ab9ef3..0d93ebd91b3 100644
--- a/src/gallium/drivers/iris/iris_measure.c
+++ b/src/gallium/drivers/iris/iris_measure.c
@@ -32,6 +32,19 @@
 #include "iris_defines.h"
 #include "compiler/shader_info.h"
 
+/**
+ * This callback is registered with intel_measure.  It will be called when
+ * snapshot data has been fully collected, so iris can release the associated
+ * resources.
+ */
+static void
+measure_batch_free(struct intel_measure_batch *base)
+{
+   struct iris_measure_batch *batch =
+      container_of(base, struct iris_measure_batch, base);
+   iris_destroy_batch_measure(batch);
+}
+
 void
 iris_init_screen_measure(struct iris_screen *screen)
 {
@@ -39,6 +52,7 @@ iris_init_screen_measure(struct iris_screen *screen)
 
    memset(measure_device, 0, sizeof(*measure_device));
    intel_measure_init(measure_device);
+   measure_device->release_batch = &measure_batch_free;
    struct intel_measure_config *config = measure_device->config;
    if (config == NULL)
       return;



More information about the mesa-commit mailing list