Commit fb437313284d74bc89060b8de5b9899bd9d1d3c3
1 parent
26f8b9cc
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
Showing
1 changed file
with
21 additions
and
2 deletions
vnc.c
... | ... | @@ -103,6 +103,10 @@ struct VncState |
103 | 103 | int last_x; |
104 | 104 | int last_y; |
105 | 105 | |
106 | + uint32_t vnc_encoding; | |
107 | + uint8_t tight_quality; | |
108 | + uint8_t tight_compression; | |
109 | + | |
106 | 110 | int major; |
107 | 111 | int minor; |
108 | 112 | |
... | ... | @@ -450,10 +454,14 @@ static void send_framebuffer_update_hextile(VncState *vs, int x, int y, int w, i |
450 | 454 | |
451 | 455 | static void send_framebuffer_update(VncState *vs, int x, int y, int w, int h) |
452 | 456 | { |
453 | - if (vnc_has_feature(vs, VNC_FEATURE_HEXTILE)) | |
457 | + switch(vs->vnc_encoding) { | |
458 | + case VNC_ENCODING_HEXTILE: | |
454 | 459 | send_framebuffer_update_hextile(vs, x, y, w, h); |
455 | - else | |
460 | + break; | |
461 | + default: | |
456 | 462 | send_framebuffer_update_raw(vs, x, y, w, h); |
463 | + break; | |
464 | + } | |
457 | 465 | } |
458 | 466 | |
459 | 467 | 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) |
1164 | 1172 | unsigned int enc = 0; |
1165 | 1173 | |
1166 | 1174 | vs->features = 0; |
1175 | + vs->vnc_encoding = 0; | |
1176 | + vs->tight_compression = 9; | |
1177 | + vs->tight_quality = 9; | |
1167 | 1178 | vs->absolute = -1; |
1168 | 1179 | dcl->dpy_copy = NULL; |
1169 | 1180 | |
... | ... | @@ -1171,12 +1182,14 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) |
1171 | 1182 | enc = encodings[i]; |
1172 | 1183 | switch (enc) { |
1173 | 1184 | case VNC_ENCODING_RAW: |
1185 | + vs->vnc_encoding = enc; | |
1174 | 1186 | break; |
1175 | 1187 | case VNC_ENCODING_COPYRECT: |
1176 | 1188 | dcl->dpy_copy = vnc_copy; |
1177 | 1189 | break; |
1178 | 1190 | case VNC_ENCODING_HEXTILE: |
1179 | 1191 | vs->features |= VNC_FEATURE_HEXTILE_MASK; |
1192 | + vs->vnc_encoding = enc; | |
1180 | 1193 | break; |
1181 | 1194 | case VNC_ENCODING_DESKTOPRESIZE: |
1182 | 1195 | vs->features |= VNC_FEATURE_RESIZE_MASK; |
... | ... | @@ -1193,6 +1206,12 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) |
1193 | 1206 | case VNC_ENCODING_WMVi: |
1194 | 1207 | vs->features |= VNC_FEATURE_WMVI_MASK; |
1195 | 1208 | break; |
1209 | + case VNC_ENCODING_COMPRESSLEVEL0 ... VNC_ENCODING_COMPRESSLEVEL0 + 9: | |
1210 | + vs->tight_compression = (enc & 0x0F); | |
1211 | + break; | |
1212 | + case VNC_ENCODING_QUALITYLEVEL0 ... VNC_ENCODING_QUALITYLEVEL0 + 9: | |
1213 | + vs->tight_quality = (enc & 0x0F); | |
1214 | + break; | |
1196 | 1215 | default: |
1197 | 1216 | VNC_DEBUG("Unknown encoding: %d (0x%.8x): %d\n", i, enc, enc); |
1198 | 1217 | break; | ... | ... |