Module: Mesa Branch: main Commit: d1009481c8c4c73aa85c35fd3796c618c5c5c326 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1009481c8c4c73aa85c35fd3796c618c5c5c326
Author: Andrew Gazizov <andrew.gazi...@opensynergy.com> Date: Thu Sep 28 09:53:52 2023 +0200 venus: Add use_guest_vram capset to enable guest-based blob alloc For hypervisors that do not support host memory injection into the guest address space, it's necessary to have guest-based blob alloc. Therefore, use a new 'use_guest_vram' virgl capset to decide on performing guest blob allocations from dedicated heap (Host visible memory). 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/25889> --- src/virtio/virtio-gpu/venus_hw.h | 6 ++++++ src/virtio/vulkan/vn_renderer_virtgpu.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/virtio/virtio-gpu/venus_hw.h b/src/virtio/virtio-gpu/venus_hw.h index 18bd1964002..66b1007597d 100644 --- a/src/virtio/virtio-gpu/venus_hw.h +++ b/src/virtio/virtio-gpu/venus_hw.h @@ -64,6 +64,12 @@ struct virgl_renderer_capset_venus { * the associated renderer submission. */ uint32_t supports_multiple_timelines; + + /* This flag indicates to the guest that hypervisor does not support memory + * pages injections and blob allocations must be done by guest from the + * dedicated heap (Host visible memory). + */ + uint32_t use_guest_vram; }; #endif diff --git a/src/virtio/vulkan/vn_renderer_virtgpu.c b/src/virtio/vulkan/vn_renderer_virtgpu.c index 8c26d86f43e..57be16888b1 100644 --- a/src/virtio/vulkan/vn_renderer_virtgpu.c +++ b/src/virtio/vulkan/vn_renderer_virtgpu.c @@ -1396,6 +1396,10 @@ virtgpu_init_renderer_info(struct virtgpu *gpu) if (gpu->bo_blob_mem == VIRTGPU_BLOB_MEM_GUEST_VRAM) info->has_guest_vram = true; + + /* Use guest blob allocations from dedicated heap (Host visible memory) */ + if (gpu->bo_blob_mem == VIRTGPU_BLOB_MEM_HOST3D && capset->use_guest_vram) + info->has_guest_vram = true; } static void