From 44bbfedbd9983c61f6a461cbfe2e0dc74eda6d37 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 13 Jul 2016 12:17:05 -0400 Subject: gallium/u_queue: add optional cleanup callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a second optional cleanup callback, called after the fence is signaled. This is needed if, for example, the queue has the last reference to the object that embeds the util_queue_fence. In this case we cannot drop the ref in the main callback, since that would result in the fence being destroyed before it is signaled. Signed-off-by: Rob Clark Reviewed-by: Marek Olšák Reviewed-by: Nicolai Hähnle --- src/gallium/auxiliary/util/u_queue.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/gallium/auxiliary/util/u_queue.h') diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/gallium/auxiliary/util/u_queue.h index f70d6466887..59646cc298b 100644 --- a/src/gallium/auxiliary/util/u_queue.h +++ b/src/gallium/auxiliary/util/u_queue.h @@ -50,6 +50,7 @@ struct util_queue_job { void *job; struct util_queue_fence *fence; util_queue_execute_func execute; + util_queue_execute_func cleanup; }; /* Put this into your context. */ @@ -75,10 +76,13 @@ void util_queue_destroy(struct util_queue *queue); void util_queue_fence_init(struct util_queue_fence *fence); void util_queue_fence_destroy(struct util_queue_fence *fence); +/* optional cleanup callback is called after fence is signaled: */ void util_queue_add_job(struct util_queue *queue, void *job, struct util_queue_fence *fence, - util_queue_execute_func execute); + util_queue_execute_func execute, + util_queue_execute_func cleanup); + void util_queue_job_wait(struct util_queue_fence *fence); /* util_queue needs to be cleared to zeroes for this to work */ -- cgit v1.2.3