Merge remote-tracking branch 'spice/spice.v75' into staging
# By Gerd Hoffmann (2) and others # Via Gerd Hoffmann * spice/spice.v75: spice: fix multihead support spice-display: add display channel id to the debug messages. Fix VNC SASL authentication when using a QXL device spice: replace use of deprecated API Message-id: 1382006760-19388-1-git-send-email-kraxel@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
This commit is contained in:
		
						commit
						c21611ab8d
					
				@ -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,
 | 
					    trace_qxl_spice_update_area_rest(qxl->id, num_dirty_rects,
 | 
				
			||||||
                                     clear_dirty_region);
 | 
					                                     clear_dirty_region);
 | 
				
			||||||
    if (async == QXL_SYNC) {
 | 
					    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);
 | 
					                        dirty_rects, num_dirty_rects, clear_dirty_region);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        assert(cookie != NULL);
 | 
					        assert(cookie != NULL);
 | 
				
			||||||
@ -193,7 +193,7 @@ static void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id,
 | 
				
			|||||||
        cookie->u.surface_id = id;
 | 
					        cookie->u.surface_id = id;
 | 
				
			||||||
        spice_qxl_destroy_surface_async(&qxl->ssd.qxl, id, (uintptr_t)cookie);
 | 
					        spice_qxl_destroy_surface_async(&qxl->ssd.qxl, id, (uintptr_t)cookie);
 | 
				
			||||||
    } else {
 | 
					    } 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);
 | 
					        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)
 | 
					                               uint32_t count)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    trace_qxl_spice_loadvm_commands(qxl->id, ext, 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)
 | 
					void qxl_spice_oom(PCIQXLDevice *qxl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    trace_qxl_spice_oom(qxl->id);
 | 
					    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)
 | 
					void qxl_spice_reset_memslots(PCIQXLDevice *qxl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    trace_qxl_spice_reset_memslots(qxl->id);
 | 
					    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)
 | 
					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,
 | 
					                (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
 | 
				
			||||||
                                          QXL_IO_DESTROY_ALL_SURFACES_ASYNC));
 | 
					                                          QXL_IO_DESTROY_ALL_SURFACES_ASYNC));
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        qxl->ssd.worker->destroy_surfaces(qxl->ssd.worker);
 | 
					        spice_qxl_destroy_surfaces(&qxl->ssd.qxl);
 | 
				
			||||||
        qxl_spice_destroy_surfaces_complete(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)
 | 
					void qxl_spice_reset_image_cache(PCIQXLDevice *qxl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    trace_qxl_spice_reset_image_cache(qxl->id);
 | 
					    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)
 | 
					void qxl_spice_reset_cursor(PCIQXLDevice *qxl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    trace_qxl_spice_reset_cursor(qxl->id);
 | 
					    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);
 | 
					    qemu_mutex_lock(&qxl->track_lock);
 | 
				
			||||||
    qxl->guest_cursor = 0;
 | 
					    qxl->guest_cursor = 0;
 | 
				
			||||||
    qemu_mutex_unlock(&qxl->track_lock);
 | 
					    qemu_mutex_unlock(&qxl->track_lock);
 | 
				
			||||||
