From a85f4ea720bdbb6d2f969213f06850e93e0fea7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C5=82awomir=20Cygan?= Date: Mon, 15 Feb 2021 15:35:21 +0100 Subject: [PATCH] Do not use image index and semaphore when vkAcquireNextImageKHR fails This change follows d9763f6a0, where vkAcquireNextImageKHR was allowed to fail with VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT error. However, the (not) acquired image index and semaphore was still used, causing fauilure when validating the index. This change skips using the image index and semaphore, when image was not acquired. Moreover, failure to acquire the image is logged as quality warning. VK-GL-CTS Issue: 2792 Affects: dEQP-VK.wsi.*.full_screen_exclusive.* Components: Vulkan Change-Id: I7c970289769fd56c9f46ac27cc6d23180e847d74 --- .../vulkan/wsi/vktWsiFullScreenExclusiveTests.cpp | 49 +++++++++++++++++----- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/external/vulkancts/modules/vulkan/wsi/vktWsiFullScreenExclusiveTests.cpp b/external/vulkancts/modules/vulkan/wsi/vktWsiFullScreenExclusiveTests.cpp index 069d2b4..0f5f4c1 100644 --- a/external/vulkancts/modules/vulkan/wsi/vktWsiFullScreenExclusiveTests.cpp +++ b/external/vulkancts/modules/vulkan/wsi/vktWsiFullScreenExclusiveTests.cpp @@ -474,6 +474,8 @@ tcu::TestStatus fullScreenExclusiveTest(Context& context, bool fullScreenAcquired = (testParams.fseType != VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT); + bool fullScreenLost = false; + try { const deUint32 numFramesToRender = 60; @@ -517,21 +519,28 @@ tcu::TestStatus fullScreenExclusiveTest(Context& context, VK_CHECK(vkd.resetFences(device, 1, &imageReadyFence)); + VkResult acquireResult; + { - const VkResult acquireResult = vkd.acquireNextImageKHR(device, - *swapchain, - std::numeric_limits::max(), - imageReadySemaphore, - (vk::VkFence)0, - &imageNdx); + acquireResult = vkd.acquireNextImageKHR(device, + *swapchain, + std::numeric_limits::max(), + imageReadySemaphore, + (vk::VkFence)0, + &imageNdx); if (acquireResult == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT) + { context.getTestContext().getLog() << tcu::TestLog::Message << "Got VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT at vkAcquireNextImageKHR" << tcu::TestLog::EndMessage; + + fullScreenLost = true; + } VK_CHECK_WSI(acquireResult); } - TCU_CHECK((size_t)imageNdx < swapchainImages.size()); - + if (acquireResult != VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT) { + TCU_CHECK((size_t)imageNdx < swapchainImages.size()); + const VkSemaphore renderingCompleteSemaphore = **renderingCompleteSemaphores[frameNdx%renderingCompleteSemaphores.size()]; const VkCommandBuffer commandBuffer = **commandBuffers[frameNdx%commandBuffers.size()]; const VkPipelineStageFlags waitDstStage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; @@ -563,9 +572,18 @@ tcu::TestStatus fullScreenExclusiveTest(Context& context, VK_CHECK(vkd.queueSubmit(devHelper.queue, 1u, &submitInfo, imageReadyFence)); const VkResult presentResult = vkd.queuePresentKHR(devHelper.queue, &presentInfo); if (presentResult == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT) + { context.getTestContext().getLog() << tcu::TestLog::Message << "Got VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT at vkQueuePresentKHR" << tcu::TestLog::EndMessage; + + fullScreenLost = true; + } VK_CHECK_WSI(presentResult); } + else + { + // image was not acquired, just roll the synchronization + VK_CHECK(vkd.queueSubmit(devHelper.queue, 0u, DE_NULL, imageReadyFence)); + } } VK_CHECK(vkd.deviceWaitIdle(device)); @@ -581,19 +599,30 @@ tcu::TestStatus fullScreenExclusiveTest(Context& context, { const VkResult releaseResult = vkd.releaseFullScreenExclusiveModeEXT(device, *swapchain); if (releaseResult == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT) + { context.getTestContext().getLog() << tcu::TestLog::Message << "Got VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT at vkReleaseFullScreenExclusiveModeEXT" << tcu::TestLog::EndMessage; + + fullScreenLost = true; + } VK_CHECK_WSI(releaseResult); } native.window->setVisible(false); - if (fullScreenAcquired) + if (fullScreenAcquired && !fullScreenLost) { return tcu::TestStatus::pass("Rendering tests succeeded"); } else { - return tcu::TestStatus(QP_TEST_RESULT_QUALITY_WARNING, "Failed to acquire full screen exclusive, but did not end with an error."); + if (fullScreenLost) + { + return tcu::TestStatus(QP_TEST_RESULT_QUALITY_WARNING, "Full screen exclusive was lost during test, but did not end with an error."); + } + else + { + return tcu::TestStatus(QP_TEST_RESULT_QUALITY_WARNING, "Failed to acquire full screen exclusive, but did not end with an error."); + } } } -- 2.7.4