From: Marc-André Lureau <marcandre.lur...@redhat.com> The next patch will make use of this function to dissociate DisplayChangeListener from GL context.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- include/ui/console.h | 3 +++ ui/console.c | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 7b2f624e93..1617b4c59a 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -406,6 +406,9 @@ void graphic_hw_gl_flushed(QemuConsole *con); void qemu_console_early_init(void); +void qemu_console_set_display_gl_ctx(QemuConsole *con, + DisplayChangeListener *dcl); + QemuConsole *qemu_console_lookup_by_index(unsigned int index); QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head); QemuConsole *qemu_console_lookup_by_device_name(const char *device_id, diff --git a/ui/console.c b/ui/console.c index 7eea1fc641..64f35e163c 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1501,6 +1501,19 @@ static bool dpy_compatible_with(QemuConsole *con, return true; } +void qemu_console_set_display_gl_ctx(QemuConsole *con, + DisplayChangeListener *dcl) +{ + /* display has opengl support */ + assert(dcl->con); + if (dcl->con->gl) { + fprintf(stderr, "can't register two opengl displays (%s, %s)\n", + dcl->ops->dpy_name, dcl->con->gl->ops->dpy_name); + exit(1); + } + dcl->con->gl = dcl; +} + void register_displaychangelistener(DisplayChangeListener *dcl) { static const char nodev[] = @@ -1511,14 +1524,7 @@ void register_displaychangelistener(DisplayChangeListener *dcl) assert(!dcl->ds); if (dcl->ops->dpy_gl_ctx_create) { - /* display has opengl support */ - assert(dcl->con); - if (dcl->con->gl) { - fprintf(stderr, "can't register two opengl displays (%s, %s)\n", - dcl->ops->dpy_name, dcl->con->gl->ops->dpy_name); - exit(1); - } - dcl->con->gl = dcl; + qemu_console_set_display_gl_ctx(dcl->con, dcl); } if (dcl->con) { -- 2.33.0.721.g106298f7f9