vnc: bugfixes for -rc0

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJXjdZJAAoJEEy22O7T6HE4IXgP/2BiusAU8aAnwI7xl5yV2LgJ
 vN60ZF3bcrZ1e06gG8Khp1XmUzzMoEWJ7P8bz4FK0ZrfVULZTQajB1uJNT7wCPDS
 vnfl6a3Z7S2fp/J7nLxDTw9QXsojcU/3W0qZiIUHYdNFV5jtdhjW2f8lUiXnY+79
 w4kReIjDH6GO0QCosLYvsbqjEQJJNDWDb8YmjGb/vEFZAD6NmOzFIauIuWkSqJAs
 J7NYRe3QgSc3DfqwN764E9eqmsuGyCzcBqtbD1qymFl4Go9E5njLV3yJVvdNtH/1
 pDauIzjiyf0FlSxLdW+vRrE+AyL+ebEYLjRKvgX/pzIDZiM2Y3sLjaauK7Jxnn8i
 5nXlSnyIp1yzO5w55v8Ds3o0ww3ujlIbdD6ZQCOuc/If0SSHzOQZyZp+HCeiLz1E
 LWJUZfF94F/9nNzW6PLEfEFjNIPWPDXnEaZGG0fk5C1hK5sZn0VJYsq/s55bCXU5
 9107ZOsJgB+wrZYKbe8w5VuyuMzBK1qNk+9lvZ13fgy/rvQGbDn2D7Hh5d+StQ7+
 M6slCQwhhhw+IHF/BIx/QrT1vw9kQepowqDPEuYorAXRpkapmZv7AtR1lnnWDN09
 Xgn2cx4LoG6Af73qNMXbnIdlT+UuU/l1NxTjp4iu3MRuHdMc4/ni/0lEN7ENoYJM
 Acdi+WG9l1/XWQRU/SN1
 =nXtr
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20160719-1' into staging

vnc: bugfixes for -rc0

# gpg: Signature made Tue 19 Jul 2016 08:27:05 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# 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>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/pull-vnc-20160719-1:
  vnc-tight: fix regression with libxenstore
  vnc-enc-tight: fix off-by-one bug
  vnc: make sure we finish disconnect

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
master
Peter Maydell 2016-07-19 14:07:27 +01:00
commit 1df8ffb286
2 changed files with 28 additions and 8 deletions

View File

@ -461,9 +461,10 @@ static int tight_fill_palette(VncState *vs, int x, int y,
\
src = (uint##bpp##_t *) buf; \
\
for (i = 0; i < count; i++) { \
for (i = 0; i < count; ) { \
\
rgb = *src++; \
i++; \
rep = 0; \
while (i < count && *src == rgb) { \
rep++, src++, i++; \
@ -1457,11 +1458,17 @@ static int send_sub_rect_jpeg(VncState *vs, int x, int y, int w, int h,
}
#endif
static __thread VncPalette color_count_palette;
static __thread VncPalette *color_count_palette;
static __thread Notifier vnc_tight_cleanup_notifier;
static void vnc_tight_cleanup(Notifier *n, void *value)
{
g_free(color_count_palette);
color_count_palette = NULL;
}
static int send_sub_rect(VncState *vs, int x, int y, int w, int h)
{
VncPalette *palette = &color_count_palette;
uint32_t bg = 0, fg = 0;
int colors;
int ret = 0;
@ -1470,6 +1477,12 @@ static int send_sub_rect(VncState *vs, int x, int y, int w, int h)
bool allow_jpeg = true;
#endif
if (!color_count_palette) {
color_count_palette = g_malloc(sizeof(VncPalette));
vnc_tight_cleanup_notifier.notify = vnc_tight_cleanup;
qemu_thread_atexit_add(&vnc_tight_cleanup_notifier);
}
vnc_framebuffer_update(vs, x, y, w, h, vs->tight.type);
vnc_tight_start(vs);
@ -1490,17 +1503,19 @@ static int send_sub_rect(VncState *vs, int x, int y, int w, int h)
}
#endif
colors = tight_fill_palette(vs, x, y, w * h, &bg, &fg, palette);
colors = tight_fill_palette(vs, x, y, w * h, &bg, &fg, color_count_palette);
#ifdef CONFIG_VNC_JPEG
if (allow_jpeg && vs->tight.quality != (uint8_t)-1) {
ret = send_sub_rect_jpeg(vs, x, y, w, h, bg, fg, colors, palette,
force_jpeg);
ret = send_sub_rect_jpeg(vs, x, y, w, h, bg, fg, colors,
color_count_palette, force_jpeg);
} else {
ret = send_sub_rect_nojpeg(vs, x, y, w, h, bg, fg, colors, palette);
ret = send_sub_rect_nojpeg(vs, x, y, w, h, bg, fg, colors,
color_count_palette);
}
#else
ret = send_sub_rect_nojpeg(vs, x, y, w, h, bg, fg, colors, palette);
ret = send_sub_rect_nojpeg(vs, x, y, w, h, bg, fg, colors,
color_count_palette);
#endif
return ret;

View File

@ -1024,6 +1024,11 @@ static int find_and_clear_dirty_height(VncState *vs,
static int vnc_update_client(VncState *vs, int has_dirty, bool sync)
{
if (vs->disconnecting) {
vnc_disconnect_finish(vs);
return 0;
}
vs->has_dirty += has_dirty;
if (vs->need_update && !vs->disconnecting) {
VncDisplay *vd = vs->vd;