mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
venus: add chain lock helpers for async present
The helpers will protect chain access during async present. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39283>
This commit is contained in:
parent
0a2525491d
commit
2c63534896
1 changed files with 36 additions and 0 deletions
|
|
@ -83,6 +83,42 @@ vn_wsi_chain_lookup(struct vn_device *dev, VkSwapchainKHR swapchain)
|
|||
return chain;
|
||||
}
|
||||
|
||||
static void
|
||||
vn_wsi_chains_lock(struct vn_device *dev,
|
||||
const VkPresentInfoKHR *pi,
|
||||
bool all)
|
||||
{
|
||||
for (uint32_t i = 0; i < pi->swapchainCount; i++) {
|
||||
struct vn_swapchain *chain =
|
||||
vn_wsi_chain_lookup(dev, pi->pSwapchains[i]);
|
||||
|
||||
assert(chain);
|
||||
|
||||
if (all)
|
||||
simple_mtx_lock(&chain->mutex);
|
||||
|
||||
simple_mtx_lock(&chain->acquire_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vn_wsi_chains_unlock(struct vn_device *dev,
|
||||
const VkPresentInfoKHR *pi,
|
||||
bool all)
|
||||
{
|
||||
for (uint32_t i = 0; i < pi->swapchainCount; i++) {
|
||||
struct vn_swapchain *chain =
|
||||
vn_wsi_chain_lookup(dev, pi->pSwapchains[i]);
|
||||
|
||||
assert(chain);
|
||||
|
||||
simple_mtx_unlock(&chain->acquire_mutex);
|
||||
|
||||
if (all)
|
||||
simple_mtx_unlock(&chain->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
|
||||
vn_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue