mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
ui: associate GL context outside of display listener registration
Consoles can have an associated GL context, without listeners (they may be added or removed later on). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
4f41814991
commit
ac32b2fff1
5 changed files with 15 additions and 2 deletions
|
@ -1465,8 +1465,11 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
|
||||||
|
|
||||||
assert(!dcl->ds);
|
assert(!dcl->ds);
|
||||||
|
|
||||||
if (dcl->ops->dpy_gl_ctx_create) {
|
if (dcl->con && dcl->con->gl &&
|
||||||
qemu_console_set_display_gl_ctx(dcl->con, dcl);
|
dcl->con->gl != dcl) {
|
||||||
|
error_report("Display %s is incompatible with the GL context",
|
||||||
|
dcl->ops->dpy_name);
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dcl->con) {
|
if (dcl->con) {
|
||||||
|
|
|
@ -197,6 +197,7 @@ static void egl_headless_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
edpy->dcl.con = con;
|
edpy->dcl.con = con;
|
||||||
edpy->dcl.ops = &egl_ops;
|
edpy->dcl.ops = &egl_ops;
|
||||||
edpy->gls = qemu_gl_init_shader();
|
edpy->gls = qemu_gl_init_shader();
|
||||||
|
qemu_console_set_display_gl_ctx(con, &edpy->dcl);
|
||||||
register_displaychangelistener(&edpy->dcl);
|
register_displaychangelistener(&edpy->dcl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3
ui/gtk.c
3
ui/gtk.c
|
@ -2083,6 +2083,9 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||||
vc->gfx.kbd = qkbd_state_init(con);
|
vc->gfx.kbd = qkbd_state_init(con);
|
||||||
vc->gfx.dcl.con = con;
|
vc->gfx.dcl.con = con;
|
||||||
|
|
||||||
|
if (display_opengl) {
|
||||||
|
qemu_console_set_display_gl_ctx(con, &vc->gfx.dcl);
|
||||||
|
}
|
||||||
register_displaychangelistener(&vc->gfx.dcl);
|
register_displaychangelistener(&vc->gfx.dcl);
|
||||||
|
|
||||||
gd_connect_vc_gfx_signals(vc);
|
gd_connect_vc_gfx_signals(vc);
|
||||||
|
|
|
@ -866,6 +866,9 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
|
||||||
#endif
|
#endif
|
||||||
sdl2_console[i].dcl.con = con;
|
sdl2_console[i].dcl.con = con;
|
||||||
sdl2_console[i].kbd = qkbd_state_init(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);
|
register_displaychangelistener(&sdl2_console[i].dcl);
|
||||||
|
|
||||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_X11)
|
#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_X11)
|
||||||
|
|
|
@ -1156,6 +1156,9 @@ static void qemu_spice_display_init_one(QemuConsole *con)
|
||||||
|
|
||||||
qemu_spice_create_host_memslot(ssd);
|
qemu_spice_create_host_memslot(ssd);
|
||||||
|
|
||||||
|
if (spice_opengl) {
|
||||||
|
qemu_console_set_display_gl_ctx(con, &ssd->dcl);
|
||||||
|
}
|
||||||
register_displaychangelistener(&ssd->dcl);
|
register_displaychangelistener(&ssd->dcl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue