[virglrenderer-devel] GL_ARB_buffer_storage implementation

Frank Yang lfy at google.com
Thu May 14 05:41:00 UTC 2020


Thanks Gerd, that's very helpful!

Recently I've had a reason to get Vk to work with a non cpu accelerated
guest and your steps were pretty much all there was to it (couldn't
directly use the hypervisor's mapping apis w/ tcg, so the 'runtime user
controlled backings' part needed to use your method:
https://android-review.googlesource.com/c/platform/external/qemu/+/1310349)

On Tue, May 12, 2020 at 3:41 AM Gerd Hoffmann <kraxel at redhat.com> wrote:

>   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
>
>
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/virglrenderer-devel/attachments/20200513/0382943d/attachment.htm>


More information about the virglrenderer-devel mailing list