aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-08-30 13:37:57 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-09-04 13:48:31 +0400
commitf9411aaebd99e1efb04f0d32f01b37467e43b6a0 (patch)
treeac4d9089567f5fca5b1aa411720ca25856ae6112 /ui
parent34b7751574ebac7e19bfdb3ed0f91550c5ed171b (diff)
downloadqemu-f9411aaebd99e1efb04f0d32f01b37467e43b6a0.zip
qemu-f9411aaebd99e1efb04f0d32f01b37467e43b6a0.tar.gz
qemu-f9411aaebd99e1efb04f0d32f01b37467e43b6a0.tar.bz2
ui/console: specialize console_lookup_unused()
graphics_console_init() is expected to return a graphic console. The function doesn't need to be exported. We are going to specialize further QemuGraphicConsole & QemuTextConsole. The two will not be interchangeable anymore. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-24-marcandre.lureau@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/console.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ui/console.c b/ui/console.c
index e0e4f98..08bed58 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -196,6 +196,7 @@ static void text_console_update_cursor(void *opaque);
static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl);
static bool console_compatible_with(QemuConsole *con,
DisplayChangeListener *dcl, Error **errp);
+static QemuConsole *qemu_graphic_console_lookup_unused(void);
static void gui_update(void *opaque)
{
@@ -2184,7 +2185,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
QemuConsole *s;
DisplaySurface *surface;
- s = qemu_console_lookup_unused();
+ s = qemu_graphic_console_lookup_unused();
if (s) {
trace_console_gfx_reuse(s->index);
width = qemu_console_get_width(s, 0);
@@ -2289,13 +2290,13 @@ QemuConsole *qemu_console_lookup_by_device_name(const char *device_id,
return con;
}
-QemuConsole *qemu_console_lookup_unused(void)
+static QemuConsole *qemu_graphic_console_lookup_unused(void)
{
QemuConsole *con;
Object *obj;
QTAILQ_FOREACH(con, &consoles, next) {
- if (con->hw_ops != &unused_ops) {
+ if (!QEMU_IS_GRAPHIC_CONSOLE(con) || con->hw_ops != &unused_ops) {
continue;
}
obj = object_property_get_link(OBJECT(con),