From e27ad2a0215f390aa11b0f6f027634b0ad39b8d1 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Sun, 13 Jul 2025 20:42:07 -0700 Subject: [PATCH] venus: drop force_unmappable hack No longer needed since the vkMapMemory would fail properly instead of failing the external memory import. Part-of: --- src/virtio/vulkan/vn_android.c | 13 ++----------- src/virtio/vulkan/vn_device_memory.c | 7 +++---- src/virtio/vulkan/vn_device_memory.h | 1 - 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/virtio/vulkan/vn_android.c b/src/virtio/vulkan/vn_android.c index b8aaa4ff862..f4062d2e547 100644 --- a/src/virtio/vulkan/vn_android.c +++ b/src/virtio/vulkan/vn_android.c @@ -778,7 +778,6 @@ vn_android_device_import_ahb( uint64_t alloc_size = 0; uint32_t mem_type_bits = 0; uint32_t mem_type_index = mem_vk->memory_type_index; - bool force_unmappable = false; VkResult result = VK_SUCCESS; handle = AHardwareBuffer_getNativeHandle(mem_vk->ahardware_buffer); @@ -837,14 +836,6 @@ vn_android_device_import_ahb( mem_type_index = ffs(mem_type_bits & mem_req->memoryTypeBits) - 1; } - - /* XXX Workaround before we use cross-domain backend in minigbm, since - * venus doesn't support transfer blit for classic 3d resources. - * - * For AHB image, we can allow r8 storage image support, since that's - * always allocated with blob mem. - */ - force_unmappable = img->base.vk.format != VK_FORMAT_R8_UNORM; } if (dedicated_info && dedicated_info->buffer != VK_NULL_HANDLE) { @@ -888,8 +879,8 @@ vn_android_device_import_ahb( .allocationSize = alloc_size, .memoryTypeIndex = mem_type_index, }; - result = vn_device_memory_import_dma_buf(dev, mem, &local_alloc_info, - force_unmappable, dup_fd); + result = + vn_device_memory_import_dma_buf(dev, mem, &local_alloc_info, dup_fd); if (result != VK_SUCCESS) { close(dup_fd); return result; diff --git a/src/virtio/vulkan/vn_device_memory.c b/src/virtio/vulkan/vn_device_memory.c index 19b4a91219f..2225c04a63a 100644 --- a/src/virtio/vulkan/vn_device_memory.c +++ b/src/virtio/vulkan/vn_device_memory.c @@ -110,7 +110,6 @@ VkResult vn_device_memory_import_dma_buf(struct vn_device *dev, struct vn_device_memory *mem, const VkMemoryAllocateInfo *alloc_info, - bool force_unmappable, int fd) { const VkMemoryType *mem_type = @@ -119,8 +118,8 @@ vn_device_memory_import_dma_buf(struct vn_device *dev, struct vn_renderer_bo *bo; VkResult result = vn_renderer_bo_create_from_dma_buf( - dev->renderer, alloc_info->allocationSize, fd, - force_unmappable ? 0 : mem_type->propertyFlags, &bo); + dev->renderer, alloc_info->allocationSize, fd, mem_type->propertyFlags, + &bo); if (result != VK_SUCCESS) return result; @@ -387,7 +386,7 @@ vn_AllocateMemory(VkDevice device, if (mem->base.vk.ahardware_buffer) { result = vn_android_device_import_ahb(dev, mem, dedicated_info); } else if (import_fd_info) { - result = vn_device_memory_import_dma_buf(dev, mem, pAllocateInfo, false, + result = vn_device_memory_import_dma_buf(dev, mem, pAllocateInfo, import_fd_info->fd); } else { result = vn_device_memory_alloc(dev, mem, pAllocateInfo); diff --git a/src/virtio/vulkan/vn_device_memory.h b/src/virtio/vulkan/vn_device_memory.h index 0a3ee76e800..89cfcc5a566 100644 --- a/src/virtio/vulkan/vn_device_memory.h +++ b/src/virtio/vulkan/vn_device_memory.h @@ -58,7 +58,6 @@ VkResult vn_device_memory_import_dma_buf(struct vn_device *dev, struct vn_device_memory *mem, const VkMemoryAllocateInfo *alloc_info, - bool force_unmappable, int fd); VkResult