Mesa (main): intel: provide a callback to clean up after intel_measure_gather

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


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

Author: Mark Janes <markjanes at swizzler.org>
Date:   Mon May 16 12:56:08 2022 -0700

intel: provide a callback to clean up after intel_measure_gather

The caller may have passed ownership of intel_measure_batch structures
to intel_measure until they are ready to be gathered.  The caller
needs a notification when rendering is complete and snapshots have
been processed, so it can free the resources that measure the batch.

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

---

 src/intel/common/intel_measure.c | 3 +++
 src/intel/common/intel_measure.h | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/src/intel/common/intel_measure.c b/src/intel/common/intel_measure.c
index 9e50325ebed..52773c1460a 100644
--- a/src/intel/common/intel_measure.c
+++ b/src/intel/common/intel_measure.c
@@ -215,6 +215,7 @@ intel_measure_init(struct intel_measure_device *device)
 
    device->config = NULL;
    device->frame = 0;
+   device->release_batch = NULL;
    pthread_mutex_init(&device->mutex, NULL);
    list_inithead(&device->queued_snapshots);
 
@@ -661,6 +662,8 @@ intel_measure_gather(struct intel_measure_device *measure_device,
 
       batch->index = 0;
       batch->frame = 0;
+      if (measure_device->release_batch)
+         measure_device->release_batch(batch);
    }
 
    intel_measure_print(measure_device, info);
diff --git a/src/intel/common/intel_measure.h b/src/intel/common/intel_measure.h
index 8283332aafa..e7234268027 100644
--- a/src/intel/common/intel_measure.h
+++ b/src/intel/common/intel_measure.h
@@ -124,9 +124,13 @@ struct intel_measure_ringbuffer {
    struct intel_measure_buffered_result results[0];
 };
 
+/* This function will be called when enqueued snapshots have been processed */
+typedef void (*intel_measure_release_batch_cb)(struct intel_measure_batch *base);
+
 struct intel_measure_device {
    struct intel_measure_config *config;
    unsigned frame;
+   intel_measure_release_batch_cb release_batch;
 
    /* Holds the list of (iris/anv)_measure_batch snapshots that have been
     * submitted for rendering, but have not completed.



More information about the mesa-commit mailing list