[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/12] ui/console: move check for compatible GL context
From: |
marcandre . lureau |
Subject: |
[PATCH v2 04/12] ui/console: move check for compatible GL context |
Date: |
Thu, 17 Feb 2022 15:58:21 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Move GL context compatibility check in dpy_compatible_with(), and use
recommended error reporting.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
ui/console.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index 365a2c14b809..57e431d9e609 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1482,6 +1482,12 @@ static bool dpy_compatible_with(QemuConsole *con,
flags = con->hw_ops->get_flags ? con->hw_ops->get_flags(con->hw) : 0;
+ if (console_has_gl(con) && con->gl->ops->compatible_dcl != dcl->ops) {
+ error_setg(errp, "Display %s is incompatible with the GL context",
+ dcl->ops->dpy_name);
+ return false;
+ }
+
if (flags & GRAPHIC_FLAGS_GL &&
!console_has_gl(con)) {
error_setg(errp, "The console requires a GL context.");
@@ -1509,27 +1515,12 @@ void qemu_console_set_display_gl_ctx(QemuConsole *con,
DisplayGLCtx *gl)
con->gl = gl;
}
-static bool dpy_gl_compatible_with(QemuConsole *con, DisplayChangeListener
*dcl)
-{
- if (!con->gl) {
- return true;
- }
-
- return con->gl->ops->compatible_dcl == dcl->ops;
-}
-
void register_displaychangelistener(DisplayChangeListener *dcl)
{
QemuConsole *con;
assert(!dcl->ds);
- if (dcl->con && !dpy_gl_compatible_with(dcl->con, dcl)) {
- error_report("Display %s is incompatible with the GL context",
- dcl->ops->dpy_name);
- exit(1);
- }
-
if (dcl->con) {
dpy_compatible_with(dcl->con, dcl, &error_fatal);
}
--
2.34.1.428.gdcc0cd074f0c
- [PATCH v2 00/12] GL & D-Bus display related fixes, marcandre . lureau, 2022/02/17
- [PATCH v2 01/12] ui/console: fix crash when using gl context with non-gl listeners, marcandre . lureau, 2022/02/17
- [PATCH v2 02/12] ui/console: fix texture leak when calling surface_gl_create_texture(), marcandre . lureau, 2022/02/17
- [PATCH v2 03/12] ui: do not create a surface when resizing a GL scanout, marcandre . lureau, 2022/02/17
- [PATCH v2 04/12] ui/console: move check for compatible GL context,
marcandre . lureau <=
- [PATCH v2 05/12] ui/console: move dcl compatiblity check to a callback, marcandre . lureau, 2022/02/17
- [PATCH v2 06/12] ui/console: egl-headless is compatible with non-gl listeners, marcandre . lureau, 2022/02/17
- [PATCH v2 07/12] ui/dbus: associate the DBusDisplayConsole listener with the given console, marcandre . lureau, 2022/02/17
- [PATCH v2 08/12] ui/console: move console compatibility check to dcl_display_console(), marcandre . lureau, 2022/02/17
- [PATCH v2 09/12] ui/shader: fix potential leak of shader on error, marcandre . lureau, 2022/02/17
- [PATCH v2 10/12] ui/shader: free associated programs, marcandre . lureau, 2022/02/17
- [PATCH v2 11/12] ui/console: add a dpy_gfx_switch callback helper, marcandre . lureau, 2022/02/17
- [PATCH v2 12/12] ui/dbus: fix texture sharing, marcandre . lureau, 2022/02/17
- Re: [PATCH v2 00/12] GL & D-Bus display related fixes, Akihiko Odaki, 2022/02/17