summaryrefslogtreecommitdiffstats
path: root/ui/vnc.c
diff options
context:
space:
mode:
authorPeter Maydell2015-11-03 11:20:04 +0100
committerPeter Maydell2015-11-03 11:20:04 +0100
commit130d0bc6594d0cc6591d00312841891b3c187b07 (patch)
treea1082905a667d8aab9296beef46a9ce48f6b478e /ui/vnc.c
parentMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-11-02' into ... (diff)
parentvnc: fix bug: vnc server can't start when 'to' is specified (diff)
downloadqemu-130d0bc6594d0cc6591d00312841891b3c187b07.tar.gz
qemu-130d0bc6594d0cc6591d00312841891b3c187b07.tar.xz
qemu-130d0bc6594d0cc6591d00312841891b3c187b07.zip
Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20151103-1' into staging
ui: fixes for vnc, opengl and curses. # gpg: Signature made Tue 03 Nov 2015 09:53:24 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/kraxel/tags/pull-ui-20151103-1: vnc: fix bug: vnc server can't start when 'to' is specified vnc: allow fall back to RAW encoding ui/opengl: Reduce build required libraries for opengl ui/curses: Fix pageup/pagedown on -curses ui/curses: Support line graphics chars on -curses mode ui/curses: Fix monitor color with -curses when 256 colors Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/vnc.c')
-rw-r--r--ui/vnc.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index 7b37e3b01f..a47f2b382c 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -840,6 +840,8 @@ int vnc_raw_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
{
int n = 0;
+ bool encode_raw = false;
+ size_t saved_offs = vs->output.offset;
switch(vs->vnc_encoding) {
case VNC_ENCODING_ZLIB:
@@ -862,10 +864,24 @@ int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
n = vnc_zywrle_send_framebuffer_update(vs, x, y, w, h);
break;
default:
- vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW);
- n = vnc_raw_send_framebuffer_update(vs, x, y, w, h);
+ encode_raw = true;
break;
}
+
+ /* If the client has the same pixel format as our internal buffer and
+ * a RAW encoding would need less space fall back to RAW encoding to
+ * save bandwidth and processing power in the client. */
+ if (!encode_raw && vs->write_pixels == vnc_write_pixels_copy &&
+ 12 + h * w * VNC_SERVER_FB_BYTES <= (vs->output.offset - saved_offs)) {
+ vs->output.offset = saved_offs;
+ encode_raw = true;
+ }
+
+ if (encode_raw) {
+ vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW);
+ n = vnc_raw_send_framebuffer_update(vs, x, y, w, h);
+ }
+
return n;
}
@@ -3556,6 +3572,8 @@ void vnc_display_open(const char *id, Error **errp)
if (to) {
saddr->u.inet->has_to = true;
saddr->u.inet->to = to;
+ saddr->u.inet->has_to = true;
+ saddr->u.inet->to = to + 5900;
}
saddr->u.inet->ipv4 = saddr->u.inet->has_ipv4 = has_ipv4;
saddr->u.inet->ipv6 = saddr->u.inet->has_ipv6 = has_ipv6;