summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_wsi.c
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2017-11-01 09:26:48 +0100
committerBas Nieuwenhuizen <[email protected]>2017-11-02 20:28:19 +0100
commit806721429afa090380bf39a4958fe4e21c63816c (patch)
tree7c8a1adcfc3212f396e76baa2d789c4df7069846 /src/amd/vulkan/radv_wsi.c
parenta29869e8720b385d3692f6a74de2921412b2c8c1 (diff)
radv: Don't expose heaps with 0 memory.
It confuses CTS. This pregenerates the heap info into the physical device, so we can use it for translating contiguous indices into our "standard" ones. This also makes the WSI a bit smarter in case the first preferred heap does not exist. Reviewed-by: Dave Airlie <[email protected]> CC: <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_wsi.c')
-rw-r--r--src/amd/vulkan/radv_wsi.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index b65ef27351d..e07c5028c5b 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -194,12 +194,26 @@ radv_wsi_image_create(VkDevice device_h,
.image = image_h
};
+ /* Find the first VRAM memory type, or GART for PRIME images. */
+ int memory_type_index = -1;
+ for (int i = 0; i < device->physical_device->memory_properties.memoryTypeCount; ++i) {
+ bool is_local = !!(device->physical_device->memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
+ if ((linear && !is_local) || (!linear && is_local)) {
+ memory_type_index = i;
+ break;
+ }
+ }
+
+ /* fallback */
+ if (memory_type_index == -1)
+ memory_type_index = 0;
+
result = radv_alloc_memory(device_h,
&(VkMemoryAllocateInfo) {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.pNext = &ded_alloc,
.allocationSize = image->size,
- .memoryTypeIndex = linear ? 1 : 0,
+ .memoryTypeIndex = memory_type_index,
},
NULL /* XXX: pAllocator */,
RADV_MEM_IMPLICIT_SYNC,