From 436a0d2609426c32ed708290bfa7b43a3de3dedd Mon Sep 17 00:00:00 2001 From: Lina Versace Date: Thu, 23 Mar 2023 13:57:07 -0700 Subject: [PATCH] venus: Delete vn_renderer_info::has_cache_management It has been false since commit 247232d59692, when Venus was merged upstream in April 2021. Signed-off-by: Lina Versace Reviewed-by: Yiwei Zhang Reviewed-by: Ryan Neph Part-of: --- src/virtio/vulkan/vn_physical_device.c | 26 +++++++++++++------------ src/virtio/vulkan/vn_renderer.h | 1 - src/virtio/vulkan/vn_renderer_virtgpu.c | 4 ---- src/virtio/vulkan/vn_renderer_vtest.c | 1 - 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index ad9858e9f8d..0acdaf0bcc5 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -778,19 +778,21 @@ vn_physical_device_init_memory_properties( instance, vn_physical_device_to_handle(physical_dev), &physical_dev->memory_properties); - if (!instance->renderer->info.has_cache_management) { - VkPhysicalDeviceMemoryProperties *props = - &physical_dev->memory_properties.memoryProperties; - const uint32_t host_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | - VK_MEMORY_PROPERTY_HOST_CACHED_BIT; + VkPhysicalDeviceMemoryProperties *props = + &physical_dev->memory_properties.memoryProperties; + const uint32_t host_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | + VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | + VK_MEMORY_PROPERTY_HOST_CACHED_BIT; - for (uint32_t i = 0; i < props->memoryTypeCount; i++) { - const bool coherent = props->memoryTypes[i].propertyFlags & - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; - if (!coherent) - props->memoryTypes[i].propertyFlags &= ~host_flags; - } + for (uint32_t i = 0; i < props->memoryTypeCount; i++) { + /* Kernel makes every mapping coherent. If a memory type is truly + * incoherent, it's better to remove the host-visible flag than silently + * making it coherent. + */ + const bool coherent = props->memoryTypes[i].propertyFlags & + VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; + if (!coherent) + props->memoryTypes[i].propertyFlags &= ~host_flags; } } diff --git a/src/virtio/vulkan/vn_renderer.h b/src/virtio/vulkan/vn_renderer.h index b5804838132..63ec3a2748e 100644 --- a/src/virtio/vulkan/vn_renderer.h +++ b/src/virtio/vulkan/vn_renderer.h @@ -62,7 +62,6 @@ struct vn_renderer_info { } pci; bool has_dma_buf_import; - bool has_cache_management; bool has_external_sync; bool has_implicit_fencing; bool has_guest_vram; diff --git a/src/virtio/vulkan/vn_renderer_virtgpu.c b/src/virtio/vulkan/vn_renderer_virtgpu.c index d836f5300e8..3736b925931 100644 --- a/src/virtio/vulkan/vn_renderer_virtgpu.c +++ b/src/virtio/vulkan/vn_renderer_virtgpu.c @@ -1375,10 +1375,6 @@ virtgpu_init_renderer_info(struct virtgpu *gpu) } info->has_dma_buf_import = true; - /* Kernel makes every mapping coherent. We are better off filtering - * incoherent memory types out than silently making them coherent. - */ - info->has_cache_management = false; /* TODO drm_syncobj */ info->has_external_sync = false; diff --git a/src/virtio/vulkan/vn_renderer_vtest.c b/src/virtio/vulkan/vn_renderer_vtest.c index 7203cc923b8..69ed024d486 100644 --- a/src/virtio/vulkan/vn_renderer_vtest.c +++ b/src/virtio/vulkan/vn_renderer_vtest.c @@ -938,7 +938,6 @@ vtest_init_renderer_info(struct vtest *vtest) info->pci.device_id = VTEST_PCI_DEVICE_ID; info->has_dma_buf_import = false; - info->has_cache_management = false; info->has_external_sync = false; info->has_implicit_fencing = false;