aboutsummaryrefslogtreecommitdiff
path: root/ui/spice-app.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2020-10-14 14:11:17 +0200
committerGerd Hoffmann <kraxel@redhat.com>2020-10-15 11:14:40 +0200
commit93ab5844b2cd5367966d7b5bae154e0d3303b504 (patch)
treefdc01b73d9999cb0970d77105fd24a44b25efceb /ui/spice-app.c
parent70122d62302c97bcd205956a544b8e79f2a4a50f (diff)
chardev/spice: simplify chardev setup
Initialize spice before chardevs. That allows to register the spice chardevs directly in the init function and removes the need to maintain a linked list of chardevs just for registration. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201014121120.13482-5-kraxel@redhat.com
Diffstat (limited to 'ui/spice-app.c')
-rw-r--r--ui/spice-app.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/ui/spice-app.c b/ui/spice-app.c
index 7e0550c79f..026124ef56 100644
--- a/ui/spice-app.c
+++ b/ui/spice-app.c
@@ -129,7 +129,6 @@ static void spice_app_atexit(void)
static void spice_app_display_early_init(DisplayOptions *opts)
{
QemuOpts *qopts;
- ChardevBackend *be = chr_spice_backend_new();
GError *err = NULL;
if (opts->has_full_screen) {
@@ -174,6 +173,15 @@ static void spice_app_display_early_init(DisplayOptions *opts)
qemu_opt_set(qopts, "gl", opts->has_gl ? "on" : "off", &error_abort);
display_opengl = opts->has_gl;
#endif
+}
+
+static void spice_app_display_init(DisplayState *ds, DisplayOptions *opts)
+{
+ ChardevBackend *be = chr_spice_backend_new();
+ QemuOpts *qopts;
+ GError *err = NULL;
+ gchar *uri;
+
be->u.spiceport.data->fqdn = g_strdup("org.qemu.monitor.qmp.0");
qemu_chardev_new("org.qemu.monitor.qmp", TYPE_CHARDEV_SPICEPORT,
be, NULL, &error_abort);
@@ -183,13 +191,6 @@ static void spice_app_display_early_init(DisplayOptions *opts)
qemu_opt_set(qopts, "mode", "control", &error_abort);
qapi_free_ChardevBackend(be);
-}
-
-static void spice_app_display_init(DisplayState *ds, DisplayOptions *opts)
-{
- GError *err = NULL;
- gchar *uri;
-
uri = g_strjoin("", "spice+unix://", app_dir, "/", "spice.sock", NULL);
info_report("Launching display with URI: %s", uri);
g_app_info_launch_default_for_uri(uri, NULL, &err);