Skip to content
Snippets Groups Projects
Commit a86a20ed authored by Mike Blumenkrantz's avatar Mike Blumenkrantz :lifter: Committed by Dylan Baker
Browse files

zink: keep a count of async presents occuring for a given swapchain


this provides info about whether a swapchain is in use in another thread

Fixes: 8ade5588 ("zink: add kopper api")

Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
Part-of: <mesa/mesa!16932>
(cherry picked from commit 1dfa19c5)
parent 302c13dc
No related branches found
No related tags found
Loading
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
"description": "zink: keep a count of async presents occuring for a given swapchain", "description": "zink: keep a count of async presents occuring for a given swapchain",
"nominated": true, "nominated": true,
"nomination_type": 1, "nomination_type": 1,
"resolution": 0, "resolution": 1,
"main_sha": null, "main_sha": null,
"because_sha": "8ade5588e39d736bdeab9bdd8ffa7cbfb6a5191e" "because_sha": "8ade5588e39d736bdeab9bdd8ffa7cbfb6a5191e"
}, },
......
...@@ -634,6 +634,8 @@ kopper_present(void *data, void *gdata, int thread_idx) ...@@ -634,6 +634,8 @@ kopper_present(void *data, void *gdata, int thread_idx)
_mesa_hash_table_insert(swapchain->presents, (void*)(uintptr_t)next, arr); _mesa_hash_table_insert(swapchain->presents, (void*)(uintptr_t)next, arr);
} }
util_dynarray_append(arr, VkSemaphore, cpi->sem); util_dynarray_append(arr, VkSemaphore, cpi->sem);
if (thread_idx != -1)
p_atomic_dec(&swapchain->async_presents);
free(cpi); free(cpi);
} }
...@@ -660,10 +662,11 @@ zink_kopper_present_queue(struct zink_screen *screen, struct zink_resource *res) ...@@ -660,10 +662,11 @@ zink_kopper_present_queue(struct zink_screen *screen, struct zink_resource *res)
cpi->info.pResults = NULL; cpi->info.pResults = NULL;
res->obj->present = VK_NULL_HANDLE; res->obj->present = VK_NULL_HANDLE;
if (util_queue_is_initialized(&screen->flush_queue)) { if (util_queue_is_initialized(&screen->flush_queue)) {
p_atomic_inc(&cpi->swapchain->async_presents);
util_queue_add_job(&screen->flush_queue, cpi, &cdt->present_fence, util_queue_add_job(&screen->flush_queue, cpi, &cdt->present_fence,
kopper_present, NULL, 0); kopper_present, NULL, 0);
} else { } else {
kopper_present(cpi, screen, 0); kopper_present(cpi, screen, -1);
} }
res->obj->acquire = VK_NULL_HANDLE; res->obj->acquire = VK_NULL_HANDLE;
res->obj->indefinite_acquire = res->obj->acquired = false; res->obj->indefinite_acquire = res->obj->acquired = false;
......
...@@ -41,6 +41,7 @@ struct kopper_swapchain { ...@@ -41,6 +41,7 @@ struct kopper_swapchain {
VkSwapchainCreateInfoKHR scci; VkSwapchainCreateInfoKHR scci;
unsigned num_acquires; unsigned num_acquires;
unsigned max_acquires; unsigned max_acquires;
unsigned async_presents;
}; };
enum kopper_type { enum kopper_type {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment