wsi/common: Add function to modify present mode.

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/20235>
This commit is contained in:
Hans-Kristian Arntzen 2022-11-30 17:17:39 +01:00 committed by Marge Bot
parent d79fa8a03a
commit ad71d584cf
2 changed files with 8 additions and 0 deletions

View file

@ -1232,12 +1232,18 @@ wsi_common_queue_present(const struct wsi_device *wsi,
vk_find_struct_const(pPresentInfo->pNext, PRESENT_ID_KHR);
const VkSwapchainPresentFenceInfoEXT *present_fence_info =
vk_find_struct_const(pPresentInfo->pNext, SWAPCHAIN_PRESENT_FENCE_INFO_EXT);
const VkSwapchainPresentModeInfoEXT *present_mode_info =
vk_find_struct_const(pPresentInfo->pNext, SWAPCHAIN_PRESENT_MODE_INFO_EXT);
for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
VK_FROM_HANDLE(wsi_swapchain, swapchain, pPresentInfo->pSwapchains[i]);
uint32_t image_index = pPresentInfo->pImageIndices[i];
VkResult result;
/* Update the present mode for this present and any subsequent present. */
if (present_mode_info && present_mode_info->pPresentModes && swapchain->set_present_mode)
swapchain->set_present_mode(swapchain, present_mode_info->pPresentModes[i]);
if (swapchain->fences[image_index] == VK_NULL_HANDLE) {
const VkFenceCreateInfo fence_info = {
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,

View file

@ -191,6 +191,8 @@ struct wsi_swapchain {
VkResult (*release_images)(struct wsi_swapchain *swap_chain,
uint32_t count,
const uint32_t *indices);
void (*set_present_mode)(struct wsi_swapchain *swap_chain,
VkPresentModeKHR mode);
};
bool