Skip to content

venus: Prefer OPAQUE_FD for exported device memory

These changes are part of changes to both virglrenderer and crosvm to support using Vulkan OPAQUE_FD as the backing memory for blob resources. This is to help address issues with drivers that don't support dmabuf import/export or cannot properly map memory marked for dmabuf import/export like described in #524.

These changes modify vkAllocateMemory to prefer VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT if DMABUF is not specifically requested and also ensure memory size is 4K aligned to match the 4K size alignment requirement for blob resources. Preferring OPAQUE_FD is required because right now when you allocate memory in virglrender, if the host driver supports DMABUF export/import it will automatically use that, and will only use OPAQUE_FD if DMABUF import/export is not supported.

These changes also introduce a new API virgl_renderer_resource_get_vulkaninfo that allows a user of the virgl_renderer_resource API to get the vulkan information (memory type, device UUID, driver UUID) of a renderer resource, so that they can properly import and map an OPAQUE_FD when it is passed to them.

The crosvm changes I'm working on can be found here https://gitlab.freedesktop.org/Hazematman/crosvm/-/commits/lfryzek/opaque_fd_patchset?ref_type=heads

Edited by Lucas Fryzek

Merge request reports

Loading