[virglrenderer-devel] GL_ARB_buffer_storage implementation

Gerd Hoffmann kraxel at redhat.com
Tue May 12 10:41:06 UTC 2020


  Hi,

> I was taking a look at QEMU and it's non-obvious to me how to implement
> RESOURCE_MAP / RESOURCE_UNMAP.
> 
> For GL_ARB_buffer_storage, virglrenderer can provide a page-aligned
> address (seems to work even on Nvidia) for use with KVM:
> 
> https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/374/diffs#14086999aaf57fc68a3d7d639ab280c3a2672430_603_670
> 
> We need to figure out a way to call kvm_region_add / kvm_region_del
> from virtio-gpu-3d.c with this address.

Global initialization:
 (1) Create a memory region for the virtual pci bar,
     using memory_region_init()  That'll be just a container.

Resource initialization:
 (1) Create a memory region for each resource you want be able to map,
     using memory_region_init_ram_ptr().
 (2) Register the resource region as child in the container, using
     memory_region_add_subregion().

RESOURCE_MAP:
 (1) Move the memory region to the place the guest asks for, using
     memory_region_set_address().
 (2) Enable the region (memory_region_set_enabled()).

RESOURCE_UNMAP:
 (1) Disable the region (memory_region_set_enabled()).

HTH,
  Gerd
 



More information about the virglrenderer-devel mailing list