aboutsummaryrefslogtreecommitdiff
path: root/ui
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
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')
-rw-r--r--ui/spice-app.c17
-rw-r--r--ui/spice-core.c2
2 files changed, 9 insertions, 10 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);
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 10aa309f78..47700b2200 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -812,8 +812,6 @@ void qemu_spice_init(void)
g_free(x509_cert_file);
g_free(x509_cacert_file);
- qemu_spice_register_ports();
-
#ifdef HAVE_SPICE_GL
if (qemu_opt_get_bool(opts, "gl", 0)) {
if ((port != 0) || (tls_port != 0)) {