[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/27] ui: associate GL context outside of display listener regis
From: |
marcandre . lureau |
Subject: |
[PATCH 06/27] ui: associate GL context outside of display listener registration |
Date: |
Fri, 12 Mar 2021 14:00:47 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
ui/console.c | 7 +++++--
ui/egl-headless.c | 1 +
ui/gtk.c | 3 +++
ui/sdl2.c | 3 +++
ui/spice-display.c | 3 +++
5 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index 83475bd8c3..53eba2019e 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1524,8 +1524,11 @@ void
register_displaychangelistener(DisplayChangeListener *dcl)
assert(!dcl->ds);
- if (dcl->ops->dpy_gl_ctx_create) {
- qemu_console_set_display_gl_ctx(dcl->con, dcl);
+ if (dcl->con && dcl->con->gl &&
+ dcl->con->gl != 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, &err)) {
diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index da377a74af..773520bc17 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -197,6 +197,7 @@ static void egl_headless_init(DisplayState *ds,
DisplayOptions *opts)
edpy->dcl.con = con;
edpy->dcl.ops = &egl_ops;
edpy->gls = qemu_gl_init_shader();
+ qemu_console_set_display_gl_ctx(con, &edpy->dcl);
register_displaychangelistener(&edpy->dcl);
}
}
diff --git a/ui/gtk.c b/ui/gtk.c
index 3edaf041de..d8b3784bf0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -2082,6 +2082,9 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s,
VirtualConsole *vc,
vc->gfx.kbd = qkbd_state_init(con);
vc->gfx.dcl.con = con;
+ if (display_opengl) {
+ qemu_console_set_display_gl_ctx(con, &vc->gfx.dcl);
+ }
register_displaychangelistener(&vc->gfx.dcl);
gd_connect_vc_gfx_signals(vc);
diff --git a/ui/sdl2.c b/ui/sdl2.c
index a203cb0239..0593a333f5 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -863,6 +863,9 @@ static void sdl2_display_init(DisplayState *ds,
DisplayOptions *o)
#endif
sdl2_console[i].dcl.con = con;
sdl2_console[i].kbd = qkbd_state_init(con);
+ if (display_opengl) {
+ qemu_console_set_display_gl_ctx(con, &sdl2_console[i].dcl);
+ }
register_displaychangelistener(&sdl2_console[i].dcl);
#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_X11)
diff --git a/ui/spice-display.c b/ui/spice-display.c
index d22781a23d..f637fd1bc6 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -1152,6 +1152,9 @@ static void qemu_spice_display_init_one(QemuConsole *con)
qemu_spice_create_host_memslot(ssd);
+ if (spice_opengl) {
+ qemu_console_set_display_gl_ctx(con, &ssd->dcl);
+ }
register_displaychangelistener(&ssd->dcl);
}
--
2.29.0
- [PATCH 00/27] Add D-Bus display backend, marcandre . lureau, 2021/03/12
- [PATCH 01/27] ui: fold qemu_alloc_display in only caller, marcandre . lureau, 2021/03/12
- [PATCH 02/27] vhost-user-gpu: glFlush before notifying clients, marcandre . lureau, 2021/03/12
- [PATCH 03/27] vhost-user-gpu: fix vugbm_device_init fallback, marcandre . lureau, 2021/03/12
- [PATCH 04/27] vhost-user-gpu: fix cursor move/update, marcandre . lureau, 2021/03/12
- [PATCH 05/27] ui: factor out qemu_console_set_display_gl_ctx(), marcandre . lureau, 2021/03/12
- [PATCH 06/27] ui: associate GL context outside of display listener registration,
marcandre . lureau <=
- [PATCH 07/27] ui: make gl_block use a counter, marcandre . lureau, 2021/03/12
- [PATCH 08/27] ui: add a gl-unblock warning timer, marcandre . lureau, 2021/03/12
- [PATCH 09/27] ui: simplify gl unblock & flush, marcandre . lureau, 2021/03/12
- [PATCH 10/27] ui: dispatch GL events to all listeners, marcandre . lureau, 2021/03/12
- [PATCH 11/27] ui: split the GL context in a different object, marcandre . lureau, 2021/03/12
- [PATCH 12/27] ui: move qemu_spice_fill_device_address to ui/util.c, marcandre . lureau, 2021/03/12
- [PATCH 13/27] console: save current scanout details, marcandre . lureau, 2021/03/12
- [PATCH 14/27] ui: add a D-Bus display backend, marcandre . lureau, 2021/03/12