misc spice updates.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJUkDubAAoJEEy22O7T6HE4vjEQAMtS3Zxp0jRQJb1lJw9J81oz
 b9Qm25QGIGXJRnKOeXUpX1hB81Mz9CIAIopD7Qtz+geoNF06/8ug2pNjtd9awBuO
 Y75jJKFpHyiij2PD9JSAAhOLxqQ+k+7UVxVr00pJQEjih7zgyq2ZQaWdgH0Pmft+
 RliYpzj1TkMurJseh+JXmm6XVVmexypU3bzFhqz0BQWgEg1Bpvi7XjbZBPhxhWWh
 RJ4aWsy5njScXAl88xzs+l/7oSfbhiNi3mUNJvHGdWdEmSU1dweaVkye7wN6cm9K
 tg9DzGeKjw8/1zGiNe6GkXrhbNE6lu80FiqnsPuRVSbymaT1xI6xteTbHbpgIJyp
 Bq7XVdm8hr8sGcUMzFZGxsBEOlSANbmw4p5s08BGQr5Y/2DT78iC7f4Kt5doU3C7
 tY2ZTWp2wdgap/d3p8QjPq6kHDmpeQ+2zNbUhuyKBTWDSjZwckHpUc+BohUfRPoD
 iC71alwKWxDsCoDtq2vNVq8Ne+sfvYso6cGbB4M6DQWLRGHPxGTEY/30w30WBaAl
 BdZMlwF1kvpuCOpQGMp0Lvre9gzo+CBcIp5TGZio5xLTmZWjKZQ9s6cJSZynfKdW
 1zOL/aSSRqmyza8n1wwzOMCIyFFjMNsyIM01hTjJ8ZJgkQXr4ZYbRFkHiy2aLVk5
 mCEt3/hKSLlPfTUYyTnX
 =PIZ+
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20141216-1' into staging

misc spice updates.

# gpg: Signature made Tue 16 Dec 2014 14:03:07 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-20141216-1:
  spice: fix memory leak
  spice: remove spice-experimental.h include
  spice: do not require TCP ports
  spice: rework mirror allocation, add no-resize fast path
  spice: reduce refresh rate in native mode
  spice: use bottom half instead of refresh timer for cursor updates

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-12-16 16:52:42 +00:00
commit d86fb03469
6 changed files with 45 additions and 24 deletions

View File

@ -283,12 +283,14 @@ int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
qxl->ssd.mouse_x = cmd->u.set.position.x;
qxl->ssd.mouse_y = cmd->u.set.position.y;
qemu_mutex_unlock(&qxl->ssd.lock);
qemu_bh_schedule(qxl->ssd.cursor_bh);
break;
case QXL_CURSOR_MOVE:
qemu_mutex_lock(&qxl->ssd.lock);
qxl->ssd.mouse_x = cmd->u.position.x;
qxl->ssd.mouse_y = cmd->u.position.y;
qemu_mutex_unlock(&qxl->ssd.lock);
qemu_bh_schedule(qxl->ssd.cursor_bh);
break;
}
return 0;

View File

@ -1092,6 +1092,7 @@ static void qxl_enter_vga_mode(PCIQXLDevice *d)
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);
d->mode = QXL_MODE_VGA;
vga_dirty_log_start(&d->vga);
@ -1105,6 +1106,7 @@ static void qxl_exit_vga_mode(PCIQXLDevice *d)
}
trace_qxl_exit_vga_mode(d->id);
graphic_console_set_hwops(d->ssd.dcl.con, &qxl_ops, d);
update_displaychangelistener(&d->ssd.dcl, GUI_REFRESH_INTERVAL_IDLE);
vga_dirty_log_stop(&d->vga);
qxl_destroy_primary(d, QXL_SYNC);
}
@ -1153,6 +1155,7 @@ static void qxl_soft_reset(PCIQXLDevice *d)
qxl_enter_vga_mode(d);
} else {
d->mode = QXL_MODE_UNDEFINED;
update_displaychangelistener(&d->ssd.dcl, GUI_REFRESH_INTERVAL_IDLE);
}
}
@ -1861,10 +1864,6 @@ static void display_refresh(DisplayChangeListener *dcl)
if (qxl->mode == QXL_MODE_VGA) {
qemu_spice_display_refresh(&qxl->ssd);
} else {
qemu_mutex_lock(&qxl->ssd.lock);
qemu_spice_cursor_refresh_unlocked(&qxl->ssd);
qemu_mutex_unlock(&qxl->ssd.lock);
}
}
@ -2025,6 +2024,7 @@ static int qxl_init_common(PCIQXLDevice *qxl)
qxl_reset_state(qxl);
qxl->update_area_bh = qemu_bh_new(qxl_render_update_area_bh, qxl);
qxl->ssd.cursor_bh = qemu_bh_new(qemu_spice_cursor_refresh_bh, &qxl->ssd);
return 0;
}

