Looking at chardev/spice.c code, I realize compilation was broken for
a while with spice-server < 0.12.3. I propose to bump required version
to 0.12.6, released 3y ago, instead of adding more #ifdef.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/display/qxl.h | 2 --
include/ui/qemu-spice.h | 9 ---------
chardev/spice.c | 12 ------------
hw/display/qxl.c | 8 --------
ui/spice-core.c | 8 --------
configure | 4 ++--
6 files changed, 2 insertions(+), 41 deletions(-)
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index 089696ef62..e4afab8c3a 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -100,9 +100,7 @@ typedef struct PCIQXLDevice {
QXLModes *modes;
uint32_t rom_size;
MemoryRegion rom_bar;
-#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */
uint16_t max_outputs;
-#endif
/* vram pci bar */
uint64_t vram_size;
diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h
index c6d50eb87a..f3e17612b1 100644
--- a/include/ui/qemu-spice.h
+++ b/include/ui/qemu-spice.h
@@ -41,18 +41,9 @@ int qemu_spice_set_pw_expire(time_t expires);
int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
const char *subject);
-#if !defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06)
-#define SPICE_NEEDS_SET_MM_TIME 1
-#else
#define SPICE_NEEDS_SET_MM_TIME 0
-#endif
-#if SPICE_SERVER_VERSION >= 0x000c02
void qemu_spice_register_ports(void);
-#else
-static inline Chardev *qemu_chr_open_spice_port(const char *name)
-{ return NULL; }
-#endif
#else /* CONFIG_SPICE */
diff --git a/chardev/spice.c b/chardev/spice.c
index 6ad95ffe62..4d4bafe34e 100644
--- a/chardev/spice.c
+++ b/chardev/spice.c
@@ -77,7 +77,6 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
return bytes;
}
-#if SPICE_SERVER_VERSION >= 0x000c02
static void vmc_event(SpiceCharDeviceInstance *sin, uint8_t event)
{
SpiceChardev *scd = container_of(sin, SpiceChardev, sin);
@@ -95,7 +94,6 @@ static void vmc_event(SpiceCharDeviceInstance *sin, uint8_t event)
trace_spice_vmc_event(chr_event);
qemu_chr_be_event(chr, chr_event);
}
-#endif
static void vmc_state(SpiceCharDeviceInstance *sin, int connected)
{
@@ -119,12 +117,8 @@ static SpiceCharDeviceInterface vmc_interface = {
.state = vmc_state,
.write = vmc_write,
.read = vmc_read,
-#if SPICE_SERVER_VERSION >= 0x000c02
.event = vmc_event,
-#endif
-#if SPICE_SERVER_VERSION >= 0x000c06
.flags = SPICE_CHAR_DEVICE_NOTIFY_WRITABLE,
-#endif
};
@@ -242,9 +236,7 @@ static void char_spice_finalize(Object *obj)
}
g_free((char *)s->sin.subtype);
-#if SPICE_SERVER_VERSION >= 0x000c02
g_free((char *)s->sin.portname);
-#endif
}
static void spice_vmc_set_fe_open(struct Chardev *chr, int fe_open)
@@ -259,7 +251,6 @@ static void spice_vmc_set_fe_open(struct Chardev *chr, int fe_open)
static void spice_port_set_fe_open(struct Chardev *chr, int fe_open)
{
-#if SPICE_SERVER_VERSION >= 0x000c02
SpiceChardev *s = SPICE_CHARDEV(chr);
if (fe_open) {
@@ -267,7 +258,6 @@ static void spice_port_set_fe_open(struct Chardev *chr, int fe_open)
} else {
spice_server_port_event(&s->sin, SPICE_PORT_EVENT_CLOSED);
}
-#endif
}
static void spice_chr_accept_input(struct Chardev *chr)
@@ -317,7 +307,6 @@ static void qemu_chr_open_spice_vmc(Chardev *chr,
chr_open(chr, type);
}
-#if SPICE_SERVER_VERSION >= 0x000c02
static void qemu_chr_open_spice_port(Chardev *chr,
ChardevBackend *backend,
bool *be_opened,
@@ -350,7 +339,6 @@ void qemu_spice_register_ports(void)
vmc_register_interface(s);
}
}
-#endif
static void qemu_chr_parse_spice_vmc(QemuOpts *opts, ChardevBackend *backend,
Error **errp)
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 830c392c53..cdd884984d 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -274,11 +274,9 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay)
QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG,
0));
} else {
-#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */
if (qxl->max_outputs) {
spice_qxl_set_max_monitors(&qxl->ssd.qxl, qxl->max_outputs);
}
-#endif
qxl->guest_monitors_config = qxl->ram->monitors_config;
spice_qxl_monitors_config_async(&qxl->ssd.qxl,
qxl->ram->monitors_config,
@@ -1094,12 +1092,10 @@ static int interface_client_monitors_config(QXLInstance *sin,
return 1;
}
-#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */
/* limit number of outputs based on setting limit */
if (qxl->max_outputs && qxl->max_outputs <= max_outputs) {
max_outputs = qxl->max_outputs;
}
-#endif
config_changed = qxl_rom_monitors_config_changed(rom,
monitors_config,
@@ -1177,9 +1173,7 @@ static void qxl_enter_vga_mode(PCIQXLDevice *d)
return;
}
trace_qxl_enter_vga_mode(d->id);
-#if SPICE_SERVER_VERSION >= 0x000c03 /* release 0.12.3 */
spice_qxl_driver_unload(&d->ssd.qxl);
-#endif
graphic_console_set_hwops(d->ssd.dcl.con, d->vga.hw_ops, &d->vga);
update_displaychangelistener(&d->ssd.dcl, GUI_REFRESH_INTERVAL_DEFAULT);
qemu_spice_create_host_primary(&d->ssd);
@@ -2403,9 +2397,7 @@ static Property qxl_properties[] = {
DEFINE_PROP_UINT32("vram64_size_mb", PCIQXLDevice, vram_size_mb, -1),
DEFINE_PROP_UINT32("vgamem_mb", PCIQXLDevice, vgamem_size_mb, 16),
DEFINE_PROP_INT32("surfaces", PCIQXLDevice, ssd.num_surfaces, 1024),
-#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */
DEFINE_PROP_UINT16("max_outputs", PCIQXLDevice, max_outputs, 0),
-#endif
DEFINE_PROP_UINT32("xres", PCIQXLDevice, xres, 0),
DEFINE_PROP_UINT32("yres", PCIQXLDevice, yres, 0),
DEFINE_PROP_BOOL("global-vmstate", PCIQXLDevice, vga.global_vmstate, false),
diff --git a/ui/spice-core.c b/ui/spice-core.c
index f8c0878529..76896f7c7a 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -746,13 +746,7 @@ void qemu_spice_init(void)
}
if (qemu_opt_get_bool(opts, "disable-agent-file-xfer", 0)) {
-#if SPICE_SERVER_VERSION >= 0x000c04
spice_server_set_agent_file_xfer(spice_server, false);
-#else
- error_report("this qemu build does not support the "
- "\"disable-agent-file-xfer\" option");
- exit(1);
-#endif
}
compression = SPICE_IMAGE_COMPRESS_AUTO_GLZ;
@@ -818,9 +812,7 @@ void qemu_spice_init(void)
g_free(x509_cert_file);
g_free(x509_cacert_file);
-#if SPICE_SERVER_VERSION >= 0x000c02
qemu_spice_register_ports();
-#endif
#ifdef HAVE_SPICE_GL
if (qemu_opt_get_bool(opts, "gl", 0)) {
diff --git a/configure b/configure
index 8280ae7a8a..8a1371c55c 100755
--- a/configure
+++ b/configure
@@ -4521,7 +4521,7 @@ int main(void) { spice_server_new(); return 0; }
EOF
spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
- if $pkg_config --atleast-version=0.12.0 spice-server && \
+ if $pkg_config --atleast-version=0.12.6 spice-server && \
$pkg_config --atleast-version=0.12.3 spice-protocol && \
compile_prog "$spice_cflags" "$spice_libs" ; then
spice="yes"
@@ -4532,7 +4532,7 @@ EOF
else
if test "$spice" = "yes" ; then
feature_not_found "spice" \
- "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
+ "Install spice-server(>=0.12.6) and spice-protocol(>=0.12.3) devel"
fi
spice="no"
fi
--
2.18.0.547.g1d89318c48
On 08/03/2018 12:36 PM, Marc-André Lureau wrote: > Looking at chardev/spice.c code, I realize compilation was broken for > a while with spice-server < 0.12.3. I propose to bump required version > to 0.12.6, released 3y ago, instead of adding more #ifdef. Can you please also investigate which version is shipping in various distros? Look at commit e7b3af81 for a good example of justifying a minimum version bump, by calling out the versions in use according to the supported platforms doc. > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
On Fri, Aug 03, 2018 at 07:36:07PM +0200, Marc-André Lureau wrote:
> Looking at chardev/spice.c code, I realize compilation was broken for
> a while with spice-server < 0.12.3. I propose to bump required version
> to 0.12.6, released 3y ago, instead of adding more #ifdef.
Since we introduced our platform support policy[1], it is desired that
any min version changes consider what versions our target OS have
available. eg take a look at this commit message example:
https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03796.html
could you use repology[2] to do the same for spice to validate that
this proposed min version is compatible with distros we target.
Regards,
Daniel
[1] https://qemu.weilnetz.de/doc/qemu-doc.html#Supported-build-platforms
[2] https://repology.org/metapackage/spice/versions
https://repology.org/metapackage/spice-server/versions
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
© 2016 - 2025 Red Hat, Inc.