diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-02 15:58:43 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-02 15:58:43 +0000 |
commit | fb437313284d74bc89060b8de5b9899bd9d1d3c3 (patch) | |
tree | 3c7e23bb3880a981410b3598218430afa2568307 /vnc.c | |
parent | Fix invalid #if in vnc.c when debugging is enabled (Alexander Graf) (diff) | |
download | qemu-kvm-fb437313284d74bc89060b8de5b9899bd9d1d3c3.tar.gz qemu-kvm-fb437313284d74bc89060b8de5b9899bd9d1d3c3.tar.bz2 qemu-kvm-fb437313284d74bc89060b8de5b9899bd9d1d3c3.zip |
Add some tight awareness to vnc.c (Alexander Graf)
This patch enables the vnc server to understand fundamental tight extensions.
It changes from a "Hextile or not" scheme when sending framebuffer updates to
a "preferred encoding", namely the last one set.
While this is not perfect, as actually a list of "preferred encodings" should
be kept, it's good enough for now.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6496 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vnc.c')
-rw-r--r-- | vnc.c | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -103,6 +103,10 @@ struct VncState int last_x; int last_y; + uint32_t vnc_encoding; + uint8_t tight_quality; + uint8_t tight_compression; + int major; int minor; @@ -450,10 +454,14 @@ static void send_framebuffer_update_hextile(VncState *vs, int x, int y, int w, i static void send_framebuffer_update(VncState *vs, int x, int y, int w, int h) { - if (vnc_has_feature(vs, VNC_FEATURE_HEXTILE)) + switch(vs->vnc_encoding) { + case VNC_ENCODING_HEXTILE: send_framebuffer_update_hextile(vs, x, y, w, h); - else + break; + default: send_framebuffer_update_raw(vs, x, y, w, h); + break; + } } static void vnc_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_y, int w, int h) @@ -1164,6 +1172,9 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) unsigned int enc = 0; vs->features = 0; + vs->vnc_encoding = 0; + vs->tight_compression = 9; + vs->tight_quality = 9; vs->absolute = -1; dcl->dpy_copy = NULL; @@ -1171,12 +1182,14 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) enc = encodings[i]; switch (enc) { case VNC_ENCODING_RAW: + vs->vnc_encoding = enc; break; case VNC_ENCODING_COPYRECT: dcl->dpy_copy = vnc_copy; break; case VNC_ENCODING_HEXTILE: vs->features |= VNC_FEATURE_HEXTILE_MASK; + vs->vnc_encoding = enc; break; case VNC_ENCODING_DESKTOPRESIZE: vs->features |= VNC_FEATURE_RESIZE_MASK; @@ -1193,6 +1206,12 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) case VNC_ENCODING_WMVi: vs->features |= VNC_FEATURE_WMVI_MASK; break; + case VNC_ENCODING_COMPRESSLEVEL0 ... VNC_ENCODING_COMPRESSLEVEL0 + 9: + vs->tight_compression = (enc & 0x0F); + break; + case VNC_ENCODING_QUALITYLEVEL0 ... VNC_ENCODING_QUALITYLEVEL0 + 9: + vs->tight_quality = (enc & 0x0F); + break; default: VNC_DEBUG("Unknown encoding: %d (0x%.8x): %d\n", i, enc, enc); break; |