[virglrenderer-devel] coherent memory access for virgl

Dave Airlie airlied at gmail.com
Mon Jul 30 20:28:23 UTC 2018


I think we've pretty much nailed GL4.3 + GLES3.1/2 in terms of
features, which leads us to the next big milestones.

a) GL 4.4 - specifically GL_ARB_buffer_storage
b) vulkan.

Both of these are going to require coherent memory access from the
guest to resources on the host.

For gl buffers this means we get to do something like

glBufferStorage(GL_UNIFORM_BUFFER, 65536, data,
GL_MAP_PERSISTENT_BIT|GL_MAP_COHERENT_BIT);

ptr = glMapBufferRange(GL_UNIFORM_BUFFER, 0, 65536,
GL_MAP_COHERENT_BIT|GL_MAP_PERSISTENT_BIT|GL_MAP_READ_BIT|GL_MAP_WRITE_BIT)

and the data in ptr needs to be coherent with the data the GPU is
going to access without any extra steps.

I'm open to suggestions on how we implement this for inside qemu and
for vtest use cases.

I expect we need to use a PCI BAR for this behaviour, I'm not sure how
large or many objects implementations expect to be able to map
consistent and persistent
at the same time, so having a restricted BAR side could be quite
limiting here, I suppose we could make a 64-bit BAR and have it quite
large in order to accomodate
this. However if we have a BAR space we will need to memory manage it
and add eviction of objects in it (they can always be paged back on on
next access).

For vtest, we need some way I think to export a buffer to an fd that
we can pass over the unix socket, and import the backing pages
(probably a dma-buf mmap)
into the "guest".

Anyone got any better/worse/pitfalls. I'm also not sure if I'm the
best person to work on this, so if someone is really interested and
has bandwidth I think it would
definitely be a thing to get moving on.

Dave.


More information about the virglrenderer-devel mailing list