summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2022-06-09 09:19:18 -0400
committerDylan Baker <dylan.c.baker@intel.com>2022-06-15 16:12:59 -0700
commita86a20ed99d9c48d43e1b67262e3d2f81ac16509 (patch)
tree14d0d97611dce5fa7bc31f1e75c9d4679c07577e
parent302c13dc8dfd2e6166361f638c888061152cff03 (diff)
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: 8ade5588e39 ("zink: add kopper api") Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16932> (cherry picked from commit 1dfa19c541d2d1da1ba3f440d4d0107c4968b3e0)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/zink/zink_kopper.c5
-rw-r--r--src/gallium/drivers/zink/zink_kopper.h1
3 files changed, 6 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index b85b462bfa2..b748ae23d56 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -31,7 +31,7 @@
"description": "zink: keep a count of async presents occuring for a given swapchain",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "8ade5588e39d736bdeab9bdd8ffa7cbfb6a5191e"
},
diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c
index 3cdff02dab9..cfce107f1be 100644
--- a/src/gallium/drivers/zink/zink_kopper.c
+++ b/src/gallium/drivers/zink/zink_kopper.c
@@ -634,6 +634,8 @@ kopper_present(void *data, void *gdata, int thread_idx)
_mesa_hash_table_insert(swapchain->presents, (void*)(uintptr_t)next, arr);
}
util_dynarray_append(arr, VkSemaphore, cpi->sem);
+ if (thread_idx != -1)
+ p_atomic_dec(&swapchain->async_presents);
free(cpi);
}
@@ -660,10 +662,11 @@ zink_kopper_present_queue(struct zink_screen *screen, struct zink_resource *res)
cpi->info.pResults = NULL;
res->obj->present = VK_NULL_HANDLE;
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,
kopper_present, NULL, 0);
} else {
- kopper_present(cpi, screen, 0);
+ kopper_present(cpi, screen, -1);
}
res->obj->acquire = VK_NULL_HANDLE;
res->obj->indefinite_acquire = res->obj->acquired = false;
diff --git a/src/gallium/drivers/zink/zink_kopper.h b/src/gallium/drivers/zink/zink_kopper.h
index 01a3ccabaa1..836dac0c9a0 100644
--- a/src/gallium/drivers/zink/zink_kopper.h
+++ b/src/gallium/drivers/zink/zink_kopper.h
@@ -41,6 +41,7 @@ struct kopper_swapchain {
VkSwapchainCreateInfoKHR scci;
unsigned num_acquires;
unsigned max_acquires;
+ unsigned async_presents;
};
enum kopper_type {