View File

@ -102,6 +102,7 @@ struct SimpleSpiceDisplay {
/* cursor (with qxl): qxl local renderer -> displaychangelistener */
QEMUCursor *cursor;
int mouse_x, mouse_y;
QEMUBH *cursor_bh;
};
struct SimpleSpiceUpdate {
@ -134,7 +135,7 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
DisplaySurface *surface);
void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd);
void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd);
void qemu_spice_cursor_refresh_bh(void *opaque);
void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot,
qxl_async_io async);

View File

@ -3,7 +3,6 @@
#include "ui/qemu-spice.h"
#include "sysemu/char.h"
#include <spice.h>
#include <spice-experimental.h>
#include <spice/protocol.h>
#include "qemu/osdep.h"

View File

@ -16,7 +16,6 @@
*/
#include <spice.h>
#include <spice-experimental.h>
#include <netdb.h>
#include "sysemu/sysemu.h"
@ -386,10 +385,7 @@ 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;
}
assert(item->info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT);
chan = g_malloc0(sizeof(*chan));
chan->value = g_malloc0(sizeof(*chan->value));
@ -661,10 +657,6 @@ void qemu_spice_init(void)
}
port = qemu_opt_get_number(opts, "port", 0);
tls_port = qemu_opt_get_number(opts, "tls-port", 0);
if (!port && !tls_port) {
error_report("neither port nor tls-port specified for spice");
exit(1);
}
if (port < 0 || port > 65535) {
error_report("spice port is out of range");
exit(1);

View File

@ -207,12 +207,6 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
return;
};
if (ssd->surface == NULL) {
ssd->surface = pixman_image_ref(ssd->ds->image);
ssd->mirror = qemu_pixman_mirror_create(ssd->ds->format,
ssd->ds->image);
}
for (blk = 0; blk < blocks; blk++) {
dirty_top[blk] = -1;
}
@ -409,7 +403,29 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
SimpleSpiceUpdate *update;
bool need_destroy;
dprint(1, "%s/%d:\n", __func__, ssd->qxl.id);
if (surface && ssd->surface &&
surface_width(surface) == pixman_image_get_width(ssd->surface) &&
surface_height(surface) == pixman_image_get_height(ssd->surface)) {
/* no-resize fast path: just swap backing store */
dprint(1, "%s/%d: fast (%dx%d)\n", __func__, ssd->qxl.id,
surface_width(surface), surface_height(surface));
qemu_mutex_lock(&ssd->lock);
ssd->ds = surface;
pixman_image_unref(ssd->surface);
ssd->surface = pixman_image_ref(ssd->ds->image);
qemu_mutex_unlock(&ssd->lock);
qemu_spice_display_update(ssd, 0, 0,
surface_width(surface),
surface_height(surface));
return;
}
/* full mode switch */
dprint(1, "%s/%d: full (%dx%d -> %dx%d)\n", __func__, ssd->qxl.id,
ssd->surface ? pixman_image_get_width(ssd->surface) : 0,
ssd->surface ? pixman_image_get_height(ssd->surface) : 0,
surface ? surface_width(surface) : 0,
surface ? surface_height(surface) : 0);
memset(&ssd->dirty, 0, sizeof(ssd->dirty));
if (ssd->surface) {
@ -422,6 +438,9 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
qemu_mutex_lock(&ssd->lock);
need_destroy = (ssd->ds != NULL);
ssd->ds = surface;
ssd->surface = pixman_image_ref(ssd->ds->image);
ssd->mirror = qemu_pixman_mirror_create(ssd->ds->format,
ssd->ds->image);
while ((update = QTAILQ_FIRST(&ssd->updates)) != NULL) {
QTAILQ_REMOVE(&ssd->updates, update, next);
qemu_spice_destroy_update(ssd, update);
@ -438,7 +457,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
ssd->notify++;
}
void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd)
static void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd)
{
if (ssd->cursor) {
assert(ssd->dcl.con);
@ -454,6 +473,15 @@ void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd)
}
}
void qemu_spice_cursor_refresh_bh(void *opaque)
{
SimpleSpiceDisplay *ssd = opaque;
qemu_mutex_lock(&ssd->lock);
qemu_spice_cursor_refresh_unlocked(ssd);
qemu_mutex_unlock(&ssd->lock);
}
void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
{
dprint(3, "%s/%d:\n", __func__, ssd->qxl.id);
@ -464,7 +492,6 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
qemu_spice_create_update(ssd);
ssd->notify++;
}
qemu_spice_cursor_refresh_unlocked(ssd);
qemu_mutex_unlock(&ssd->lock);
if (ssd->notify) {