Module: Mesa
Branch: main
Commit: 816f66cdfda8467fb22f74fcc280029c46657b9c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=816f66cdfda8467fb22f74fcc280029c46657b9c

Author: Andrew Gazizov <andrew.gazi...@opensynergy.com>
Date:   Wed Nov  1 15:44:31 2023 +0100

venus: Use vk_object_id as blob_id for guest_vram device memory alloc

blob_id == 0 does not refer to an existing VkDeviceMemory and implies
a shmem allocation. So for guest_vram device memory allocations, 0 is
not a valid blob id and must be greater than 0.

Therefore, set vk_object_id as blob_id for guest_vram device memory
allocations. Considering that vk_object_id made from valid pointer, it
will be always greater than 0.

Signed-off-by: Andrew D. Gazizov <andrew.gazi...@opensynergy.com>
Reviewed-by: Yiwei Zhang <zzyi...@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26130>

---

 src/virtio/vulkan/vn_device_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/virtio/vulkan/vn_device_memory.c 
b/src/virtio/vulkan/vn_device_memory.c
index c762aedb962..6b363542e62 100644
--- a/src/virtio/vulkan/vn_device_memory.c
+++ b/src/virtio/vulkan/vn_device_memory.c
@@ -348,7 +348,7 @@ vn_device_memory_alloc_guest_vram(struct vn_device *dev,
                                       .memoryTypes[mem_vk->memory_type_index];
 
    VkResult result = vn_renderer_bo_create_from_device_memory(
-      dev->renderer, mem_vk->size, 0, mem_type->propertyFlags,
+      dev->renderer, mem_vk->size, mem->base.id, mem_type->propertyFlags,
       mem_vk->export_handle_types, &mem->base_bo);
    if (result != VK_SUCCESS) {
       return result;

Reply via email to