[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/20] ui: check hw requirements during DCL registration
From: |
marcandre . lureau |
Subject: |
[PATCH v2 13/20] ui: check hw requirements during DCL registration |
Date: |
Thu, 4 Feb 2021 14:52:25 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
ui/console.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/ui/console.c b/ui/console.c
index a645418ada..d8cc640c28 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.0
- Re: [PATCH v2 03/20] vhost-user-gpu: use an extandable state enum for commands, (continued)
- [PATCH v2 04/20] vhost-user-gpu: handle display-info in a callback, marcandre . lureau, 2021/02/04
- [PATCH v2 05/20] ui: remove extra #ifdef CONFIG_OPENGL, marcandre . lureau, 2021/02/04
- [PATCH v2 06/20] ui: remove gl_ctx_get_current, marcandre . lureau, 2021/02/04
- [PATCH v2 07/20] ui: add gd_gl_area_scanout_disable, marcandre . lureau, 2021/02/04
- [PATCH v2 08/20] ui: annotate DCLOps callback requirements, marcandre . lureau, 2021/02/04
- [PATCH v2 09/20] ui: remove console_has_gl_dmabuf(), marcandre . lureau, 2021/02/04
- [PATCH v2 10/20] vhost-user-gpu: add a configuration flag for dmabuf usage, marcandre . lureau, 2021/02/04
- [PATCH v2 11/20] ui: add an optional get_flags callback to GraphicHwOps, marcandre . lureau, 2021/02/04
- [PATCH v2 12/20] ui: add a DCLOps callback to check dmabuf support, marcandre . lureau, 2021/02/04
- [PATCH v2 13/20] ui: check hw requirements during DCL registration,
marcandre . lureau <=
- [PATCH v2 14/20] ui: add qemu_egl_has_dmabuf helper, marcandre . lureau, 2021/02/04
- [PATCH v2 15/20] ui: check gtk-egl dmabuf support, marcandre . lureau, 2021/02/04
- [PATCH v2 16/20] ui: add egl dmabuf import to gtkglarea, marcandre . lureau, 2021/02/04
- [PATCH v2 17/20] virtio-gpu: avoid re-entering cmdq processing, marcandre . lureau, 2021/02/04
- [PATCH v2 18/20] display/ui: add a callback to indicate GL state is flushed, marcandre . lureau, 2021/02/04
- [PATCH v2 19/20] chardev: check if the chardev is registered for yanking, marcandre . lureau, 2021/02/04
- [PATCH v2 20/20] tests: add some virtio-gpu & vhost-user-gpu acceptance test, marcandre . lureau, 2021/02/04