Allow two images worth of alignment slop in protected heap
authorChris Forbes <chrisforbes@google.com>
Mon, 11 Jun 2018 22:50:16 +0000 (15:50 -0700)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 13 Jul 2018 10:41:42 +0000 (06:41 -0400)
We previously backed off by one image worth, but it's not enough in some
cases.

Components: Vulkan
VK-GL-CTS: 1262
Bug: b/109757443
Test: dEQP-VK.protected_memory.interaction.wsi.android.swapchain.create#min_image_count
Change-Id: I01b3a72986e9f35b4ec15a146e4dc576758c02ce
(cherry picked from Android commit 0fd6d1afa4d00ffd3da1d2d1898f32d4e879209d)

external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWsiSwapchainTests.cpp

index 229ad73..7a2c1d0 100644 (file)
@@ -291,10 +291,10 @@ std::vector<vk::VkSwapchainCreateInfoKHR> generateSwapchainParameterCases (vk::w
                        }
 
                        // If the implementation doesn't have a max image count, min+16 means we won't clamp.
-                       // Limit it to how many protected images we estimate can be allocated, with one image
+                       // Limit it to how many protected images we estimate can be allocated, with two images
                        // worth of slack for alignment, swapchain-specific constraints, etc.
                        const deUint32  maxImageCount           = de::min((capabilities.maxImageCount > 0) ? capabilities.maxImageCount : capabilities.minImageCount + 16u,
-                                                                                                                 deUint32(protectedHeapSize / memoryRequirements.size) - 1);
+                                                                                                                 deUint32(protectedHeapSize / memoryRequirements.size) - 2);
                        const deUint32  maxImageCountToTest     = de::clamp(16u, capabilities.minImageCount, maxImageCount);
                        for (deUint32 imageCount = capabilities.minImageCount; imageCount <= maxImageCountToTest; ++imageCount)
                        {