Fix Android WSI shared presentable image test OOM
authorMike Byrne <mike.byrne@arm.com>
Mon, 24 Jun 2019 06:44:23 +0000 (07:44 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 4 Jul 2019 07:32:31 +0000 (03:32 -0400)
The dEQP-VK.wsi.android.shared_presentable_image.scale_down tests fail
intermittently with OOM errors. A simliar fix as implemented for
WSI incremental presentable image tests resolves this.

Affects: dEQP-VK.wsi.android.shared_presentable_image.scale_down.*

Components: Vulkan, AOSP

VK-GL-CTS Issue: 1858

Change-Id: Iee7a31560e46b6c449d14ec6e7c75d7406ae6d82

external/vulkancts/modules/vulkan/wsi/vktWsiSharedPresentableImageTests.cpp

index 545f094..352f308 100644 (file)
@@ -630,20 +630,23 @@ std::vector<vk::VkSwapchainCreateInfoKHR> generateSwapchainConfigs (vk::VkSurfac
        const vk::VkBool32                                              clipped                         = VK_FALSE;
        vector<vk::VkSwapchainCreateInfoKHR>    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 };
 
        {