[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 05/12] ui/console: move console compatibility check to dcl_dis
From: |
marcandre . lureau |
Subject: |
[PATCH v3 05/12] ui/console: move console compatibility check to dcl_display_console() |
Date: |
Mon, 7 Mar 2022 11:46:25 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
The current checks are done at registration time only. However, if a DCL
has no specific console specified, it may be switched dynamically with
console_select() later on.
Let's move the checks when displaychangelistener_display_console() is
called, which includes registration time and remains fatal if the
specified console is incompatible.
Note: we may want to display the compatibility error to the DCL, this is
left for a future improvement.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
ui/console.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index c9318552871b..d3ecbb215736 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -148,6 +148,8 @@ static DisplayState *get_alloc_displaystate(void);
static void text_console_update_cursor_timer(void);
static void text_console_update_cursor(void *opaque);
static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl);
+static bool console_compatible_with(QemuConsole *con,
+ DisplayChangeListener *dcl, Error **errp);
static void gui_update(void *opaque)
{
@@ -1057,13 +1059,14 @@ static void console_putchar(QemuConsole *s, int ch)
}
static void displaychangelistener_display_console(DisplayChangeListener *dcl,
- QemuConsole *con)
+ QemuConsole *con,
+ Error **errp)
{
static const char nodev[] =
"This VM has no graphic display device.";
static DisplaySurface *dummy;
- if (!con) {
+ if (!con || !console_compatible_with(con, dcl, errp)) {
if (!dcl->ops->dpy_gfx_switch) {
return;
}
@@ -1114,7 +1117,7 @@ void console_select(unsigned int index)
if (dcl->con != NULL) {
continue;
}
- displaychangelistener_display_console(dcl, s);
+ displaychangelistener_display_console(dcl, s, NULL);
}
}
if (ds->have_text) {
@@ -1475,8 +1478,8 @@ static bool
displaychangelistener_has_dmabuf(DisplayChangeListener *dcl)
return false;
}
-static bool dpy_compatible_with(QemuConsole *con,
- DisplayChangeListener *dcl, Error **errp)
+static bool console_compatible_with(QemuConsole *con,
+ DisplayChangeListener *dcl, Error **errp)
{
int flags;
@@ -1522,10 +1525,6 @@ void
register_displaychangelistener(DisplayChangeListener *dcl)
assert(!dcl->ds);
- if (dcl->con) {
- dpy_compatible_with(dcl->con, dcl, &error_fatal);
- }
-
trace_displaychangelistener_register(dcl, dcl->ops->dpy_name);
dcl->ds = get_alloc_displaystate();
QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next);
@@ -1536,7 +1535,7 @@ void register_displaychangelistener(DisplayChangeListener
*dcl)
} else {
con = active_console;
}
- displaychangelistener_display_console(dcl, con);
+ displaychangelistener_display_console(dcl, con, dcl->con ? &error_fatal :
NULL);
text_console_update_cursor(NULL);
}
--
2.35.1.273.ge6ebfd0e8cbb
- [PATCH v3 00/12] GL & D-Bus display related fixes, marcandre . lureau, 2022/03/07
- [PATCH v3 01/12] ui/console: move check for compatible GL context, marcandre . lureau, 2022/03/07
- [PATCH v3 02/12] ui/console: move dcl compatiblity check to a callback, marcandre . lureau, 2022/03/07
- [PATCH v3 03/12] ui/console: egl-headless is compatible with non-gl listeners, marcandre . lureau, 2022/03/07
- [PATCH v3 04/12] ui/dbus: associate the DBusDisplayConsole listener with the given console, marcandre . lureau, 2022/03/07
- [PATCH v3 05/12] ui/console: move console compatibility check to dcl_display_console(),
marcandre . lureau <=
- [PATCH v3 06/12] ui/shader: fix potential leak of shader on error, marcandre . lureau, 2022/03/07
- [PATCH v3 07/12] ui/shader: free associated programs, marcandre . lureau, 2022/03/07
- [PATCH v3 08/12] ui/console: add a dpy_gfx_switch callback helper, marcandre . lureau, 2022/03/07
- [PATCH v3 09/12] ui/console: optionally update after gfx switch, marcandre . lureau, 2022/03/07
- [PATCH v3 10/12] ui/dbus: fix texture sharing, marcandre . lureau, 2022/03/07
- [PATCH v3 11/12] ui/dbus: do not send 2d scanout until gfx_update, marcandre . lureau, 2022/03/07
- [PATCH v3 12/12] ui/console: call gfx_switch() even if the current scanout is GL, marcandre . lureau, 2022/03/07