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.gazizov@opensynergy.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25889>
This commit is contained in:
Andrew Gazizov 2023-09-28 09:53:52 +02:00 committed by Marge Bot
parent f71f5cf856
commit d1009481c8
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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