spice: fix segfault in qemu_spice_create_update, ui_info tweaks.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVeT1hAAoJEEy22O7T6HE4siIQAIEWEANlJYJb/aoGWnFk0c/n
 TtNDxPdXo1g1LEAZ8jCQh9uUv1/UK26ybcvpkJDfmPrZ86tTqJx10qPs9z+cWt+3
 J2ZAYhhQC78TTgb8GZGEW7F968jhcfQg8mX9WZZGHEEUIXXryOyFYaFLZFyA4d5O
 DLIVWl5r5f6HBjJlydflO9cATOW3IZ86EZYQFfKohevkQhPBUcDh8VYrMaHfDwS4
 mioylHs3dhch2PbeOX6uEQNRttLw8i2LhCrs6iss367eajZ3/GStiD4HFrQRI5Rv
 7TEabhoxyoVbg37hMde54AIhYCtj82sG9AD6hDPcHWb7vKuzh+pwZs1gCiepBSxX
 fGmC33ylwLCQSMoL1hqUY8I+TZ6yzjNxKd+ZTn0z3MZPGvqFBa3Ec2Sw46OWXiLi
 snOxepY4oBVUomEyhwfLRLp6cxpIux5WVnDvxeE/ZA/pHMmaJoT00HM32O0kXuRK
 lfOqZvlWKO7MT9pjcMlK9s/fg2mI1gd7c6srA62BPj1yClXpPdsCVaGwLnd63oQJ
 85S5y4MQf+B/cR8zM87BdRL2cLl6Js/VmhiMAiT4nt34/fHx8cyITvIh0K1md/5N
 IcpY0lAbvcQV4QkX11A5X+hF1lkzfhCpQ4Xh09Z9aoTICPC3l7uwFx+yL1Jq62I6
 LnIA2K42B6oerTBdBq+U
 =N2d9
 -----END PGP SIGNATURE-----

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

spice: fix segfault in qemu_spice_create_update, ui_info tweaks.

# gpg: Signature made Thu Jun 11 08:48:49 2015 BST 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-20150611-1:
  spice: ui_info tweaks
  spice-display: fix segfault in qemu_spice_create_update

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
master
Peter Maydell 2015-06-11 12:12:58 +01:00
commit 169b71331e
1 changed files with 13 additions and 13 deletions

View File

@ -199,7 +199,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
static const int blksize = 32;
int blocks = (surface_width(ssd->ds) + blksize - 1) / blksize;
int dirty_top[blocks];
int y, yoff, x, xoff, blk, bw;
int y, yoff1, yoff2, x, xoff, blk, bw;
int bpp = surface_bytes_per_pixel(ssd->ds);
uint8_t *guest, *mirror;
@ -214,13 +214,14 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
guest = surface_data(ssd->ds);
mirror = (void *)pixman_image_get_data(ssd->mirror);
for (y = ssd->dirty.top; y < ssd->dirty.bottom; y++) {
yoff = y * surface_stride(ssd->ds);
yoff1 = y * surface_stride(ssd->ds);
yoff2 = y * pixman_image_get_stride(ssd->mirror);
for (x = ssd->dirty.left; x < ssd->dirty.right; x += blksize) {
xoff = x * bpp;
blk = x / blksize;
bw = MIN(blksize, ssd->dirty.right - x);
if (memcmp(guest + yoff + xoff,
mirror + yoff + xoff,
if (memcmp(guest + yoff1 + xoff,
mirror + yoff2 + xoff,
bw * bpp) == 0) {
if (dirty_top[blk] != -1) {
QXLRect update = {
@ -660,7 +661,10 @@ static int interface_client_monitors_config(QXLInstance *sin,
{
SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
QemuUIInfo info;
int rc;
if (!dpy_ui_info_supported(ssd->dcl.con)) {
return 0; /* == not supported by guest */
}
if (!mc) {
return 1;
@ -675,14 +679,10 @@ static int interface_client_monitors_config(QXLInstance *sin,
info.width = mc->monitors[0].width;
info.height = mc->monitors[0].height;
}
rc = dpy_set_ui_info(ssd->dcl.con, &info);
dprint(1, "%s/%d: size %dx%d, rc %d <--- ==========================\n",
__func__, ssd->qxl.id, info.width, info.height, rc);
if (rc != 0) {
return 0; /* == not supported by guest */
} else {
return 1;
}
dpy_set_ui_info(ssd->dcl.con, &info);
dprint(1, "%s/%d: size %dx%d\n", __func__, ssd->qxl.id,
info.width, info.height);
return 1;
}
static const QXLInterface dpy_interface = {