Skip to content

virglrenderer: enable gbm_bo_create for linear resource

Julia Zhang requested to merge Julia/virglrenderer:upstream-dGPU_prime into main

Background

We are working to implement dGPU prime feature on XEN guest VM which has VirtIO iGPU and passthrough dGPU. But the original virgl doesn't support this feature because virtio-gpu driver doesn't support DMA operations so iGPU cannot import data from passthrough dGPU directly on XEN guest VM. So we comp up with a solution to alloc blob memory for display buffer and allow dGPU blit data to the display buffer of iGPU so that passthrough dGPU rendered data can be displayed in XEN guest VM.

Implementation Notes

This idea includes Three main steps:

  1. Init gbm in vrend_renderer_init().
  2. Use gbm_bo_create() to alloc bo for linear resource, which is used as display buffer in XEN guest VM mesa.
  3. Map bo to XEN guest VM so that guest mesa could blit data to this bo directly.
  4. Implement resource_query_layout to get information of how the host has allocate the buffer. And for the use case that res_handle == 0, resource_query_layout create a tmp resource to query the stride for guest linear resource, which is used as the display buffer for dGPU prime.

Reference

Related mesa changes:Implement dGPU prime feature on virgl

Edited by Julia Zhang

Merge request reports