From f86a754340b09117e1253395be675bea6cbdac2c Mon Sep 17 00:00:00 2001 From: Tom Cooper Date: Mon, 12 Feb 2018 16:20:58 +0000 Subject: [PATCH] Fix low memory in dedicated_alloc buffer tests Observe platform memory limits to avoid low memory conditions. Components: Vulkan VK-GL-CTS issue: 1008 Affects: dEQP-VK.api.buffer.dedicated_alloc.create_buffer_* Change-Id: Ib184b648126e8cb6e1acff533447a86be9a1a612 --- external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp index 024e826..256ec1e 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp @@ -565,11 +565,20 @@ tcu::TestStatus DedicatedAllocationBufferTestInstance::bufferCreateAndAllo const deUint32 heapTypeIndex = static_cast(deCtz32(memReqs.memoryRequirements.memoryTypeBits)); const VkMemoryType memoryType = memoryProperties.memoryTypes[heapTypeIndex]; const VkMemoryHeap memoryHeap = memoryProperties.memoryHeaps[memoryType.heapIndex]; - const VkDeviceSize maxBufferSize = deAlign64(memoryHeap.size >> 1u, memReqs.memoryRequirements.alignment); const deUint32 shrinkBits = 4u; // number of bits to shift when reducing the size with each iteration + // Buffer size - Choose half of the reported heap size for the maximum buffer size, we + // should attempt to test as large a portion as possible. + // + // However on a system where device memory is shared with the system, the maximum size + // should be tested against the platform memory limits as a significant portion of the heap + // may already be in use by the operating system and other running processes. + const VkDeviceSize maxBufferSize = getMaxBufferSize(memoryHeap.size, + memReqs.memoryRequirements.alignment, + getPlatformMemoryLimits(m_context)); + Move memory; - size = std::min(size, maxBufferSize); + size = deAlign64(std::min(size, maxBufferSize >> 1), memReqs.memoryRequirements.alignment); while (*memory == DE_NULL) { // Create the buffer -- 2.7.4