All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/display/virtio-gpu: set share_handle for udmabuf blob resources
@ 2026-08-27  7:10 marcandre.lureau
  2026-08-27  8:53 ` Daniel P. Berrangé
  2026-08-28 17:14 ` Akihiko Odaki
  0 siblings, 2 replies; 3+ messages in thread
From: marcandre.lureau @ 2026-08-27  7:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: akihiko.odaki, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

When a blob resource is backed by udmabuf, the dmabuf fd was never
propagated to res->share_handle. This meant the D-Bus display
listener could not share the buffer mapping with remote clients,
falling back to copying pixel data instead.

Set share_handle to the dmabuf fd after successful udmabuf creation,
and reset it to SHAREABLE_NONE on teardown.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-udmabuf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/display/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabuf.c
index c230509852ff..5d6daa1f7afc 100644
--- a/hw/display/virtio-gpu-udmabuf.c
+++ b/hw/display/virtio-gpu-udmabuf.c
@@ -91,6 +91,7 @@ static void virtio_gpu_destroy_udmabuf(struct virtio_gpu_simple_resource *res)
     if (res->dmabuf_fd >= 0) {
         close(res->dmabuf_fd);
         res->dmabuf_fd = -1;
+        res->share_handle = SHAREABLE_NONE;
     }
 }
 
@@ -149,6 +150,7 @@ bool virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res)
             virtio_gpu_destroy_udmabuf(res);
             return false;
         }
+        res->share_handle = res->dmabuf_fd;
         pdata = res->remapped;
     }
 
@@ -182,6 +184,7 @@ void virtio_gpu_fini_udmabuf(VirtIOGPU *g, struct virtio_gpu_simple_resource *re
             res->dmabuf_fd != -1) {
             qemu_dmabuf_close(dmabuf->buf);
             res->dmabuf_fd = -1;
+            res->share_handle = SHAREABLE_NONE;
         }
     }
 
-- 
2.55.0.543.g5ebe2ebe4ea8



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/display/virtio-gpu: set share_handle for udmabuf blob resources
  2026-08-27  7:10 [PATCH] hw/display/virtio-gpu: set share_handle for udmabuf blob resources marcandre.lureau
@ 2026-08-27  8:53 ` Daniel P. Berrangé
  2026-08-28 17:14 ` Akihiko Odaki
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2026-08-27  8:53 UTC (permalink / raw)
  To: marcandre.lureau; +Cc: qemu-devel, akihiko.odaki

On Thu, Aug 27, 2026 at 11:10:13AM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> When a blob resource is backed by udmabuf, the dmabuf fd was never
> propagated to res->share_handle. This meant the D-Bus display
> listener could not share the buffer mapping with remote clients,
> falling back to copying pixel data instead.
> 
> Set share_handle to the dmabuf fd after successful udmabuf creation,
> and reset it to SHAREABLE_NONE on teardown.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  hw/display/virtio-gpu-udmabuf.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/display/virtio-gpu: set share_handle for udmabuf blob resources
  2026-08-27  7:10 [PATCH] hw/display/virtio-gpu: set share_handle for udmabuf blob resources marcandre.lureau
  2026-08-27  8:53 ` Daniel P. Berrangé
@ 2026-08-28 17:14 ` Akihiko Odaki
  1 sibling, 0 replies; 3+ messages in thread
From: Akihiko Odaki @ 2026-08-28 17:14 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel

On 2026/08/27 16:10, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> When a blob resource is backed by udmabuf, the dmabuf fd was never
> propagated to res->share_handle. This meant the D-Bus display
> listener could not share the buffer mapping with remote clients,
> falling back to copying pixel data instead.
> 
> Set share_handle to the dmabuf fd after successful udmabuf creation,
> and reset it to SHAREABLE_NONE on teardown.
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Please add:
Fixes: 5f899c34af1d ("virtio-gpu: allocate shareable 2d resources on 
!win32")

With the Fixes tag:

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>

Regards,
Akihiko Odaki

> ---
>   hw/display/virtio-gpu-udmabuf.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/hw/display/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabuf.c
> index c230509852ff..5d6daa1f7afc 100644
> --- a/hw/display/virtio-gpu-udmabuf.c
> +++ b/hw/display/virtio-gpu-udmabuf.c
> @@ -91,6 +91,7 @@ static void virtio_gpu_destroy_udmabuf(struct virtio_gpu_simple_resource *res)
>       if (res->dmabuf_fd >= 0) {
>           close(res->dmabuf_fd);
>           res->dmabuf_fd = -1;
> +        res->share_handle = SHAREABLE_NONE;
>       }
>   }
>   
> @@ -149,6 +150,7 @@ bool virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res)
>               virtio_gpu_destroy_udmabuf(res);
>               return false;
>           }
> +        res->share_handle = res->dmabuf_fd;
>           pdata = res->remapped;
>       }
>   
> @@ -182,6 +184,7 @@ void virtio_gpu_fini_udmabuf(VirtIOGPU *g, struct virtio_gpu_simple_resource *re
>               res->dmabuf_fd != -1) {
>               qemu_dmabuf_close(dmabuf->buf);
>               res->dmabuf_fd = -1;
> +            res->share_handle = SHAREABLE_NONE;
>           }
>       }
>   



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-28 17:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27  7:10 [PATCH] hw/display/virtio-gpu: set share_handle for udmabuf blob resources marcandre.lureau
2026-08-27  8:53 ` Daniel P. Berrangé
2026-08-28 17:14 ` Akihiko Odaki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.