Skip to content

vkr: Add support of GUEST_VRAM type of mem blob

Andrii Pauk requested to merge apauk/virglrenderer:guest-vram into master

This is dedicated heap memory allocations approach.

This type of blob should be used in the following way:

  1. Guest virtio-gpu driver on start checks for dedicated memory region.
  2. On create_blob drm ioctl guest driver reserves chunk of required memory and send it to host using sg list. Heap is managed on guest.
  3. Device creates dmabuf fd from this sg entry and sends it to virglrenderer on create_blob virtio-gpu command. Blob is created using virgl_renderer_resource_import_blob call.
  4. On next vkAllocateMemory call from mesa, virglrenderer will allocate vk memory handle from this dmabuf fd. It will receive resource id in VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA vkAllocateMemory structure.

The flow is opposite to the way it's done for HOST_3D types of blob, where vkAllocateMemory is called first, vk memory is allocated from random host place. Then create_blob is called, where dmabuf fd is exported from VkDeviceMemory.

Mesa MR mesa/mesa!14536 (merged)

Kernel virtio-gpu-next MR drm-misc-next!11

v2: Use virgl_renderer_resource_import_blob instead of virgl_renderer_resource_create_blob.

/cc @olv @gurchetansingh

Edited by Andrii Pauk

Merge request reports

Loading