Skip to content

Add venus and video with QEMU on Xen

Huang Rui requested to merge rui/virglrenderer:upstream-for-xen into main

Background


We are working to introduce Venus GPU and some Video codec support on Xen with QEMU, please see details on XEN mail list. The original venus support is inherited from Antonio Caggiano on !647 (closed) , but that source is too old, we have rebased them to latest master and modified the support for recent virgl_render_server. Please see the related QEMU implementation here .

Implementation Notes for Venus (V2: as suggested by @zzyiwei, drop importing external vulkan resource)


This is for the use case that egl is not initialized so the importer side in the guest would not be able to import external vulkan resource.

The main step of this idea is to implement importing memory from an external vulkan resource by calling OpenGL APIs and creating a vrend resource based on this imported memory in vrend_renderer_pipe_resource_set_type(). So when guest side kicks DRM_IOCTL_PRIME_FD_TO_HANDLE => virgl_renderer_ctx_attach_resource, this vrend resource can be created and attached to the destination vrend contexts.

Please see the corresponding mesa MR mesa/mesa!23680 (merged)

Implementation Notes for Video


Currently, there are some video formats in virglrenderer that support accelerated decoding in VM, these patches added more video formats.

Those formats are added: mpeg12, vc1, jpeg, hevc10bit and vp9. Different virgl_ picture_desc are added, video buffer and video parameter bypassed in fill_picture_param make them vaapi type data, by calling different vaapi in host to complete the video decoding. The transfer of data requires the host VM mesa lib, so this change requires relevant modifications in mesa lib. Please see corresponding mesa MR mesa/mesa!22108 (merged)

Currently, hardware accelerated decoding of above video have been implemented but the efficiency of decoding in the VM is not very high. This is mainly due to the inefficient video data transmission method between the host and the guest. In the future, blob memory may will be used to improve the efficiency of video decoding.

Reference


Corresponding implementation: QEMU Repo, XEN Repo, Kernel Repo , Mesa Repo

Screenshot: Venus_on_Xen

Edited by Huang Rui

Merge request reports

Loading