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:
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user