[PATCH for-8.1] vfio/display: Fix missing update to set backing fields

Alex Williamson posted 1 patch 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230816215550.1723696-1-alex.williamson@redhat.com
Maintainers: Alex Williamson <alex.williamson@redhat.com>, "Cédric Le Goater" <clg@redhat.com>
hw/vfio/display.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH for-8.1] vfio/display: Fix missing update to set backing fields
Posted by Alex Williamson 9 months ago
The below referenced commit renames scanout_width/height to
backing_width/height, but also promotes these fields in various portions
of the egl interface.  Meanwhile vfio dmabuf support has never used the
previous scanout fields and is therefore missed in the update.  This
results in a black screen when transitioning from ramfb to dmabuf display
when using Intel vGPU with these features.

Link: https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg02726.html
Fixes: 9ac06df8b684 ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf size properties")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

This fixes a regression in dmabuf/EGL support for Intel GVT-g and
potentially the mbochs mdev driver as well.  Once validated by those
that understand dmabuf/EGL integration, I'd welcome QEMU maintainers to
take this directly for v8.1 or queue it as soon as possible for v8.1.1.

 hw/vfio/display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index bec864f482f4..837d9e6a309e 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -243,6 +243,8 @@ static VFIODMABuf *vfio_display_get_dmabuf(VFIOPCIDevice *vdev,
     dmabuf->dmabuf_id  = plane.dmabuf_id;
     dmabuf->buf.width  = plane.width;
     dmabuf->buf.height = plane.height;
+    dmabuf->buf.backing_width = plane.width;
+    dmabuf->buf.backing_height = plane.height;
     dmabuf->buf.stride = plane.stride;
     dmabuf->buf.fourcc = plane.drm_format;
     dmabuf->buf.modifier = plane.drm_format_mod;
-- 
2.40.1
Re: [PATCH for-8.1] vfio/display: Fix missing update to set backing fields
Posted by Philippe Mathieu-Daudé 9 months ago
On 16/8/23 23:55, Alex Williamson wrote:
> The below referenced commit renames scanout_width/height to
> backing_width/height, but also promotes these fields in various portions
> of the egl interface.  Meanwhile vfio dmabuf support has never used the
> previous scanout fields and is therefore missed in the update.  This
> results in a black screen when transitioning from ramfb to dmabuf display
> when using Intel vGPU with these features.

Referenced commit isn't trivial. Maybe because it is too late here.
I'd have tried to split it. Anyhow, too late (again).

Is vhost-user-gpu also affected? (see VHOST_USER_GPU_DMABUF_SCANOUT
in vhost_user_gpu_handle_display()).

> Link: https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg02726.html
> Fixes: 9ac06df8b684 ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf size properties")
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> 
> This fixes a regression in dmabuf/EGL support for Intel GVT-g and
> potentially the mbochs mdev driver as well.  Once validated by those
> that understand dmabuf/EGL integration, I'd welcome QEMU maintainers to
> take this directly for v8.1 or queue it as soon as possible for v8.1.1.
> 
>   hw/vfio/display.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/hw/vfio/display.c b/hw/vfio/display.c
> index bec864f482f4..837d9e6a309e 100644
> --- a/hw/vfio/display.c
> +++ b/hw/vfio/display.c
> @@ -243,6 +243,8 @@ static VFIODMABuf *vfio_display_get_dmabuf(VFIOPCIDevice *vdev,
>       dmabuf->dmabuf_id  = plane.dmabuf_id;
>       dmabuf->buf.width  = plane.width;
>       dmabuf->buf.height = plane.height;
> +    dmabuf->buf.backing_width = plane.width;
> +    dmabuf->buf.backing_height = plane.height;
>       dmabuf->buf.stride = plane.stride;
>       dmabuf->buf.fourcc = plane.drm_format;
>       dmabuf->buf.modifier = plane.drm_format_mod;