[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/24] ui: check hw requirements during DCL registration
From: |
Gerd Hoffmann |
Subject: |
[PULL 17/24] ui: check hw requirements during DCL registration |
Date: |
Fri, 5 Feb 2021 07:56:13 +0100 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210204105232.834642-14-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/console.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/ui/console.c b/ui/console.c
index a645418adad5..d8cc640c28db 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1476,12 +1476,37 @@ static bool
displaychangelistener_has_dmabuf(DisplayChangeListener *dcl)
return false;
}
+static bool dpy_compatible_with(QemuConsole *con,
+ DisplayChangeListener *dcl, Error **errp)
+{
+ ERRP_GUARD();
+ int flags;
+
+ flags = con->hw_ops->get_flags ? con->hw_ops->get_flags(con->hw) : 0;
+
+ if (flags & GRAPHIC_FLAGS_GL &&
+ !console_has_gl(con)) {
+ error_setg(errp, "The console requires a GL context.");
+ return false;
+
+ }
+
+ if (flags & GRAPHIC_FLAGS_DMABUF &&
+ !displaychangelistener_has_dmabuf(dcl)) {
+ error_setg(errp, "The console requires display DMABUF support.");
+ return false;
+ }
+
+ return true;
+}
+
void register_displaychangelistener(DisplayChangeListener *dcl)
{
static const char nodev[] =
"This VM has no graphic display device.";
static DisplaySurface *dummy;
QemuConsole *con;
+ Error *err = NULL;
assert(!dcl->ds);
@@ -1496,6 +1521,11 @@ void
register_displaychangelistener(DisplayChangeListener *dcl)
dcl->con->gl = dcl;
}
+ if (dcl->con && !dpy_compatible_with(dcl->con, dcl, &err)) {
+ error_report_err(err);
+ exit(1);
+ }
+
trace_displaychangelistener_register(dcl, dcl->ops->dpy_name);
dcl->ds = get_alloc_displaystate();
QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next);
--
2.29.2
- [PULL 09/24] ui: remove extra #ifdef CONFIG_OPENGL, (continued)
- [PULL 09/24] ui: remove extra #ifdef CONFIG_OPENGL, Gerd Hoffmann, 2021/02/05
- [PULL 13/24] ui: remove console_has_gl_dmabuf(), Gerd Hoffmann, 2021/02/05
- [PULL 03/24] qxl: also notify the rendering is done when skipping it, Gerd Hoffmann, 2021/02/05
- [PULL 14/24] vhost-user-gpu: add a configuration flag for dmabuf usage, Gerd Hoffmann, 2021/02/05
- [PULL 01/24] hw/display/qxl: Fix bad printf format specifiers, Gerd Hoffmann, 2021/02/05
- [PULL 12/24] ui: annotate DCLOps callback requirements, Gerd Hoffmann, 2021/02/05
- [PULL 08/24] vhost-user-gpu: handle display-info in a callback, Gerd Hoffmann, 2021/02/05
- [PULL 15/24] ui: add an optional get_flags callback to GraphicHwOps, Gerd Hoffmann, 2021/02/05
- [PULL 07/24] vhost-user-gpu: use an extandable state enum for commands, Gerd Hoffmann, 2021/02/05
- [PULL 11/24] ui: add gd_gl_area_scanout_disable, Gerd Hoffmann, 2021/02/05
- [PULL 17/24] ui: check hw requirements during DCL registration,
Gerd Hoffmann <=
- [PULL 23/24] chardev: check if the chardev is registered for yanking, Gerd Hoffmann, 2021/02/05
- [PULL 10/24] ui: remove gl_ctx_get_current, Gerd Hoffmann, 2021/02/05
- [PULL 24/24] tests: add some virtio-gpu & vhost-user-gpu acceptance test, Gerd Hoffmann, 2021/02/05
- [PULL 18/24] ui: add qemu_egl_has_dmabuf helper, Gerd Hoffmann, 2021/02/05
- [PULL 16/24] ui: add a DCLOps callback to check dmabuf support, Gerd Hoffmann, 2021/02/05
- [PULL 06/24] vhost-user-gpu: handle vhost-user-gpu features in a callback, Gerd Hoffmann, 2021/02/05
- [PULL 21/24] virtio-gpu: avoid re-entering cmdq processing, Gerd Hoffmann, 2021/02/05
- [PULL 22/24] display/ui: add a callback to indicate GL state is flushed, Gerd Hoffmann, 2021/02/05
- [PULL 05/24] vhost-user-gpu: check backend for EDID support, Gerd Hoffmann, 2021/02/05
- [PULL 19/24] ui: check gtk-egl dmabuf support, Gerd Hoffmann, 2021/02/05