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@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16571>
This commit is contained in:
Mark Janes
2022-05-16 12:56:08 -07:00
committed by Marge Bot
parent 34a130fedf
commit a1a5f6430a
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -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);
+4
View File
@@ -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.