aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-10-15 22:20:46 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-10-15 22:20:46 +0100
commit6214addcc6b6bf6b444934833144bab10cbe6a1a (patch)
treed3a67d95fcede1ef6c14ba6cb0f0624ad258ecc9 /ui
parent3e40748834923798aa57e3751db13a069e2c617b (diff)
parent23ebeaae4eb09a0d92dc7f22b41e5dd08485c390 (diff)
Merge remote-tracking branch 'remotes/kraxel/tags/modules-20201015-pull-request' into staging
modules: misc fixes & tweaks. modules: build spice chardevs as module. # gpg: Signature made Thu 15 Oct 2020 13:53:03 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/modules-20201015-pull-request: chardev/spice: build spice chardevs as module meson: add spice dependency to core spice source files. meson: add spice_headers dependency. chardev/spice: simplify chardev setup chardev/spice: make qemu_chr_open_spice_port static ui/spice-app: don't use qemu_chr_open_spice_port directly modules: update qom object module comment module: silence errors for module_load_qom_all(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/meson.build2
-rw-r--r--ui/spice-app.c34
-rw-r--r--ui/spice-core.c2
3 files changed, 23 insertions, 15 deletions
diff --git a/ui/meson.build b/ui/meson.build
index 78ad792ffb..6ce8148678 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -14,7 +14,7 @@ softmmu_ss.add(files(
))
softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('input-linux.c'))
-softmmu_ss.add(when: 'CONFIG_SPICE', if_true: files('spice-core.c', 'spice-input.c', 'spice-display.c'))
+softmmu_ss.add(when: [spice, 'CONFIG_SPICE'], if_true: files('spice-core.c', 'spice-input.c', 'spice-display.c'))
softmmu_ss.add(when: cocoa, if_true: files('cocoa.m'))
vnc_ss = ss.source_set()
diff --git a/ui/spice-app.c b/ui/spice-app.c
index 93e105c6ee..026124ef56 100644
--- a/ui/spice-app.c
+++ b/ui/spice-app.c
@@ -44,11 +44,15 @@ static char *sock_path;
struct VCChardev {
SpiceChardev parent;
};
-typedef struct VCChardev VCChardev;
+
+struct VCChardevClass {
+ ChardevClass parent;
+ void (*parent_open)(Chardev *chr, ChardevBackend *backend,
+ bool *be_opened, Error **errp);
+};
#define TYPE_CHARDEV_VC "chardev-vc"
-DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV,
- TYPE_CHARDEV_VC)
+OBJECT_DECLARE_TYPE(VCChardev, VCChardevClass, CHARDEV_VC)
static ChardevBackend *
chr_spice_backend_new(void)
@@ -66,6 +70,7 @@ static void vc_chr_open(Chardev *chr,
bool *be_opened,
Error **errp)
{
+ VCChardevClass *vc = CHARDEV_VC_GET_CLASS(chr);
ChardevBackend *be;
const char *fqdn = NULL;
@@ -80,7 +85,7 @@ static void vc_chr_open(Chardev *chr,
be = chr_spice_backend_new();
be->u.spiceport.data->fqdn = fqdn ?
g_strdup(fqdn) : g_strdup_printf("org.qemu.console.%s", chr->label);
- qemu_chr_open_spice_port(chr, be, be_opened, errp);
+ vc->parent_open(chr, be, be_opened, errp);
qapi_free_ChardevBackend(be);
}
@@ -91,8 +96,11 @@ static void vc_chr_set_echo(Chardev *chr, bool echo)
static void char_vc_class_init(ObjectClass *oc, void *data)
{
+ VCChardevClass *vc = CHARDEV_VC_CLASS(oc);
ChardevClass *cc = CHARDEV_CLASS(oc);
+ vc->parent_open = cc->open;
+
cc->parse = qemu_chr_parse_vc;
cc->open = vc_chr_open;
cc->chr_set_echo = vc_chr_set_echo;
@@ -103,6 +111,7 @@ static const TypeInfo char_vc_type_info = {
.parent = TYPE_CHARDEV_SPICEPORT,
.instance_size = sizeof(VCChardev),
.class_init = char_vc_class_init,
+ .class_size = sizeof(VCChardevClass),
};
static void spice_app_atexit(void)
@@ -120,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) {
@@ -165,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);
@@ -174,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)) {