vulkan/wsi: fix select_memory_type when all MTs are local
The intention is to pick the system memory for the prime blit dst, but
that is not possible when all memory types are advertised to be local.
This fixes venus over vtest (i.e., unix socket) because the driver
provides no PCI bus info and wsi_device_matches_drm_fd returns false. A
driver might also use can_present_on_device to force prime blit.
Fixes: 469875596a
("vulkan/wsi: Fix prime blits to use system memory for the destination")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11774>
This commit is contained in:
parent
266d3d5814
commit
a8173a78a3
|
@ -68,12 +68,22 @@ select_memory_type(const struct wsi_device *wsi,
|
|||
bool want_device_local,
|
||||
uint32_t type_bits)
|
||||
{
|
||||
assert(type_bits);
|
||||
|
||||
bool all_local = true;
|
||||
for (uint32_t i = 0; i < wsi->memory_props.memoryTypeCount; i++) {
|
||||
const VkMemoryType type = wsi->memory_props.memoryTypes[i];
|
||||
bool local = type.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
||||
|
||||
if ((type_bits & (1 << i)) && local == want_device_local)
|
||||
return i;
|
||||
all_local &= local;
|
||||
}
|
||||
|
||||
/* ignore want_device_local when all memory types are device-local */
|
||||
if (all_local) {
|
||||
assert(!want_device_local);
|
||||
return ffs(type_bits) - 1;
|
||||
}
|
||||
|
||||
unreachable("No memory type found");
|
||||
|
|
Loading…
Reference in New Issue