@ -2037,8 +2037,7 @@ static int qxl_init_common(PCIQXLDevice *qxl)
 | 
				
			|||||||
           qxl->vram32_size < qxl->vram_size ? "[region 4]" : "[unmapped]");
 | 
					           qxl->vram32_size < qxl->vram_size ? "[region 4]" : "[unmapped]");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qxl->ssd.qxl.base.sif = &qxl_interface.base;
 | 
					    qxl->ssd.qxl.base.sif = &qxl_interface.base;
 | 
				
			||||||
    qxl->ssd.qxl.id = qxl->id;
 | 
					    if (qemu_spice_add_display_interface(&qxl->ssd.qxl, qxl->vga.con) != 0) {
 | 
				
			||||||
    if (qemu_spice_add_interface(&qxl->ssd.qxl.base) != 0) {
 | 
					 | 
				
			||||||
        error_report("qxl interface %d.%d not supported by spice-server",
 | 
					        error_report("qxl interface %d.%d not supported by spice-server",
 | 
				
			||||||
                     SPICE_INTERFACE_QXL_MAJOR, SPICE_INTERFACE_QXL_MINOR);
 | 
					                     SPICE_INTERFACE_QXL_MAJOR, SPICE_INTERFACE_QXL_MINOR);
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
 | 
				
			|||||||
@ -27,14 +27,15 @@
 | 
				
			|||||||
#include "monitor/monitor.h"
 | 
					#include "monitor/monitor.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern int using_spice;
 | 
					extern int using_spice;
 | 
				
			||||||
extern int spice_displays;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_spice_init(void);
 | 
					void qemu_spice_init(void);
 | 
				
			||||||
void qemu_spice_input_init(void);
 | 
					void qemu_spice_input_init(void);
 | 
				
			||||||
void qemu_spice_audio_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_display_add_client(int csock, int skipauth, int tls);
 | 
				
			||||||
int qemu_spice_add_interface(SpiceBaseInstance *sin);
 | 
					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,
 | 
					int qemu_spice_set_passwd(const char *passwd,
 | 
				
			||||||
                          bool fail_if_connected, bool disconnect_if_connected);
 | 
					                          bool fail_if_connected, bool disconnect_if_connected);
 | 
				
			||||||
int qemu_spice_set_pw_expire(time_t expires);
 | 
					int qemu_spice_set_pw_expire(time_t expires);
 | 
				
			||||||
 | 
				
			|||||||
@ -48,7 +48,6 @@ static char *auth_passwd;
 | 
				
			|||||||
static time_t auth_expires = TIME_MAX;
 | 
					static time_t auth_expires = TIME_MAX;
 | 
				
			||||||
static int spice_migration_completed;
 | 
					static int spice_migration_completed;
 | 
				
			||||||
int using_spice = 0;
 | 
					int using_spice = 0;
 | 
				
			||||||
int spice_displays;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
static QemuThread me;
 | 
					static QemuThread me;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -383,17 +382,16 @@ static SpiceChannelList *qmp_query_spice_channels(void)
 | 
				
			|||||||
        struct sockaddr *paddr;
 | 
					        struct sockaddr *paddr;
 | 
				
			||||||
        socklen_t plen;
 | 
					        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 = g_malloc0(sizeof(*chan));
 | 
				
			||||||
        chan->value = g_malloc0(sizeof(*chan->value));
 | 
					        chan->value = g_malloc0(sizeof(*chan->value));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (item->info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) {
 | 
					 | 
				
			||||||
        paddr = (struct sockaddr *)&item->info->paddr_ext;
 | 
					        paddr = (struct sockaddr *)&item->info->paddr_ext;
 | 
				
			||||||
        plen = item->info->plen_ext;
 | 
					        plen = item->info->plen_ext;
 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            paddr = &item->info->paddr;
 | 
					 | 
				
			||||||
            plen = item->info->plen;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        getnameinfo(paddr, plen,
 | 
					        getnameinfo(paddr, plen,
 | 
				
			||||||
                    host, sizeof(host), port, sizeof(port),
 | 
					                    host, sizeof(host), port, sizeof(port),
 | 
				
			||||||
                    NI_NUMERICHOST | NI_NUMERICSERV);
 | 
					                    NI_NUMERICHOST | NI_NUMERICSERV);
 | 
				
			||||||
@ -833,15 +831,33 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin)
 | 
				
			|||||||
         * With a command line like '-vnc :0 -vga qxl' you'll end up here.
 | 
					         * With a command line like '-vnc :0 -vga qxl' you'll end up here.
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        spice_server = spice_server_new();
 | 
					        spice_server = spice_server_new();
 | 
				
			||||||
 | 
					        spice_server_set_sasl_appname(spice_server, "qemu");
 | 
				
			||||||
        spice_server_init(spice_server, &core_interface);
 | 
					        spice_server_init(spice_server, &core_interface);
 | 
				
			||||||
        qemu_add_vm_change_state_handler(vm_change_state_handler, NULL);
 | 
					        qemu_add_vm_change_state_handler(vm_change_state_handler, NULL);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (strcmp(sin->sif->type, SPICE_INTERFACE_QXL) == 0) {
 | 
					    return spice_server_add_interface(spice_server, sin);
 | 
				
			||||||
        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;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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)
 | 
					static int qemu_spice_set_ticket(bool fail_if_conn, bool disconnect_if_conn)
 | 
				
			||||||
 | 
				
			|||||||
@ -83,14 +83,14 @@ void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot,
 | 
				
			|||||||
                (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
 | 
					                (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
 | 
				
			||||||
                                          QXL_IO_MEMSLOT_ADD_ASYNC));
 | 
					                                          QXL_IO_MEMSLOT_ADD_ASYNC));
 | 
				
			||||||
    } else {
 | 
					    } 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)
 | 
					void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid, uint32_t sid)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    trace_qemu_spice_del_memslot(ssd->qxl.id, gid, 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,
 | 
					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,
 | 
					                (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
 | 
				
			||||||
                                          QXL_IO_CREATE_PRIMARY_ASYNC));
 | 
					                                          QXL_IO_CREATE_PRIMARY_ASYNC));
 | 
				
			||||||
    } else {
 | 
					    } 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,
 | 
					                (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
 | 
				
			||||||
                                          QXL_IO_DESTROY_PRIMARY_ASYNC));
 | 
					                                          QXL_IO_DESTROY_PRIMARY_ASYNC));
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        ssd->worker->destroy_primary_surface(ssd->worker, id);
 | 
					        spice_qxl_destroy_primary_surface(&ssd->qxl, id);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_spice_wakeup(SimpleSpiceDisplay *ssd)
 | 
					void qemu_spice_wakeup(SimpleSpiceDisplay *ssd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    trace_qemu_spice_wakeup(ssd->qxl.id);
 | 
					    trace_qemu_spice_wakeup(ssd->qxl.id);
 | 
				
			||||||
    ssd->worker->wakeup(ssd->worker);
 | 
					    spice_qxl_wakeup(&ssd->qxl);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int spice_display_is_running;
 | 
					static int spice_display_is_running;
 | 
				
			||||||
@ -297,7 +297,7 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    QXLDevMemSlot memslot;
 | 
					    QXLDevMemSlot memslot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dprint(1, "%s:\n", __FUNCTION__);
 | 
					    dprint(1, "%s/%d:\n", __func__, ssd->qxl.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&memslot, 0, sizeof(memslot));
 | 
					    memset(&memslot, 0, sizeof(memslot));
 | 
				
			||||||
    memslot.slot_group_id = MEMSLOT_GROUP_HOST;
 | 
					    memslot.slot_group_id = MEMSLOT_GROUP_HOST;
 | 
				
			||||||
@ -311,7 +311,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    memset(&surface, 0, sizeof(surface));
 | 
					    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_width(ssd->ds), surface_height(ssd->ds));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    surface.format     = SPICE_SURFACE_FMT_32_xRGB;
 | 
					    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)
 | 
					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);
 | 
					    qemu_spice_destroy_primary_surface(ssd, 0, QXL_SYNC);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -354,7 +354,8 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    QXLRect update_area;
 | 
					    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.left = x,
 | 
				
			||||||
    update_area.right = x + w;
 | 
					    update_area.right = x + w;
 | 
				
			||||||
    update_area.top = y;
 | 
					    update_area.top = y;
 | 
				
			||||||
