Limit protected swapchain images based on memory
authorJesse Hall <jessehall@google.com>
Wed, 16 May 2018 23:56:54 +0000 (16:56 -0700)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 18 May 2018 10:37:41 +0000 (06:37 -0400)
commit0379a8dff683e488bc6d2aa8988bf9c95b3e9caa
treefb993e1cf54a60ec3b346d86d5a424e0e0630046
parent7db104e6fa3ca82e014684854442c0ba6b58de2f
Limit protected swapchain images based on memory

A surface's maxImageCount isn't based on the swapchain image extents
or format, so it's valid for swapchain creation to fail for
out-of-memory reasons even when the image count is within the
supported range.

This is particularly problematic for protected swapchains, since many
implementations have a limit on the total amount of protected memory
that can be allocated which is much smaller than total device memory.

This change estimates how much memory is used by protected swapchain
images, compares that to the size of heaps that support protected
memory types, and doesn't try to create swapchains that would have
more images than would fit within that size.

Components: Vulkan

VK-GL-CTS Issue: 1167

Affects:
    dEQP-VK.protected_memory.interaction.wsi.*.swapchain.create.min_image_count

Change-Id: I6cc3bd25f7f22de8424f9e3375ade35fac26a884
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWsiSwapchainTests.cpp