From: Alex Walters Date: Tue, 11 Jun 2019 15:42:33 +0000 (+0100) Subject: Fix image_extent test to handle OOM errors X-Git-Tag: upstream/1.3.5~2002^2~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7c82722f91037f2eb92d99996fb90692c57e503;p=platform%2Fupstream%2FVK-GL-CTS.git Fix image_extent test to handle OOM errors The image_extent tests attempt to create a window with the maximum supported extents, though it is not always possible to create such a window due to platform memory constraints. As long as the error was an out of memory error, allow the test to pass. This fix only applies to the image_extent sub-test. Affects: dEQP-VK.wsi.*.swapchain.create.image_extent Components: Vulkan VK-GL-CTS issue: 1780 Change-Id: I5ac5439417424d101f6dc8d4f92da79b8fda2313 --- diff --git a/external/vulkancts/modules/vulkan/wsi/vktWsiSwapchainTests.cpp b/external/vulkancts/modules/vulkan/wsi/vktWsiSwapchainTests.cpp index b9359c9..f8e6ab6 100644 --- a/external/vulkancts/modules/vulkan/wsi/vktWsiSwapchainTests.cpp +++ b/external/vulkancts/modules/vulkan/wsi/vktWsiSwapchainTests.cpp @@ -574,6 +574,7 @@ tcu::TestStatus createSwapchainTest (Context& context, TestParameters params) const Unique surface (createSurface(instHelper.vki, *instHelper.instance, params.wsiType, *native.display, *native.window)); const DeviceHelper devHelper (context, instHelper.vki, *instHelper.instance, *surface); const vector cases (generateSwapchainParameterCases(params.wsiType, params.dimension, instHelper.vki, devHelper.physicalDevice, *surface)); + const VkSurfaceCapabilitiesKHR capabilities(getPhysicalDeviceSurfaceCapabilities(instHelper.vki, devHelper.physicalDevice, *surface)); for (size_t caseNdx = 0; caseNdx < cases.size(); ++caseNdx) { @@ -608,10 +609,32 @@ tcu::TestStatus createSwapchainTest (Context& context, TestParameters params) switch (propertiesResult) { case VK_SUCCESS: { - const Unique swapchain (createSwapchainKHR(devHelper.vkd, *devHelper.device, &curParams)); + // The maxExtents case might not be able to create the requested surface due to insufficient + // memory, so in this case *only* we handle the OOM exception. + if (params.dimension == TEST_DIMENSION_IMAGE_EXTENT && + capabilities.maxImageExtent.width == curParams.imageExtent.width && + capabilities.maxImageExtent.height == curParams.imageExtent.height) + { + try + { + const Unique swapchain (createSwapchainKHR(devHelper.vkd, *devHelper.device, &curParams)); + + log << TestLog::Message << subcase.str() + << "Creating swapchain succeeded" << TestLog::EndMessage; + } + catch (const OutOfMemoryError& e) + { + log << TestLog::Message << subcase.str() << "vkCreateSwapchainKHR with maxImageExtent encountered " << e.getError() << TestLog::EndMessage; + } + } + else + { + const Unique swapchain (createSwapchainKHR(devHelper.vkd, *devHelper.device, &curParams)); + + log << TestLog::Message << subcase.str() + << "Creating swapchain succeeded" << TestLog::EndMessage; + } } - log << TestLog::Message << subcase.str() - << "Creating swapchain succeeeded" << TestLog::EndMessage; break; case VK_ERROR_FORMAT_NOT_SUPPORTED: log << TestLog::Message << subcase.str()