From 73f6bff07f1f3a5aa31e906cd69eeef58d95104c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 9 Jul 2021 10:17:48 -0400 Subject: [PATCH] zink: fix mem info query to be more permissive airlied was right, this was way too conservative Fixes: ff4ba3d4a77 ("zink: support PIPE_CAP_QUERY_MEMORY_INFO") Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_screen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index f0796a66fbe..8d45decd194 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -1625,11 +1625,11 @@ zink_query_memory_info(struct pipe_screen *pscreen, struct pipe_memory_info *inf screen->vk.GetPhysicalDeviceMemoryProperties2(screen->pdev, &mem); for (unsigned i = 0; i < mem.memoryProperties.memoryHeapCount; i++) { - if (mem.memoryProperties.memoryHeaps[i].flags == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) { + if (mem.memoryProperties.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) { /* VRAM */ info->total_device_memory = mem.memoryProperties.memoryHeaps[i].size / 1024; info->avail_device_memory = (budget.heapBudget[i] - budget.heapUsage[i]) / 1024; - } else if (mem.memoryProperties.memoryHeaps[i].flags == (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) { + } else if (mem.memoryProperties.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { /* GART */ info->total_staging_memory = mem.memoryProperties.memoryHeaps[i].size / 1024; info->avail_staging_memory = (budget.heapBudget[i] - budget.heapUsage[i]) / 1024; @@ -1638,12 +1638,12 @@ zink_query_memory_info(struct pipe_screen *pscreen, struct pipe_memory_info *inf /* evictions not yet supported in vulkan */ } else { for (unsigned i = 0; i < screen->info.mem_props.memoryHeapCount; i++) { - if (screen->info.mem_props.memoryHeaps[i].flags == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) { + if (screen->info.mem_props.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) { /* VRAM */ info->total_device_memory = screen->info.mem_props.memoryHeaps[i].size / 1024; /* free real estate! */ info->avail_device_memory = info->total_device_memory; - } else if (screen->info.mem_props.memoryHeaps[i].flags == (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) { + } else if (screen->info.mem_props.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { /* GART */ info->total_staging_memory = screen->info.mem_props.memoryHeaps[i].size / 1024; /* free real estate! */