[PATCH] vhost-user-gpu: fix import of DMABUF

marcandre.lureau@redhat.com posted 1 patch 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240415111553.2733357-1-marcandre.lureau@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
hw/display/vhost-user-gpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] vhost-user-gpu: fix import of DMABUF
Posted by marcandre.lureau@redhat.com 2 weeks ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

When using vhost-user-gpu with GL, qemu -display gtk doesn't show output
and prints: qemu: eglCreateImageKHR failed

Since commit 9ac06df8b ("virtio-gpu-udmabuf: correct naming of
QemuDmaBuf size properties"), egl_dmabuf_import_texture() uses
backing_{width,height} for the texture dimension.

Fixes: commit 9ac06df8b ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf size properties")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/vhost-user-gpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index 709c8a02a1..baffb1c2d4 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -273,8 +273,8 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg)
         }
         *dmabuf = (QemuDmaBuf) {
             .fd = fd,
-            .width = m->fd_width,
-            .height = m->fd_height,
+            .backing_width = m->fd_width,
+            .backing_height = m->fd_height,
             .stride = m->fd_stride,
             .fourcc = m->fd_drm_fourcc,
             .y0_top = m->fd_flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP,
-- 
2.41.0.28.gd7d8841f67


RE: [PATCH] vhost-user-gpu: fix import of DMABUF
Posted by Kim, Dongwon 2 weeks ago
Hi Marc-André,

> -----Original Message-----
> From: marcandre.lureau@redhat.com <marcandre.lureau@redhat.com>
> Sent: Monday, April 15, 2024 4:16 AM
> To: qemu-devel@nongnu.org
> Cc: Kim, Dongwon <dongwon.kim@intel.com>; dbassey@redhat.com; Marc-
> André Lureau <marcandre.lureau@redhat.com>; Michael S. Tsirkin
> <mst@redhat.com>; Gerd Hoffmann <kraxel@redhat.com>
> Subject: [PATCH] vhost-user-gpu: fix import of DMABUF
> 
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> When using vhost-user-gpu with GL, qemu -display gtk doesn't show output and
> prints: qemu: eglCreateImageKHR failed
> 
> Since commit 9ac06df8b ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf
> size properties"), egl_dmabuf_import_texture() uses backing_{width,height} for
> the texture dimension.
> 
> Fixes: commit 9ac06df8b ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf
> size properties")
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  hw/display/vhost-user-gpu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index
> 709c8a02a1..baffb1c2d4 100644
> --- a/hw/display/vhost-user-gpu.c
> +++ b/hw/display/vhost-user-gpu.c
> @@ -273,8 +273,8 @@ vhost_user_gpu_handle_display(VhostUserGPU *g,
> VhostUserGpuMsg *msg)
>          }
>          *dmabuf = (QemuDmaBuf) {
>              .fd = fd,
> -            .width = m->fd_width,
> -            .height = m->fd_height,
[Kim, Dongwon]  I think we could just leave .width/.height setting here although nothing will go wrong in any cases. Did you have any specific reason why leaving these uninitialized?

> +            .backing_width = m->fd_width,
> +            .backing_height = m->fd_height,
>              .stride = m->fd_stride,
>              .fourcc = m->fd_drm_fourcc,
>              .y0_top = m->fd_flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP,
> --
> 2.41.0.28.gd7d8841f67

Re: [PATCH] vhost-user-gpu: fix import of DMABUF
Posted by Marc-André Lureau 1 week, 6 days ago
Hi

On Tue, Apr 16, 2024 at 1:00 AM Kim, Dongwon <dongwon.kim@intel.com> wrote:
>
> Hi Marc-André,
>
> > -----Original Message-----
> > From: marcandre.lureau@redhat.com <marcandre.lureau@redhat.com>
> > Sent: Monday, April 15, 2024 4:16 AM
> > To: qemu-devel@nongnu.org
> > Cc: Kim, Dongwon <dongwon.kim@intel.com>; dbassey@redhat.com; Marc-
> > André Lureau <marcandre.lureau@redhat.com>; Michael S. Tsirkin
> > <mst@redhat.com>; Gerd Hoffmann <kraxel@redhat.com>
> > Subject: [PATCH] vhost-user-gpu: fix import of DMABUF
> >
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > When using vhost-user-gpu with GL, qemu -display gtk doesn't show output and
> > prints: qemu: eglCreateImageKHR failed
> >
> > Since commit 9ac06df8b ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf
> > size properties"), egl_dmabuf_import_texture() uses backing_{width,height} for
> > the texture dimension.
> >
> > Fixes: commit 9ac06df8b ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf
> > size properties")
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  hw/display/vhost-user-gpu.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index
> > 709c8a02a1..baffb1c2d4 100644
> > --- a/hw/display/vhost-user-gpu.c
> > +++ b/hw/display/vhost-user-gpu.c
> > @@ -273,8 +273,8 @@ vhost_user_gpu_handle_display(VhostUserGPU *g,
> > VhostUserGpuMsg *msg)
> >          }
> >          *dmabuf = (QemuDmaBuf) {
> >              .fd = fd,
> > -            .width = m->fd_width,
> > -            .height = m->fd_height,
> [Kim, Dongwon]  I think we could just leave .width/.height setting here although nothing will go wrong in any cases. Did you have any specific reason why leaving these uninitialized?
>


Good point. In fact, there are even dedicated fields for width/height.
Fixed in v2.

thanks


-- 
Marc-André Lureau