From: Aaron Bartholomew Date: Mon, 20 Aug 2018 19:28:42 +0000 (-0700) Subject: Improve wsi.incremental_present.* for low memory X-Git-Tag: upstream/1.3.5~2324^2~20^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e931ee63bba8c5942eaa9db990d4b5542ddc208e;p=platform%2Fupstream%2FVK-GL-CTS.git Improve wsi.incremental_present.* for low memory This patch modifies the VK.wsi.incremental_present.* tests to alleviate issues with memory use on memory constrained platforms The issue is that the scale_down group in particular creates very large swapchains & that the presentation engine may keep one or moreof the swapchain images allocated until it is able to release them. Which means that since this test does the following: create swapchain, render some frames, destroy the swapchain, repeat the high watermark for memory consumed by swapchain images will be higher than the amount consumed by the single largest swapchain created. This patch addresses these issues in two ways: 1) Reducing the size of the swapchain images allocated for scale down tests to use the next power of two of the window size, instead of the max extents reported by Vulkan Max extents are already tested in other deqp tests & it's redundant to do evaluate it again here; this change will make the test more on functionality 2) Creates/Renders/Destroys a small dummy swapchain between each test iteration in order to flush the memory held by the presentation engine Affects: dEQP-VK.wsi.*.incremental_present.* Components: Vulkan VK-GL-CTS issue: 1179 Change-Id: Ib7e1a5d9110e7dabc0d0ced21b643389c2bf0328 (cherry picked from commit a3ba2368fda1ecf8cc3d5c3136b5674a3414f472) --- diff --git a/external/vulkancts/modules/vulkan/wsi/vktWsiIncrementalPresentTests.cpp b/external/vulkancts/modules/vulkan/wsi/vktWsiIncrementalPresentTests.cpp index e8a00cb..a32e5f5 100644 --- a/external/vulkancts/modules/vulkan/wsi/vktWsiIncrementalPresentTests.cpp +++ b/external/vulkancts/modules/vulkan/wsi/vktWsiIncrementalPresentTests.cpp @@ -971,21 +971,25 @@ std::vector generateSwapchainConfigs (vk::VkSurfac const vk::VkBool32 clipped = VK_FALSE; vector createInfos; + const deUint32 currentWidth = properties.currentExtent.width != 0xFFFFFFFFu + ? properties.currentExtent.width + : de::min(1024u, properties.minImageExtent.width + ((properties.maxImageExtent.width - properties.minImageExtent.width) / 2)); + const deUint32 currentHeight = properties.currentExtent.height != 0xFFFFFFFFu + ? properties.currentExtent.height + : de::min(1024u, properties.minImageExtent.height + ((properties.maxImageExtent.height - properties.minImageExtent.height) / 2)); + const deUint32 imageWidth = scaling == SCALING_NONE - ? (properties.currentExtent.width != 0xFFFFFFFFu - ? properties.currentExtent.width - : de::min(1024u, properties.minImageExtent.width + ((properties.maxImageExtent.width - properties.minImageExtent.width) / 2))) + ? currentWidth : (scaling == SCALING_UP ? de::max(31u, properties.minImageExtent.width) - : properties.maxImageExtent.width); + : de::min(deSmallestGreaterOrEquallPowerOfTwoU32(currentWidth+1), properties.maxImageExtent.width)); const deUint32 imageHeight = scaling == SCALING_NONE - ? (properties.currentExtent.height != 0xFFFFFFFFu - ? properties.currentExtent.height - : de::min(1024u, properties.minImageExtent.height + ((properties.maxImageExtent.height - properties.minImageExtent.height) / 2))) + ? currentHeight : (scaling == SCALING_UP ? de::max(31u, properties.minImageExtent.height) - : properties.maxImageExtent.height); + : de::min(deSmallestGreaterOrEquallPowerOfTwoU32(currentHeight+1), properties.maxImageExtent.height)); const vk::VkExtent2D imageSize = { imageWidth, imageHeight }; + const vk::VkExtent2D dummySize = { de::max(31u, properties.minImageExtent.width), de::max(31u, properties.minImageExtent.height) }; { size_t presentModeNdx; @@ -1039,6 +1043,31 @@ std::vector generateSwapchainConfigs (vk::VkSurfac }; createInfos.push_back(createInfo); + + // add an extra dummy swapchain + const vk::VkSwapchainCreateInfoKHR dummyInfo = + { + vk::VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, + DE_NULL, + 0u, + surface, + properties.minImageCount, + imageFormat, + imageColorSpace, + dummySize, + imageLayers, + imageUsage, + vk::VK_SHARING_MODE_EXCLUSIVE, + 1u, + &queueFamilyIndex, + preTransform, + compositeAlpha, + presentMode, + clipped, + (vk::VkSwapchainKHR)0 + }; + + createInfos.push_back(dummyInfo); } } }