Limit protected swapchain images based on memory
authorJesse Hall <jessehall@google.com>
Wed, 16 May 2018 23:56:54 +0000 (16:56 -0700)
committerJesse Hall <jessehall@google.com>
Thu, 17 May 2018 05:36:21 +0000 (22:36 -0700)
commit2af2465cd272e315df2c7d4c2930a5b790add042
tree2bc7d3135c4702977392f5b052ae194efcc3b3eb
parent17eb70bae81e23ba21c33a7ce008b7754a130090
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

Bug: 77319653
Test: dEQP-VK.protected_memory.interaction.wsi.android.swapchain.create.min_image_count
Change-Id: I6cc3bd25f7f22de8424f9e3375ade35fac26a884
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWsiSwapchainTests.cpp