Add support for scanout dmabufs. Just
pass them through to spice-server.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/spice-display.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/ui/spice-display.c b/ui/spice-display.c
index f3ae6beb3d..a494db1196 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -936,6 +936,20 @@ static void qemu_spice_gl_scanout_texture(DisplayChangeListener *dcl,
ssd->have_scanout = true;
}
+static void qemu_spice_gl_scanout_dmabuf(DisplayChangeListener *dcl,
+ QemuDmaBuf *dmabuf)
+{
+ SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
+
+ /* note: spice server will close the fd, so hand over a dup */
+ spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd),
+ dmabuf->width, dmabuf->height,
+ dmabuf->stride, dmabuf->fourcc, false);
+ qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height);
+ ssd->have_surface = false;
+ ssd->have_scanout = true;
+}
+
static void qemu_spice_gl_update(DisplayChangeListener *dcl,
uint32_t x, uint32_t y, uint32_t w, uint32_t h)
{
@@ -969,6 +983,7 @@ static const DisplayChangeListenerOps display_listener_gl_ops = {
.dpy_gl_scanout_disable = qemu_spice_gl_scanout_disable,
.dpy_gl_scanout_texture = qemu_spice_gl_scanout_texture,
+ .dpy_gl_scanout_dmabuf = qemu_spice_gl_scanout_dmabuf,
.dpy_gl_update = qemu_spice_gl_update,
};
--
2.9.3
Hi
On Tue, Mar 6, 2018 at 9:38 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Add support for scanout dmabufs. Just
> pass them through to spice-server.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> ui/spice-display.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/ui/spice-display.c b/ui/spice-display.c
> index f3ae6beb3d..a494db1196 100644
> --- a/ui/spice-display.c
> +++ b/ui/spice-display.c
> @@ -936,6 +936,20 @@ static void qemu_spice_gl_scanout_texture(DisplayChangeListener *dcl,
> ssd->have_scanout = true;
> }
>
> +static void qemu_spice_gl_scanout_dmabuf(DisplayChangeListener *dcl,
> + QemuDmaBuf *dmabuf)
> +{
> + SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
> +
> + /* note: spice server will close the fd, so hand over a dup */
> + spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd),
> + dmabuf->width, dmabuf->height,
> + dmabuf->stride, dmabuf->fourcc, false);
> + qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height);
> + ssd->have_surface = false;
> + ssd->have_scanout = true;
> +}
> +
> static void qemu_spice_gl_update(DisplayChangeListener *dcl,
> uint32_t x, uint32_t y, uint32_t w, uint32_t h)
> {
> @@ -969,6 +983,7 @@ static const DisplayChangeListenerOps display_listener_gl_ops = {
>
> .dpy_gl_scanout_disable = qemu_spice_gl_scanout_disable,
> .dpy_gl_scanout_texture = qemu_spice_gl_scanout_texture,
> + .dpy_gl_scanout_dmabuf = qemu_spice_gl_scanout_dmabuf,
> .dpy_gl_update = qemu_spice_gl_update,
> };
>
> --
> 2.9.3
>
>
Looks good. Btw, how is multi-monitor designed? Is there going to be a
scanout/dmabuf per monitor when using vfio/mdev?
--
Marc-André Lureau
> > @@ -969,6 +983,7 @@ static const DisplayChangeListenerOps display_listener_gl_ops = {
> >
> > .dpy_gl_scanout_disable = qemu_spice_gl_scanout_disable,
> > .dpy_gl_scanout_texture = qemu_spice_gl_scanout_texture,
> > + .dpy_gl_scanout_dmabuf = qemu_spice_gl_scanout_dmabuf,
> > .dpy_gl_update = qemu_spice_gl_update,
> > };
> >
> > --
> > 2.9.3
> >
> >
>
> Looks good. Btw, how is multi-monitor designed? Is there going to be a
> scanout/dmabuf per monitor when using vfio/mdev?
Yes, that would be one QemuConsole per head (simliar to virtio-gpu).
There is no multihead support right now though. Not in the drivers, and
also not in the vfio API. Adding api for it without an actual test case
didn't look like a good plan to me. Extending the API later is easier
than dealing with a broken api in case we miss some detail and only
figure later when the first driver tries to use the untested API ...
cheers,
Gerd
© 2016 - 2025 Red Hat, Inc.