qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC 0/1] Use dmabufs for display updates instead of pixman


From: Gerd Hoffmann
Subject: Re: [RFC 0/1] Use dmabufs for display updates instead of pixman
Date: Tue, 9 Mar 2021 10:37:39 +0100

  Hi,

> > That is pretty much mandatory.  Without blob resources there is no concept 
> > of resources
> > shared between host and guest in virtio-gpu, all data is explicitly copied 
> > with transfer
> > commands.
> [Kasireddy, Vivek] My understanding of virtio-gpu and the concept of 
> resources is still
> fairly limited but are blob resources really needed for non-Virgl use-cases 
> -- other than
> something like a dmabuf/scanout blob that shares the meta-data such as 
> modifer? I
> thought the main motivation for blob resources would be to avoid the explicit 
> copy you
> mentioned for Virgl workloads. 

Well, you want avoid the copy as well, right?  With blob resources you
can do that in a well defined way, i.e. the guest knows what you are
doing and behaves accordingly.  Without blob resources you can't, at
least not without violating the guests expectation that any changes it
does only visible to the host after an explicit transfer (aka copy)
command.

> > Which implies quite a bit of work because we don't have blob resource 
> > support in qemu
> > yet.
> [Kasireddy, Vivek] I was scrubbing through old mailing list messages to 
> understand the
> motivation behind blob resources as to why they are needed and came across 
> this:
> https://gitlab.freedesktop.org/virgl/qemu/-/commits/virtio-gpu-next
> 
> Does your work above not count for anything?

It is quite old, and I think not up-to-date with the final revision of
the blob resource specification.  I wouldn't be able to update this in
near future due to being busy with other projects.  Feel free to grab
& update & submit these patches though.

> > I think when using opengl it makes sense to also require virgl, so we can 
> > use the
> > virglrenderer library to manage blob resources (even when the actual 
> > rendering isn't done
> > with virgl).  Also reduces the complexity and test matrix.
> [Kasireddy, Vivek] When you say "using opengl" are you referring to the 
> presentation of
> the rendered buffer via dmabuf or pixman? If yes, I am not sure why this 
> would need to
> depend on Virgl.

Well, you can probably do it without virgl as well.  But why?  Instead
of just using the virglrenderer library effectively duplicate the blob
resource management bits in qemu?

Beside the code duplication this is also a maintainance issue.  This
adds one more configuration to virtio-gpu.  Right now you can build
virtio-gpu with virgl (depends on opengl), or you can build without
virgl (doesn't use opengl then).  I don't think it is a good idea to
add a third mode, without virgl support but using opengl for blob
dma-bufs.

> For our use-case(s) where we are using virtio-gpu in buffer sharing mode,
> we'd still need opengl for submitting the dmabuf to UI, IIUC.

Correct.  When you want use dma-bufs you need opengl.

> > Maybe it even makes sense to deprecate in-qemu virgl support and focus 
> > exclusively on
> > the vhost-user implementation, so we don't have to duplicate all work for 
> > both
> > implementations.
> [Kasireddy, Vivek] Is the vhost-user implementation better in terms of 
> performance, generally? 

It is better both in terms of security (it's easier to sandbox) and
performance.  The in-qemu implementation runs in the qemu iothread.
Which also handles a bunch of other jobs.  Also virglrenderer being busy
-- for example with compiling complex shaders -- can block qemu for a
while, which in turn can cause latency spikes in the guest.  With the
vhost-user implementation this is not a problem.

Drawback is the extra communication (and synchronization) needed between
vhost-user + qemu to make the guest display available via spice or gtk.

The latter can possibly be solved by exporting the guest display as
pipewire remote desktop (random idea I didn't investigate much yet).

> On a different note, any particular reason why Qemu UI EGL
> implementation is limited to Xorg and not extended to Wayland/Weston
> for which there is GTK glarea?

Well, ideally I'd love to just use glarea.  Which happens on wayland.

The problem with Xorg is that the gtk x11 backend uses glx not egl to
create an opengl context for glarea.  At least that used to be the case
in the past, maybe that has changed with newer versions.  qemu needs egl
contexts though, otherwise dma-bufs don't work.  So we are stuck with
our own egl widget implementation for now.  Probably we will be able to
drop it at some point in the future.

HTH,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]