vulkan/wsi: Add stub interface for VK_KHR_present_wait

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19279>
This commit is contained in:
Daniel Stone
2022-05-11 19:13:48 +01:00
committed by Marge Bot
parent 11f91505d9
commit 0aba2c604e
6 changed files with 26 additions and 3 deletions

View File

@@ -1080,6 +1080,8 @@ wsi_common_queue_present(const struct wsi_device *wsi,
const VkPresentRegionsKHR *regions =
vk_find_struct_const(pPresentInfo->pNext, PRESENT_REGIONS_KHR);
const VkPresentIdKHR *present_ids =
vk_find_struct_const(pPresentInfo->pNext, PRESENT_ID_KHR);
for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
VK_FROM_HANDLE(wsi_swapchain, swapchain, pPresentInfo->pSwapchains[i]);
@@ -1227,7 +1229,11 @@ wsi_common_queue_present(const struct wsi_device *wsi,
if (regions && regions->pRegions)
region = &regions->pRegions[i];
result = swapchain->queue_present(swapchain, image_index, region);
uint64_t present_id = 0;
if (present_ids && present_ids->pPresentIds)
present_id = present_ids->pPresentIds[i];
result = swapchain->queue_present(swapchain, image_index, present_id, region);
if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR)
goto fail_present;
@@ -1789,3 +1795,12 @@ wsi_configure_cpu_image(const struct wsi_swapchain *chain,
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL
wsi_WaitForPresentKHR(VkDevice device, VkSwapchainKHR _swapchain,
uint64_t presentId, uint64_t timeout)
{
VK_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
assert(swapchain->wait_for_present);
return swapchain->wait_for_present(swapchain, presentId, timeout);
}

View File

@@ -1910,6 +1910,7 @@ _wsi_display_queue_next(struct wsi_swapchain *drv_chain)
static VkResult
wsi_display_queue_present(struct wsi_swapchain *drv_chain,
uint32_t image_index,
uint64_t present_id,
const VkPresentRegionKHR *damage)
{
struct wsi_display_swapchain *chain =

View File

@@ -162,7 +162,11 @@ struct wsi_swapchain {
uint32_t *image_index);
VkResult (*queue_present)(struct wsi_swapchain *swap_chain,
uint32_t image_index,
uint64_t present_id,
const VkPresentRegionKHR *damage);
VkResult (*wait_for_present)(struct wsi_swapchain *swap_chain,
uint64_t present_id,
uint64_t timeout);
};
bool

View File

@@ -1545,6 +1545,7 @@ static const struct wl_callback_listener frame_listener = {
static VkResult
wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain,
uint32_t image_index,
uint64_t present_id,
const VkPresentRegionKHR *damage)
{
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;

View File

@@ -400,8 +400,9 @@ wsi_win32_acquire_next_image(struct wsi_swapchain *drv_chain,
static VkResult
wsi_win32_queue_present(struct wsi_swapchain *drv_chain,
uint32_t image_index,
const VkPresentRegionKHR *damage)
uint32_t image_index,
uint64_t present_id,
const VkPresentRegionKHR *damage)
{
struct wsi_win32_swapchain *chain = (struct wsi_win32_swapchain *) drv_chain;
assert(image_index < chain->base.image_count);

View File

@@ -1426,6 +1426,7 @@ x11_acquire_next_image(struct wsi_swapchain *anv_chain,
static VkResult
x11_queue_present(struct wsi_swapchain *anv_chain,
uint32_t image_index,
uint64_t present_id,
const VkPresentRegionKHR *damage)
{
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;