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 , 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
This idea is to add a new function that create vrend resource by importing memory from an external virgl resource so that when lookup for a vrend resource, it can search all the contexts to get the resource or create a resource based on the imported memory. To look for a vrend resource from vkr context, this also adds a new request that sent from proxy to virgl_render_server. virgl_render_server reply this request with an external virgl resource saved in vkr context.
This design includes two parts:
- To resolve the Illegal resource error occurred when vrend_renderer_ctx_res_lookup() only lookup in vrend_context, this adds a new function vrend_resource_lookup_wide() to look for the vrend resource in all contexts. If not found, then look for a virgl resource we expect being an image with its dimensions in all contexts and create a vrend resource by importing memory from this external virgl resource. This idea is inherited from Antonio Caggiano.
- Send a request from proxy to virgl_render_server to get virgl resource. virgl_render_server reply the request with the dimensions of this virgl resource which we expect being an image and its fd_type. Then create vrend resource by importing memory from this resource.
The series also include the fix of venus window display by exchange R and B channel since venus window surface is BGRA format but virgl create RGBA format texture.
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
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