From a1a5f6430a06a5b3fb774a70ea257f78f2cf00c9 Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Mon, 16 May 2022 12:56:08 -0700 Subject: [PATCH] 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 Part-of: --- 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 9e50325..52773c1 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 8283332..e723426 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. -- 2.7.4