[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/27] ui: factor out qemu_console_set_display_gl_ctx()
From: |
marcandre . lureau |
Subject: |
[PATCH 05/27] ui: factor out qemu_console_set_display_gl_ctx() |
Date: |
Fri, 12 Mar 2021 14:00:46 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
The next patch will make use of this function to dissociate
DisplayChangeListener from GL context.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/ui/console.h | 2 ++
ui/console.c | 21 +++++++++++++--------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index c960b7066c..9391fb052b 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -413,6 +413,8 @@ 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 bab32723b5..83475bd8c3 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1502,6 +1502,18 @@ 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[] =
@@ -1513,14 +1525,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 && !dpy_compatible_with(dcl->con, dcl, &err)) {
--
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 <=
- [PATCH 06/27] ui: associate GL context outside of display listener registration, marcandre . lureau, 2021/03/12
- [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