From 326a51f32dfa56a63815c06c2ba3b14b371cef35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 4 Feb 2021 14:52:13 +0400 Subject: vhost-user-gpu: check backend for EDID support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EDID has been enabled by default, but the backend may not implement it (such as the contrib backend). This results in extra warnings and potentially other issues in the guest. The option shouldn't probably have been added to VIRTIO_GPU_BASE, but it's a bit too late now, report an error and disable EDID when it's not available. Fixes: 0a7196625 ("edid: flip the default to enabled") Signed-off-by: Marc-André Lureau Message-Id: <20210204105232.834642-2-marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/display/vhost-user-gpu.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'hw/display/vhost-user-gpu.c') diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 51f1747..55b0ed1 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -555,6 +555,12 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error **errp) if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_VIRGL)) { g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED; } + if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_EDID)) { + g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_EDID_ENABLED; + } else { + error_report("EDID requested but the backend doesn't support it."); + g->parent_obj.conf.flags &= ~(1 << VIRTIO_GPU_FLAG_EDID_ENABLED); + } if (!virtio_gpu_base_device_realize(qdev, NULL, NULL, errp)) { return; -- cgit v1.1 From 2cc002483e9cc075896912ebc3ebd3fe86660902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 4 Feb 2021 14:52:21 +0400 Subject: ui: remove console_has_gl_dmabuf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This check is currently limited. It only is used by vhost-user-gpu (not by vfio-display), and will print an error repeatedly during run-time. We are going to dissociate the GL context from the DisplayChangeListener, and listeners may come and go. The following patches will address this differently. Signed-off-by: Marc-André Lureau Message-Id: <20210204105232.834642-10-marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/display/vhost-user-gpu.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'hw/display/vhost-user-gpu.c') diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 55b0ed1..dd58743 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -224,11 +224,6 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg) close(dmabuf->fd); dmabuf->fd = -1; } - if (!console_has_gl_dmabuf(con)) { - /* it would be nice to report that error earlier */ - error_report("console doesn't support dmabuf!"); - break; - } dpy_gl_release_dmabuf(con, dmabuf); if (fd == -1) { dpy_gl_scanout_disable(con); -- cgit v1.1 From ff64d44fb8f6636ece3064f86babe48e3807533d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 4 Feb 2021 14:52:22 +0400 Subject: vhost-user-gpu: add a configuration flag for dmabuf usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's inform VirtioGPUBase that vhost-user-gpu require DMABUF messages. Signed-off-by: Marc-André Lureau Message-Id: <20210204105232.834642-11-marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/display/vhost-user-gpu.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'hw/display/vhost-user-gpu.c') diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index dd58743..b7bde9f 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -547,6 +547,8 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error **errp) return; } + /* existing backend may send DMABUF, so let's add that requirement */ + g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_DMABUF_ENABLED; if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_VIRGL)) { g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED; } -- cgit v1.1 From 3cddb8b9e0b58eea04e6eb908fc6a12d5af3d3cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 4 Feb 2021 14:52:30 +0400 Subject: display/ui: add a callback to indicate GL state is flushed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Displaying rendered resources requires blocking qemu GPU to avoid extra framebuffer copies. For an external display, via Spice currently, there is a callback to block/unblock the rendering in the same thread. But with the vhost-user-gpu backend, the qemu process doesn't handle the rendering itself, and the blocking callback isn't effective. Instead, the backend must be notified when the display code is done. Fix this by adding a new GraphicHwOps callback to indicate the GL state is flushed, and we are done manipulating the shared GL resources. Call it from gtk and spice display. Signed-off-by: Marc-André Lureau Message-Id: <20210204105232.834642-19-marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/display/vhost-user-gpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/display/vhost-user-gpu.c') diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index b7bde9f..4d8cb35 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -360,7 +360,7 @@ vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blocked) } static void -vhost_user_gpu_gl_unblock(VirtIOGPUBase *b) +vhost_user_gpu_gl_flushed(VirtIOGPUBase *b) { VhostUserGPU *g = VHOST_USER_GPU(b); @@ -578,7 +578,7 @@ vhost_user_gpu_class_init(ObjectClass *klass, void *data) VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); VirtIOGPUBaseClass *vgc = VIRTIO_GPU_BASE_CLASS(klass); - vgc->gl_unblock = vhost_user_gpu_gl_unblock; + vgc->gl_flushed = vhost_user_gpu_gl_flushed; vdc->realize = vhost_user_gpu_device_realize; vdc->reset = vhost_user_gpu_reset; -- cgit v1.1