mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2026-02-05 08:40:27 +01:00
Synchronise access to the ring buffer pool
We need to synchronise access to the ring buffer pool in order to avoid concurrency bugs as multiple threads can mutate the state of the ring buffer and if we do not serialise these changes then they can result in errors. Change-Id: If96e1707716370bcf57416cd505d16aa75c0d68c Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
This commit is contained in:
parent
212a7314c3
commit
bed55ba330
1 changed files with 5 additions and 1 deletions
|
|
@ -71,8 +71,10 @@ void swapchain_base::page_flip_thread()
|
|||
|
||||
/* We want to present the oldest queued for present image from our present queue,
|
||||
* which we can find at the sc->pending_buffer_pool.head index. */
|
||||
std::unique_lock<std::recursive_mutex> image_status_lock(m_image_status_mutex);
|
||||
auto pending_index = m_pending_buffer_pool.pop_front();
|
||||
assert(pending_index.has_value());
|
||||
image_status_lock.unlock();
|
||||
|
||||
/* We may need to wait for the payload of the present sync of the oldest pending image to be finished. */
|
||||
vk_res = image_wait_present(sc_images[*pending_index], timeout);
|
||||
|
|
@ -466,7 +468,9 @@ VkResult swapchain_base::queue_present(VkQueue queue, const VkPresentInfoKHR *pr
|
|||
}
|
||||
|
||||
m_swapchain_images[image_index].status = swapchain_image::PENDING;
|
||||
m_pending_buffer_pool.push_back(image_index);
|
||||
bool buffer_pool_res = m_pending_buffer_pool.push_back(image_index);
|
||||
(void)buffer_pool_res;
|
||||
assert(buffer_pool_res);
|
||||
m_page_flip_semaphore.post();
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue