mirror of https://gitlab.freedesktop.org/mesa/mesa
wsi: Add acquired member to wsi_image
Tracks whether this wsi_image has been acquired by the app Signed-off-by: Joshua Ashton <joshua@froggi.es> Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no> Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com> Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
This commit is contained in:
parent
a50ce3df71
commit
7467f29af1
|
@ -1049,6 +1049,15 @@ wsi_ReleaseSwapchainImagesEXT(VkDevice _device,
|
|||
const VkReleaseSwapchainImagesInfoEXT *pReleaseInfo)
|
||||
{
|
||||
VK_FROM_HANDLE(wsi_swapchain, swapchain, pReleaseInfo->swapchain);
|
||||
|
||||
for (uint32_t i = 0; i < pReleaseInfo->imageIndexCount; i++) {
|
||||
uint32_t index = pReleaseInfo->pImageIndices[i];
|
||||
assert(index < swapchain->image_count);
|
||||
struct wsi_image *image = swapchain->get_wsi_image(swapchain, index);
|
||||
assert(image->acquired);
|
||||
image->acquired = false;
|
||||
}
|
||||
|
||||
VkResult result = swapchain->release_images(swapchain,
|
||||
pReleaseInfo->imageIndexCount,
|
||||
pReleaseInfo->pImageIndices);
|
||||
|
@ -1208,6 +1217,8 @@ wsi_common_acquire_next_image2(const struct wsi_device *wsi,
|
|||
struct wsi_image *image =
|
||||
swapchain->get_wsi_image(swapchain, *pImageIndex);
|
||||
|
||||
image->acquired = true;
|
||||
|
||||
if (pAcquireInfo->semaphore != VK_NULL_HANDLE) {
|
||||
VkResult signal_result =
|
||||
wsi_signal_semaphore_for_image(device, swapchain, image,
|
||||
|
@ -1458,6 +1469,10 @@ wsi_common_queue_present(const struct wsi_device *wsi,
|
|||
if (result != VK_SUCCESS)
|
||||
goto fail_present;
|
||||
|
||||
/* The app can only submit images they have acquired. */
|
||||
assert(image->acquired);
|
||||
image->acquired = false;
|
||||
|
||||
#ifdef HAVE_LIBDRM
|
||||
if (has_signal_dma_buf) {
|
||||
result = wsi_signal_dma_buf_from_semaphore(swapchain, image);
|
||||
|
|
|
@ -130,6 +130,10 @@ struct wsi_image {
|
|||
VkDeviceMemory memory;
|
||||
VkCommandBuffer *cmd_buffers;
|
||||
} blit;
|
||||
/* Whether or not the image has been acquired
|
||||
* on the CPU side via acquire_next_image.
|
||||
*/
|
||||
bool acquired;
|
||||
|
||||
#ifndef _WIN32
|
||||
uint64_t drm_modifier;
|
||||
|
|
|
@ -1666,7 +1666,6 @@ wsi_wl_swapchain_release_images(struct wsi_swapchain *wsi_chain,
|
|||
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
uint32_t index = indices[i];
|
||||
assert(chain->images[index].busy);
|
||||
chain->images[index].busy = false;
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
|
|
Loading…
Reference in New Issue