[virglrenderer-devel] coherent memory access for virgl

Gerd Hoffmann kraxel at redhat.com
Fri Sep 28 10:36:47 UTC 2018


  Hi,

> If virglrenderer will do the allocation, what about
> virtio_gpu_resource_create_2d -- who calls that in guest userspace?

Guest userspace can't call it explicitly.  The
DRM_VIRTGPU_RESOURCE_CREATE ioctl will use virtio_gpu_resource_create_3d
in case virgl is enabled and virtio_gpu_resource_create_2d otherwise.

The kernel will use virtio_gpu_resource_create_2d for drm framebuffers
(fbdev emulation and dumb drm buffers).

> Should it ever be host-optimized (since we're essentially talking
> about single-level 2D textures/render targets/scan-out buffers)?

No.

> > > We already need to extend the DRM_VIRTGPU_RESOURCE_INFO ioctl, since
> > > it doesn't return the stride and doesn't work for YUV buffers (see
> > > crrev.com/c/1208591).  Maybe we can also add a bitmask, which we can
> > > populate with memory info (i.e, HOST_BIT | COHERENT_BIT)?
> >
> > Well, for userspace it can be transparent.  Userspace will just call
> > mmap() and the kernel will sort things transparently depending on the
> > buffer allocation (userspace knowing how buffers are allocated is
> > probably useful nevertheless).
> >
> > I was thinking about the kernel / vmm interface.  The virtio-gpu kms
> > driver certainly needs to know about the buffer allocation ...
> 
> The KMS part will be more difficult than the EGL part.
> 
> For example, on some ARM devices, AFBC can be only used on the (host)
> primary KMS plane.

What is AFBC?  Some drm format modifier?

> If a video running in QEMU is full screen, it's advantageous to
> allocate an AFBC buffer and then scan-it out.  But if the QEMU window
> becomes smaller, the best option is to use a linear strided buffer and
> schedule that as an overlay.  But the guest always thinks it's
> fullscreen ...

> How is the guest currently notified about size changes of it's drawing
> target?

virtio-gpu device sends an event.  virtio-gpu driver queries the host
(GET_DISPLAY_INFO cmd).  virtio-gpu updates video mode list and sends
monitor hotplug event to userspace (via udev).

> Do buffers get re-allocated?

That is up to userspace.  Typically the desktop (i.e. gnome shell)
handles it.

cheers,
  Gerd



More information about the virglrenderer-devel mailing list