[Spice-commits] Branch 'spice.v17' - 9 commits - hw/qxl-render.c hw/qxl.c qemu-config.c qemu-options.hx ui/spice-core.c vl.c
Gerd Hoffmann
kraxel at kemper.freedesktop.org
Mon Aug 30 05:23:54 PDT 2010
hw/qxl-render.c | 14 ++++++++------
hw/qxl.c | 32 ++++++++++++++++++++++++++++----
qemu-config.c | 15 +++++++++++++++
qemu-options.hx | 15 +++++++++++++++
ui/spice-core.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
vl.c | 3 ++-
6 files changed, 118 insertions(+), 13 deletions(-)
New commits:
commit ab7334655154ee3fd063f5f3c99abead8de6ef59
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Mon Aug 30 14:05:27 2010 +0200
qxl: support screendump in native mode
diff --git a/hw/qxl.c b/hw/qxl.c
index e8ad800..0a77d8f 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1085,9 +1085,17 @@ static void qxl_hw_screen_dump(void *opaque, const char *filename)
PCIQXLDevice *qxl = opaque;
VGACommonState *vga = &qxl->vga;
- if (qxl->mode == QXL_MODE_VGA) {
+ switch (qxl->mode) {
+ case QXL_MODE_COMPAT:
+ case QXL_MODE_NATIVE:
+ qxl_render_update(qxl);
+ ppm_save(filename, qxl->ssd.ds->surface);
+ break;
+ case QXL_MODE_VGA:
vga->screen_dump(vga, filename);
- return;
+ break;
+ default:
+ break;
}
}
commit 7cf93c6d59b1b7c83b424fb9b29181686873e342
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Mon Aug 30 13:52:02 2010 +0200
spice: allow qxl being used with vnc/sdl enabled and spice disabled.
diff --git a/ui/spice-core.c b/ui/spice-core.c
index a0b6a8c..d013700 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -420,6 +420,21 @@ void qemu_spice_init(void)
int qemu_spice_add_interface(SpiceBaseInstance *sin)
{
+ if (!spice_server) {
+ if (QTAILQ_FIRST(&qemu_spice_opts.head) != NULL) {
+ fprintf(stderr, "Oops: spice configured but not active\n");
+ exit(1);
+ }
+ /*
+ * Create a spice server instance.
+ * It does *not* listen on the network.
+ * It handles QXL local rendering only.
+ *
+ * With a command line like '-vnc :0 -vga qxl' you'll end up here.
+ */
+ spice_server = spice_server_new();
+ spice_server_init(spice_server, &core_interface);
+ }
return spice_server_add_interface(spice_server, sin);
}
commit 2f27851381c9dbaecb9ee981389bc2d8af825ff9
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Mon Aug 30 13:32:18 2010 +0200
qxl: cursor fixes
Don't call displaysstate callbacks unlocked.
Make cursor debug logging runtime-switchable.
diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index 1ad78b0..3fa0c90 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -174,13 +174,11 @@ void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
!qxl->ssd.ds->cursor_define)
return;
-#if 1
- if (cmd->type != QXL_CURSOR_MOVE) {
+ if (qxl->debug && cmd->type != QXL_CURSOR_MOVE) {
fprintf(stderr, "%s", __FUNCTION__);
qxl_log_cmd_cursor(qxl, cmd, ext->group_id);
fprintf(stderr, "\n");
}
-#endif
switch (cmd->type) {
case QXL_CURSOR_SET:
x = cmd->u.set.position.x;
@@ -194,15 +192,18 @@ void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
if (c == NULL) {
c = cursor_builtin_left_ptr();
}
+ qemu_mutex_lock_iothread();
qxl->ssd.ds->cursor_define(c);
+ qxl->ssd.ds->mouse_set(x, y, 1);
+ qemu_mutex_unlock_iothread();
cursor_put(c);
break;
case QXL_CURSOR_MOVE:
x = cmd->u.position.x;
y = cmd->u.position.y;
- break;
- }
- if (x != -1 && y != -1) {
+ qemu_mutex_lock_iothread();
qxl->ssd.ds->mouse_set(x, y, 1);
+ qemu_mutex_unlock_iothread();
+ break;
}
}
commit 5480bc04a0e575dc92d5a71a9591ffb0156e402d
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Mon Aug 30 13:31:59 2010 +0200
qxl: enable local rendering in compat mode
diff --git a/hw/qxl.c b/hw/qxl.c
index 2344bc7..e8ad800 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1063,6 +1063,7 @@ static void qxl_hw_update(void *opaque)
case QXL_MODE_VGA:
vga->update(vga);
break;
+ case QXL_MODE_COMPAT:
case QXL_MODE_NATIVE:
qxl_render_update(qxl);
break;
commit b23b7b4ceb284605a5adc14c9c037dd466d2469c
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Mon Aug 30 13:12:29 2010 +0200
zap comment
diff --git a/hw/qxl.c b/hw/qxl.c
index fcbbe79..2344bc7 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -728,7 +728,7 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta)
memslot.virt_start = virt_start + (guest_start - pci_start);
memslot.virt_end = virt_start + (guest_end - pci_start);
memslot.addr_delta = memslot.virt_start - delta;
- memslot.generation = d->rom->slot_generation = 0; // FIXME d->generation++;
+ memslot.generation = d->rom->slot_generation = 0;
qxl_rom_set_dirty(d);
dprintf(d, 1, "%s: slot %d: host virt 0x%" PRIx64 " - 0x%" PRIx64 "\n",
commit a59d5c9560741a6baf53606008c63cd2f7453721
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Fri Aug 27 16:36:37 2010 +0200
qxl: context annotation
diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index d9ebca4..1ad78b0 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -162,6 +162,7 @@ fail:
}
+/* called from spice server thread context only */
void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
{
QXLCursorCmd *cmd = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id);
diff --git a/hw/qxl.c b/hw/qxl.c
index dd64e01..fcbbe79 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -201,6 +201,7 @@ static void init_qxl_ram(PCIQXLDevice *d)
qxl_ring_set_dirty(d);
}
+/* can be called from spice server thread context */
static void qxl_set_dirty(ram_addr_t addr, ram_addr_t end)
{
while (addr < end) {
@@ -215,6 +216,7 @@ static void qxl_rom_set_dirty(PCIQXLDevice *qxl)
qxl_set_dirty(addr, addr + qxl->rom_size);
}
+/* called from spice server thread context only */
static void qxl_ram_set_dirty(PCIQXLDevice *qxl, void *ptr)
{
ram_addr_t addr = qxl->vga.vram_offset;
@@ -227,6 +229,7 @@ static void qxl_ram_set_dirty(PCIQXLDevice *qxl, void *ptr)
qxl_set_dirty(addr + offset, addr + offset + TARGET_PAGE_SIZE);
}
+/* can be called from spice server thread context */
static void qxl_ring_set_dirty(PCIQXLDevice *qxl)
{
ram_addr_t addr = qxl->vga.vram_offset + qxl->shadow_rom.ram_header_offset;
@@ -236,6 +239,7 @@ static void qxl_ring_set_dirty(PCIQXLDevice *qxl)
/*
* keep track of some command state, for savevm/loadvm.
+ * called from spice server thread context only
*/
static void qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext)
{
@@ -311,6 +315,7 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info)
info->n_surfaces = NUM_SURFACES;
}
+/* called from spice server thread context only */
static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
{
PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
@@ -356,6 +361,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
}
}
+/* called from spice server thread context only */
static int interface_req_cmd_notification(QXLInstance *sin)
{
PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
@@ -375,6 +381,7 @@ static int interface_req_cmd_notification(QXLInstance *sin)
return wait;
}
+/* called from spice server thread context only */
static inline void qxl_push_free_res(PCIQXLDevice *d)
{
QXLReleaseRing *ring = &d->ram->release_ring;
@@ -398,6 +405,7 @@ static inline void qxl_push_free_res(PCIQXLDevice *d)
}
}
+/* called from spice server thread context only */
static void interface_release_resource(QXLInstance *sin,
struct QXLReleaseInfoExt ext)
{
@@ -436,6 +444,7 @@ static void interface_release_resource(QXLInstance *sin,
qxl_push_free_res(qxl);
}
+/* called from spice server thread context only */
static int interface_get_cursor_command(QXLInstance *sin, struct QXLCommandExt *ext)
{
PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
@@ -472,6 +481,7 @@ static int interface_get_cursor_command(QXLInstance *sin, struct QXLCommandExt *
}
}
+/* called from spice server thread context only */
static int interface_req_cursor_notification(QXLInstance *sin)
{
PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
@@ -491,12 +501,14 @@ static int interface_req_cursor_notification(QXLInstance *sin)
return wait;
}
+/* called from spice server thread context */
static void interface_notify_update(QXLInstance *sin, uint32_t update_id)
{
fprintf(stderr, "%s: abort()\n", __FUNCTION__);
abort();
}
+/* called from spice server thread context only */
static int interface_flush_resources(QXLInstance *sin)
{
PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
@@ -518,8 +530,9 @@ static const QXLInterface qxl_interface = {
.attache_worker = interface_attach_worker,
.set_compression_level = interface_set_compression_level,
.set_mm_time = interface_set_mm_time,
-
.get_init_info = interface_get_init_info,
+
+ /* the callbacks below are called from spice server thread context */
.get_command = interface_get_command,
.req_cmd_notification = interface_req_cmd_notification,
.release_resource = interface_release_resource,
@@ -751,6 +764,7 @@ static void qxl_reset_surfaces(PCIQXLDevice *d)
memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds));
}
+/* called from spice server thread context only */
void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL pqxl, int group_id)
{
uint64_t phys = le64_to_cpu(pqxl);
@@ -1000,6 +1014,7 @@ static void pipe_read(void *opaque)
qxl_set_irq(d);
}
+/* called from spice server thread context only */
static void qxl_send_events(PCIQXLDevice *d, uint32_t events)
{
uint32_t old_pending;
commit 693dca738681c5e37d38c8dcf1dcf04df631f053
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Fri Aug 27 14:29:16 2010 +0200
spice: add config options for the listening address
Make listening address configurable. Also add options to
force using IPv4 or IPv6.
diff --git a/qemu-config.c b/qemu-config.c
index 7b447d7..f709bd5 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -347,6 +347,15 @@ QemuOptsList qemu_spice_opts = {
.name = "tls-port",
.type = QEMU_OPT_NUMBER,
},{
+ .name = "addr",
+ .type = QEMU_OPT_STRING,
+ },{
+ .name = "ipv4",
+ .type = QEMU_OPT_BOOL,
+ },{
+ .name = "ipv6",
+ .type = QEMU_OPT_BOOL,
+ },{
.name = "password",
.type = QEMU_OPT_STRING,
},{
diff --git a/qemu-options.hx b/qemu-options.hx
index fcb3ccd..526d10b 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -682,6 +682,13 @@ Enable the spice remote desktop protocol. Valid options are
@item port=<nr>
Set the TCP port spice is listening on for plaintext channels.
+ at item addr=<addr>
+Set the IP address spice is listening on. Default is any address.
+
+ at item ipv4
+ at item ipv6
+Force using the specified IP version.
+
@item password=<secret>
Set the password you need to authenticate.
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 027c221..a0b6a8c 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -298,14 +298,14 @@ static int add_channel(const char *name, const char *value, void *opaque)
void qemu_spice_init(void)
{
QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head);
- const char *password, *str, *x509_dir,
+ const char *password, *str, *x509_dir, *addr,
*x509_key_password = NULL,
*x509_dh_file = NULL,
*tls_ciphers = NULL;
char *x509_key_file = NULL,
*x509_cert_file = NULL,
*x509_cacert_file = NULL;
- int port, tls_port, len;
+ int port, tls_port, len, addr_flags;
spice_image_compression_t compression;
spice_wan_compression_t wan_compr;
@@ -352,7 +352,15 @@ void qemu_spice_init(void)
tls_ciphers = qemu_opt_get(opts, "tls-ciphers");
}
+ addr = qemu_opt_get(opts, "addr");
+ addr_flags = 0;
+ if (qemu_opt_get_bool(opts, "ipv4", 0))
+ addr_flags |= SPICE_ADDR_FLAG_IPV4_ONLY;
+ else if (qemu_opt_get_bool(opts, "ipv6", 0))
+ addr_flags |= SPICE_ADDR_FLAG_IPV6_ONLY;
+
spice_server = spice_server_new();
+ spice_server_set_addr(spice_server, addr ? addr : "", addr_flags);
if (port) {
spice_server_set_port(spice_server, port);
}
commit cc2d27c593df4425030cdb53abb950e9169a248a
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Fri Aug 27 14:09:56 2010 +0200
spice: add config options for channel security.
This allows to enforce tls or plaintext usage for certain spice
channels.
diff --git a/qemu-config.c b/qemu-config.c
index b305286..7b447d7 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -374,6 +374,12 @@ QemuOptsList qemu_spice_opts = {
.name = "tls-ciphers",
.type = QEMU_OPT_STRING,
},{
+ .name = "tls-channel",
+ .type = QEMU_OPT_STRING,
+ },{
+ .name = "plaintext-channel",
+ .type = QEMU_OPT_STRING,
+ },{
.name = "image-compression",
.type = QEMU_OPT_STRING,
},{
diff --git a/qemu-options.hx b/qemu-options.hx
index 9f3e3d2..fcb3ccd 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -704,6 +704,14 @@ The x509 file names can also be configured individually.
@item tls-ciphers=<list>
Specify which ciphers to use.
+ at item tls-channel=[main|display|inputs|record|playback|tunnel]
+ at item plaintext-channel=[main|display|inputs|record|playback|tunnel]
+Force specific channel to be used with or without TLS encryption. The
+options can be specified multiple times to configure multiple
+channels. The special name "default" can be used to set the default
+mode. For channels which are not explicitly forced into one mode the
+spice client is allowed to pick tls/plaintext as he pleases.
+
@item image-compression=[auto_glz|auto_lz|quic|glz|lz|off]
Configure image compression (lossless).
Default is auto_glz.
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 7053c6a..027c221 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -272,6 +272,29 @@ int mon_spice_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
port, tls_port, subject);
}
+static int add_channel(const char *name, const char *value, void *opaque)
+{
+ int security = 0;
+ int rc;
+
+ if (strcmp(name, "tls-channel") == 0)
+ security = SPICE_CHANNEL_SECURITY_SSL;
+ if (strcmp(name, "plaintext-channel") == 0)
+ security = SPICE_CHANNEL_SECURITY_NONE;
+ if (security == 0)
+ return 0;
+ if (strcmp(value, "default") == 0) {
+ rc = spice_server_set_channel_security(spice_server, NULL, security);
+ } else {
+ rc = spice_server_set_channel_security(spice_server, value, security);
+ }
+ if (rc != 0) {
+ fprintf(stderr, "spice: failed to set channel security for %s\n", value);
+ exit(1);
+ }
+ return 0;
+}
+
void qemu_spice_init(void)
{
QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head);
@@ -368,6 +391,8 @@ void qemu_spice_init(void)
}
spice_server_set_zlib_glz_compression(spice_server, wan_compr);
+ qemu_opt_foreach(opts, add_channel, NULL, 0);
+
spice_server_init(spice_server, &core_interface);
using_spice = 1;
commit 4c53ad128016fffc46e10f4fa357f25e36ef2bdb
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Fri Aug 27 14:07:32 2010 +0200
spice: fix display_remote setup
Set display_remote depending on the using_spice variable instead of
the presence of the -spice command line switch.
Reason: spice can also be configured via config file, which should be
flagged via remote_display too.
diff --git a/vl.c b/vl.c
index 0f26c68..e69b20b 100644
--- a/vl.c
+++ b/vl.c
@@ -2614,7 +2614,6 @@ int main(int argc, char **argv, char **envp)
fprintf(stderr, "parse error: %s\n", optarg);
exit(1);
}
- display_remote++;
break;
case QEMU_OPTION_writeconfig:
{
@@ -2911,6 +2910,8 @@ int main(int argc, char **argv, char **envp)
/* just use the first displaystate for the moment */
ds = get_displaystate();
+ if (using_spice)
+ display_remote++;
if (display_type == DT_DEFAULT && !display_remote) {
#if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
display_type = DT_SDL;
More information about the Spice-commits
mailing list