spice patch queue
Hi,
Here comes the spice patch queue with a small collection of fixes.
cheers,
Gerd
The following changes since commit 1680d485777ecf436d724631ea8722cc0c66990e:
Merge remote-tracking branch 'rth/tcg-ldst-6' into staging (2013-10-14 09:59:59 -0700)
are available in the git repository at:
git://anongit.freedesktop.org/spice/qemu spice.v75
for you to fetch changes up to 9fa032866daae68357d99abc725c18fe9ed4b61b:
spice: fix multihead support (2013-10-17 12:42:54 +0200)
----------------------------------------------------------------
Christophe Fergeau (1):
Fix VNC SASL authentication when using a QXL device
Gerd Hoffmann (2):
spice-display: add display channel id to the debug messages.
spice: fix multihead support
Marc-André Lureau (1):
spice: replace use of deprecated API
hw/display/qxl.c | 19 ++++++++-------- include/ui/qemu-spice.h | 5 +++-- ui/spice-core.c | 40 +++++++++++++++++++++++---------- ui/spice-display.c | 60 ++++++++++++++++++++++++++++++++----------------- vl.c | 4 ++-- 5 files changed, 81 insertions(+), 47 deletions(-)
PATCH 1/4 spice: replace use of deprecated API
From: Marc-André Lureau <[email protected]>
hose API are deprecated since 0.11, and qemu depends on 0.12 already.
--- hw/display/qxl.c | 16 ++++++++-------- ui/spice-core.c | 15 +++++++-------- ui/spice-display.c | 10 +++++----- 3 files changed, 20 insertions(+), 21 deletions(-)
hw/display/qxl.c +8 -8
@@ -162,7 +162,7 @@ void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,trace_qxl_spice_update_area_rest (qxl->id, num_dirty_rects, clear_dirty_region);if (async ==QXL_SYNC ) { - qxl->ssd.worker->update_area (qxl->ssd.worker, surface_id, area, +spice_qxl_update_area (&qxl->ssd.qxl, surface_id, area, dirty_rects, num_dirty_rects, clear_dirty_region); }else {assert (cookie !=NULL );
@@ -193,7 +193,7 @@ static void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id, cookie->u.surface_id = id;spice_qxl_destroy_surface_async (&qxl->ssd.qxl, id, (uintptr_t )cookie); }else { - qxl->ssd.worker->destroy_surface_wait (qxl->ssd.worker, id); +spice_qxl_destroy_surface_wait (&qxl->ssd.qxl, id);qxl_spice_destroy_surface_wait_complete (qxl, id); } }
@@ -211,19 +211,19 @@ void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext, uint32_t count) {trace_qxl_spice_loadvm_commands (qxl->id, ext, count); - qxl->ssd.worker->loadvm_commands (qxl->ssd.worker, ext, count); +spice_qxl_loadvm_commands (&qxl->ssd.qxl, ext, count); }void qxl_spice_oom (PCIQXLDevice *qxl) {trace_qxl_spice_oom (qxl->id); - qxl->ssd.worker->oom (qxl->ssd.worker); +spice_qxl_oom (&qxl->ssd.qxl); }void qxl_spice_reset_memslots (PCIQXLDevice *qxl) {trace_qxl_spice_reset_memslots (qxl->id); - qxl->ssd.worker->reset_memslots (qxl->ssd.worker); +spice_qxl_reset_memslots (&qxl->ssd.qxl); }static void qxl_spice_destroy_surfaces_complete (PCIQXLDevice *qxl)
@@ -244,7 +244,7 @@ static void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl, qxl_async_io async) (uintptr_t )qxl_cookie_new (QXL_COOKIE_TYPE_IO , QXL_IO_DESTROY_ALL_SURFACES_ASYNC)); }else { - qxl->ssd.worker->destroy_surfaces (qxl->ssd.worker); +spice_qxl_destroy_surfaces (&qxl->ssd.qxl);qxl_spice_destroy_surfaces_complete (qxl); } }
@@ -278,13 +278,13 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay)void qxl_spice_reset_image_cache (PCIQXLDevice *qxl) {trace_qxl_spice_reset_image_cache (qxl->id); - qxl->ssd.worker->reset_image_cache (qxl->ssd.worker); +spice_qxl_reset_image_cache (&qxl->ssd.qxl); }void qxl_spice_reset_cursor (PCIQXLDevice *qxl) {trace_qxl_spice_reset_cursor (qxl->id); - qxl->ssd.worker->reset_cursor (qxl->ssd.worker); +spice_qxl_reset_cursor (&qxl->ssd.qxl);qemu_mutex_lock (&qxl->track_lock); qxl->guest_cursor =0 ;qemu_mutex_unlock (&qxl->track_lock);
ui/spice-core.c +7 -8
@@ -383,17 +383,16 @@ static SpiceChannelList *qmp_query_spice_channels(void)struct sockaddr *paddr;socklen_t plen; +if (!(item->info->flags &SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT )) { +error_report ("invalid channel event" ); +return NULL ; + } + chan =g_malloc0 (sizeof (*chan)); chan->value =g_malloc0 (sizeof (*chan->value)); -if (item->info->flags &SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT ) { - paddr = (struct sockaddr *)&item->info->paddr_ext; - plen = item->info->plen_ext; - }else { - paddr = &item->info->paddr; - plen = item->info->plen; - } - + paddr = (struct sockaddr *)&item->info->paddr_ext; + plen = item->info->plen_ext;getnameinfo (paddr, plen, host,sizeof (host), port,sizeof (port),NI_NUMERICHOST |NI_NUMERICSERV );
ui/spice-display.c +5 -5
@@ -83,14 +83,14 @@ void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot, (uintptr_t )qxl_cookie_new (QXL_COOKIE_TYPE_IO , QXL_IO_MEMSLOT_ADD_ASYNC)); }else { - ssd->worker->add_memslot (ssd->worker, memslot); +spice_qxl_add_memslot (&ssd->qxl, memslot); } }void qemu_spice_del_memslot (SimpleSpiceDisplay *ssd,uint32_t gid,uint32_t sid) {trace_qemu_spice_del_memslot (ssd->qxl.id, gid, sid); - ssd->worker->del_memslot (ssd->worker, gid, sid); +spice_qxl_del_memslot (&ssd->qxl, gid, sid); } void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
@@ -103,7 +103,7 @@ void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id, (uintptr_t )qxl_cookie_new (QXL_COOKIE_TYPE_IO , QXL_IO_CREATE_PRIMARY_ASYNC)); }else { - ssd->worker->create_primary_surface (ssd->worker, id, surface); +spice_qxl_create_primary_surface (&ssd->qxl, id, surface); } }
@@ -116,14 +116,14 @@ void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd, (uintptr_t )qxl_cookie_new (QXL_COOKIE_TYPE_IO , QXL_IO_DESTROY_PRIMARY_ASYNC)); }else { - ssd->worker->destroy_primary_surface (ssd->worker, id); +spice_qxl_destroy_primary_surface (&ssd->qxl, id); } }void qemu_spice_wakeup (SimpleSpiceDisplay *ssd) {trace_qemu_spice_wakeup (ssd->qxl.id); - ssd->worker->wakeup (ssd->worker); +spice_qxl_wakeup (&ssd->qxl); }static int spice_display_is_running;
Signature · 1 line
1.8.3.1
PATCH 2/4 Fix VNC SASL authentication when using a QXL device
In reply to Gerd HoffmannFrom: Christophe Fergeau <[email protected]>
ui/vnc.c:vnc_display_open() and spice-server/server/reds.c:do_spice_init() are both calling sasl_server_init(). If spice_server_set_sasl_appname() hasn't been called, spice-server will call it with "spice" as an appname, causing cyrus-sasl to try to use a /etc/sasl2/spice.conf config file rather than the /etc/sasl2/qemu.conf file that QEMU uses.
When using -spice sasl on the command line, QEMU properly calls spice_server_set_sasl_appname() to set the SASL appname as "qemu", but when using a QXL device without using SPICE, spice_server_init() is called from qemu_spice_add_interface() without setting the appname to "qemu", which then causes the VNC code to try to use spice.conf instead of qemu.conf.
--- ui/spice-core.c | 1 + 1 file changed, 1 insertion(+)
ui/spice-core.c +1 -0
@@ -832,6 +832,7 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin)* With a command line like '-vnc :0 -vga qxl' you'll end up here. */ spice_server =spice_server_new (); +spice_server_set_sasl_appname (spice_server,"qemu" );spice_server_init (spice_server, &core_interface);qemu_add_vm_change_state_handler (vm_change_state_handler,NULL ); }
Signature · 1 line
1.8.3.1
PATCH 3/4 spice-display: add display channel id to the debug messages.
In reply to Gerd HoffmannAnd s/__FUNCTION__/__func__/ while being at it.
--- ui/spice-display.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
ui/spice-display.c +14 -13
@@ -297,7 +297,7 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd) {QXLDevMemSlot memslot; -dprint (1 ,"%s:\n" , __FUNCTION__); +dprint (1 ,"%s/%d:\n" , __func__, ssd->qxl.id);memset (&memslot,0 ,sizeof (memslot)); memslot.slot_group_id =MEMSLOT_GROUP_HOST ;
@@ -311,7 +311,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)memset (&surface,0 ,sizeof (surface)); -dprint (1 ,"%s: %dx%d\n" , __FUNCTION__, +dprint (1 ,"%s/%d: %dx%d\n" , __func__, ssd->qxl.id,surface_width (ssd->ds),surface_height (ssd->ds)); surface.format = SPICE_SURFACE_FMT_32_xRGB;
@@ -329,7 +329,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)void qemu_spice_destroy_host_primary (SimpleSpiceDisplay *ssd) { -dprint (1 ,"%s:\n" , __FUNCTION__); +dprint (1 ,"%s/%d:\n" , __func__, ssd->qxl.id);qemu_spice_destroy_primary_surface (ssd,0 ,QXL_SYNC ); }
@@ -354,7 +354,8 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd, {QXLRect update_area; -dprint (2 ,"%s: x %d y %d w %d h %d\n" , __FUNCTION__, x, y, w, h); +dprint (2 ,"%s/%d: x %d y %d w %d h %d\n" , __func__, + ssd->qxl.id, x, y, w, h); update_area.left = x, update_area.right = x + w; update_area.top = y;
@@ -371,7 +372,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, {SimpleSpiceUpdate *update; -dprint (1 ,"%s:\n" , __FUNCTION__); +dprint (1 ,"%s/%d:\n" , __func__, ssd->qxl.id);memset (&ssd->dirty,0 ,sizeof (ssd->dirty));if (ssd->surface) {
@@ -413,7 +414,7 @@ void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd)void qemu_spice_display_refresh (SimpleSpiceDisplay *ssd) { -dprint (3 ,"%s:\n" , __func__); +dprint (3 ,"%s/%d:\n" , __func__, ssd->qxl.id);graphic_hw_update (ssd->dcl.con);qemu_mutex_lock (&ssd->lock);
@@ -427,7 +428,7 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)if (ssd->notify) { ssd->notify =0 ;qemu_spice_wakeup (ssd); -dprint (2 ,"%s: notify\n" , __FUNCTION__); +dprint (2 ,"%s/%d: notify\n" , __func__, ssd->qxl.id); } }
@@ -437,19 +438,19 @@ static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker) {SimpleSpiceDisplay *ssd =container_of (sin, SimpleSpiceDisplay, qxl); -dprint (1 ,"%s:\n" , __FUNCTION__); +dprint (1 ,"%s/%d:\n" , __func__, ssd->qxl.id); ssd->worker = qxl_worker; }static void interface_set_compression_level (QXLInstance *sin,int level) { -dprint (1 ,"%s:\n" , __FUNCTION__); +dprint (1 ,"%s/%d:\n" , __func__, sin->id);/* nothing to do */ }static void interface_set_mm_time (QXLInstance *sin,uint32_t mm_time) { -dprint (3 ,"%s:\n" , __FUNCTION__); +dprint (3 ,"%s/%d:\n" , __func__, sin->id);/* nothing to do */ }
@@ -472,7 +473,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)SimpleSpiceUpdate *update;int ret = false; -dprint (3 ,"%s:\n" , __FUNCTION__); +dprint (3 ,"%s/%d:\n" , __func__, ssd->qxl.id);qemu_mutex_lock (&ssd->lock); update =QTAILQ_FIRST (&ssd->updates);
@@ -488,7 +489,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)static int interface_req_cmd_notification (QXLInstance *sin) { -dprint (1 ,"%s:\n" , __FUNCTION__); +dprint (1 ,"%s/%d:\n" , __func__, sin->id);return 1 ; }
@@ -498,7 +499,7 @@ static void interface_release_resource(QXLInstance *sin,SimpleSpiceDisplay *ssd =container_of (sin, SimpleSpiceDisplay, qxl);uintptr_t id; -dprint (2 ,"%s:\n" , __FUNCTION__); +dprint (2 ,"%s/%d:\n" , __func__, ssd->qxl.id); id = ext.info->id;qemu_spice_destroy_update (ssd, (void *)id); }
Signature · 1 line
1.8.3.1
PATCH 4/4 spice: fix multihead support
In reply to Gerd HoffmannThis patch fixes spice display initialization to handle multihead properly.
spice-core now keeps track of which QemuConsole has a spice display channel attached to it and which has not. It also manages display channel ids.
spice-display looks at all QemuConsoles and will pick up any graphic console not yet bound to a spice channel (which in practice are all non-qxl graphic devices).
Result is that
(a) you'll get a spice client window for each graphical device now (first only without this patch), and
(b) mixing qxl and non-qxl vga cards works properly.
--- hw/display/qxl.c | 3 +-- include/ui/qemu-spice.h | 5 +++-- ui/spice-core.c | 24 ++++++++++++++++++++---- ui/spice-display.c | 23 ++++++++++++++++++++--- vl.c | 4 ++-- 5 files changed, 46 insertions(+), 13 deletions(-)
hw/display/qxl.c +1 -2
@@ -2037,8 +2037,7 @@ static int qxl_init_common(PCIQXLDevice *qxl) qxl->vram32_size < qxl->vram_size ? "[region 4]" : "[unmapped]"); qxl->ssd.qxl.base.sif = &qxl_interface.base; - qxl->ssd.qxl.id = qxl->id; -if (qemu_spice_add_interface (&qxl->ssd.qxl.base) !=0 ) { +if (qemu_spice_add_display_interface (&qxl->ssd.qxl, qxl->vga.con) !=0 ) {error_report ("qxl interface %d.%d not supported by spice-server" ,SPICE_INTERFACE_QXL_MAJOR ,SPICE_INTERFACE_QXL_MINOR );return -1 ;
include/ui/qemu-spice.h +3 -2
@@ -27,14 +27,15 @@#include "monitor/monitor.h" extern int using_spice; -extern int spice_displays;void qemu_spice_init (void );void qemu_spice_input_init (void );void qemu_spice_audio_init (void ); -void qemu_spice_display_init (DisplayState *ds); +void qemu_spice_display_init (void );int qemu_spice_display_add_client (int csock,int skipauth,int tls);int qemu_spice_add_interface (SpiceBaseInstance *sin); +bool qemu_spice_have_display_interface (QemuConsole *con); +int qemu_spice_add_display_interface (QXLInstance *qxlin,QemuConsole *con);int qemu_spice_set_passwd (const char *passwd,bool fail_if_connected,bool disconnect_if_connected);int qemu_spice_set_pw_expire (time_t expires);
ui/spice-core.c +20 -4
@@ -48,7 +48,6 @@ static char *auth_passwd;static time_t auth_expires =TIME_MAX ;static int spice_migration_completed;int using_spice =0 ; -int spice_displays;static QemuThread me;
@@ -837,11 +836,28 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin)qemu_add_vm_change_state_handler (vm_change_state_handler,NULL ); } -if (strcmp (sin->sif->type,SPICE_INTERFACE_QXL ) ==0 ) { - spice_displays++; +return spice_server_add_interface (spice_server, sin); +} + +static GSList *spice_consoles; +static int display_id; + +bool qemu_spice_have_display_interface (QemuConsole *con) +{ +if (g_slist_find (spice_consoles, con)) { +return true; } +return false; +} -return spice_server_add_interface (spice_server, sin); +int qemu_spice_add_display_interface (QXLInstance *qxlin,QemuConsole *con) +{ +if (g_slist_find (spice_consoles, con)) { +return -1 ; + } + qxlin->id = display_id++; + spice_consoles =g_slist_append (spice_consoles, con); +return qemu_spice_add_interface (&qxlin->base); }static int qemu_spice_set_ticket (bool fail_if_conn,bool disconnect_if_conn)
ui/spice-display.c +20 -3
@@ -612,21 +612,38 @@ static const DisplayChangeListenerOps display_listener_ops = { .dpy_refresh = display_refresh, }; -void qemu_spice_display_init (DisplayState *ds) +static void qemu_spice_display_init_one (QemuConsole *con) {SimpleSpiceDisplay *ssd =g_new0 (SimpleSpiceDisplay,1 );qemu_spice_display_init_common (ssd); ssd->qxl.base.sif = &dpy_interface.base; -qemu_spice_add_interface (&ssd->qxl.base); +qemu_spice_add_display_interface (&ssd->qxl, con);assert (ssd->worker);qemu_spice_create_host_memslot (ssd); ssd->dcl.ops = &display_listener_ops; - ssd->dcl.con =qemu_console_lookup_by_index (0 ); + ssd->dcl.con = con;register_displaychangelistener (&ssd->dcl);qemu_spice_create_host_primary (ssd); } + +void qemu_spice_display_init (void ) +{ +QemuConsole *con; +int i; + +for (i =0 ;; i++) { + con =qemu_console_lookup_by_index (i); +if (!con || !qemu_console_is_graphic (con)) { +break ; + } +if (qemu_spice_have_display_interface (con)) { +continue ; + } +qemu_spice_display_init_one (con); + } +}
vl.c +2 -2
@@ -4315,8 +4315,8 @@ int main(int argc, char **argv, char **envp) }#endif #ifdef CONFIG_SPICE -if (using_spice && !spice_displays) { -qemu_spice_display_init (ds); +if (using_spice) { +qemu_spice_display_init (); }#endif
Signature · 1 line
1.8.3.1