Hi Marc-Andre,

> Subject: Re: [PATCH v3 0/6] ui/spice: Enable gl=on option for non-local or
> remote clients
> 
> Hi Vivek
> 
> On Tue, Apr 29, 2025 at 10:13 AM Vivek Kasireddy
> <vivek.kasire...@intel.com> wrote:
> >
> > To address the limitation that this option is incompatible with
> > remote clients, this patch series adds an option to select a
> > preferred codec and also enable gl=on option for clients that
> > are connected via the network. In other words, with this option
> > enabled (and the below linked Spice series merged), it would be
> > possible to have Qemu share a dmabuf fd with Spice, which would
> > then forward it to a hardware or software based encoder and
> > eventually send the data associated with the fd to a client that
> > could be located on a different machine.
> >
> > Essentially, this patch series provides a hardware accelerated,
> > opensource VDI option for users using Qemu and Spice by leveraging
> > the iGPU/dGPU on the host machine via the Gstreamer framework.
> >
> 
> Could you explain why Spice or GStreamer can't handle a non-linear
> texture layout? It feels like a limitation that is not under QEMU
> responsibility, I am not sure it should have to do it.
AFAIU, there are several things to consider for handling non-linear/tiled
layouts (aka DRM modifiers) in this use-case:
- The choice of which encoder to use (hardware vs software) is decided
  dynamically and is internal to Spice at this point. And, since there is no
  easy way to know from Qemu whether an encoder chosen by Spice would
  support any given tiling format, I chose to always use linear layout since it
  is mostly guaranteed to work with all types of encoders. However, it makes
  sense to add some kind of encoder/codec caps exchange between Qemu
  and Spice in the future.

- There does not appear to be a way to do the conversion from tiled to linear
  at the encoder level with Gstreamer. In other words, if Spice were to pick a
  software encoder such as x264enc, then it would become necessary do the
  conversion in Qemu (using GL) where this situation can be easily detected
  and handled.

- And, last time I checked, DRM modifiers support in Gstreamer was still not
  very mature and not all the key elements/plugins supported them. So, it may
  not be guaranteed to work in different use-cases.
  
Given all the above, I figured it makes sense to start small and stick with 
linear
layout for now as it works in all cases and then improve by adding modifier
support later to address the scenarios where they can be supported.

> 
> Btw, the series will likely have conflicts with "ui: support multi
> plane texture", which I think we should merge first.
> (https://patchew.org/QEMU/20250327025848.46962-1-yuq...@gmail.com/)
Ok, for the next version, I'll rebase my patches on top of the above series.

Thanks,
Vivek

> 
> > v2 -> v3:
> > - Check for errors after invoking glImportMemoryFdEXT() using
> >   glGetError() and report the error to user (Dmitry)
> >
> > v1 -> v2:
> > - Replace the option name preferred-codec with video-codecs (Marc-André)
> > - Add a warning when an fd cannot be created from texture (Marc-André)
> > - Add a new patch to blit the scanout texture into a linear one to
> >   make it work with virgl
> > - Rebased and tested against the latest Spice master
> >
> > Tested with the following Qemu parameters:
> > -device virtio-vga,max_outputs=1,xres=1920,yres=1080,blob=true
> > -spice port=3001,gl=on,disable-ticketing=on,video-codecs=gstreamer:h264
> >
> > and remote-viewer --spice-debug spice://x.x.x.x:3001 on the client side.
> >
> > Associated Spice server MR (merged):
> > https://gitlab.freedesktop.org/spice/spice/-/merge_requests/229
> >
> > ---
> > Cc: Gerd Hoffmann <kra...@redhat.com>
> > Cc: Marc-André Lureau <marcandre.lur...@redhat.com>
> > Cc: Dmitry Osipenko <dmitry.osipe...@collabora.com>
> > Cc: Frediano Ziglio <fredd...@gmail.com>
> > Cc: Michael Scherle <michael.sche...@rz.uni-freiburg.de>
> > Cc: Dongwon Kim <dongwon....@intel.com>
> > Cc: Alex Bennée <alex.ben...@linaro.org>
> >
> > Vivek Kasireddy (6):
> >   ui/spice: Add an option for users to provide a preferred codec
> >   ui/spice: Enable gl=on option for non-local or remote clients
> >   ui/spice: Submit the gl_draw requests at 60 FPS for remote clients
> >   ui/console-gl: Add a helper to create a texture with linear memory
> >     layout
> >   ui/spice: Create a new texture with linear layout when gl=on is
> >     enabled
> >   ui/spice: Blit the scanout texture if its memory layout is not linear
> >
> >  include/ui/console.h       |   2 +
> >  include/ui/spice-display.h |   4 +
> >  qemu-options.hx            |   5 +
> >  ui/console-gl.c            |  28 ++++++
> >  ui/spice-core.c            |  16 ++++
> >  ui/spice-display.c         | 184 +++++++++++++++++++++++++++++++++----
> >  6 files changed, 223 insertions(+), 16 deletions(-)
> >
> > --
> > 2.49.0
> >
> >
> 
> 
> --
> Marc-André Lureau

Reply via email to