@ -371,7 +372,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    SimpleSpiceUpdate *update;
 | 
					    SimpleSpiceUpdate *update;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dprint(1, "%s:\n", __FUNCTION__);
 | 
					    dprint(1, "%s/%d:\n", __func__, ssd->qxl.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memset(&ssd->dirty, 0, sizeof(ssd->dirty));
 | 
					    memset(&ssd->dirty, 0, sizeof(ssd->dirty));
 | 
				
			||||||
    if (ssd->surface) {
 | 
					    if (ssd->surface) {
 | 
				
			||||||
@ -413,7 +414,7 @@ void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void qemu_spice_display_refresh(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);
 | 
					    graphic_hw_update(ssd->dcl.con);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qemu_mutex_lock(&ssd->lock);
 | 
					    qemu_mutex_lock(&ssd->lock);
 | 
				
			||||||
@ -427,7 +428,7 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
 | 
				
			|||||||
    if (ssd->notify) {
 | 
					    if (ssd->notify) {
 | 
				
			||||||
        ssd->notify = 0;
 | 
					        ssd->notify = 0;
 | 
				
			||||||
        qemu_spice_wakeup(ssd);
 | 
					        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);
 | 
					    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;
 | 
					    ssd->worker = qxl_worker;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void interface_set_compression_level(QXLInstance *sin, int level)
 | 
					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 */
 | 
					    /* nothing to do */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void interface_set_mm_time(QXLInstance *sin, uint32_t mm_time)
 | 
					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 */
 | 
					    /* nothing to do */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -472,7 +473,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
 | 
				
			|||||||
    SimpleSpiceUpdate *update;
 | 
					    SimpleSpiceUpdate *update;
 | 
				
			||||||
    int ret = false;
 | 
					    int ret = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dprint(3, "%s:\n", __FUNCTION__);
 | 
					    dprint(3, "%s/%d:\n", __func__, ssd->qxl.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qemu_mutex_lock(&ssd->lock);
 | 
					    qemu_mutex_lock(&ssd->lock);
 | 
				
			||||||
    update = QTAILQ_FIRST(&ssd->updates);
 | 
					    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)
 | 
					static int interface_req_cmd_notification(QXLInstance *sin)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    dprint(1, "%s:\n", __FUNCTION__);
 | 
					    dprint(1, "%s/%d:\n", __func__, sin->id);
 | 
				
			||||||
    return 1;
 | 
					    return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -498,7 +499,7 @@ static void interface_release_resource(QXLInstance *sin,
 | 
				
			|||||||
    SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
 | 
					    SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
 | 
				
			||||||
    uintptr_t id;
 | 
					    uintptr_t id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dprint(2, "%s:\n", __FUNCTION__);
 | 
					    dprint(2, "%s/%d:\n", __func__, ssd->qxl.id);
 | 
				
			||||||
    id = ext.info->id;
 | 
					    id = ext.info->id;
 | 
				
			||||||
    qemu_spice_destroy_update(ssd, (void*)id);
 | 
					    qemu_spice_destroy_update(ssd, (void*)id);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -611,21 +612,38 @@ static const DisplayChangeListenerOps display_listener_ops = {
 | 
				
			|||||||
    .dpy_refresh     = display_refresh,
 | 
					    .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);
 | 
					    SimpleSpiceDisplay *ssd = g_new0(SimpleSpiceDisplay, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qemu_spice_display_init_common(ssd);
 | 
					    qemu_spice_display_init_common(ssd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ssd->qxl.base.sif = &dpy_interface.base;
 | 
					    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);
 | 
					    assert(ssd->worker);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qemu_spice_create_host_memslot(ssd);
 | 
					    qemu_spice_create_host_memslot(ssd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ssd->dcl.ops = &display_listener_ops;
 | 
					    ssd->dcl.ops = &display_listener_ops;
 | 
				
			||||||
    ssd->dcl.con = qemu_console_lookup_by_index(0);
 | 
					    ssd->dcl.con = con;
 | 
				
			||||||
    register_displaychangelistener(&ssd->dcl);
 | 
					    register_displaychangelistener(&ssd->dcl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qemu_spice_create_host_primary(ssd);
 | 
					    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);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user