vnc updates and ui move
cover vnc updates and ui move
Hi,
This set starts by adding JPEG and gradient to tight, then move all ui code in the ui/ subdirectory.
Thanks,
Corentin Chary (5):
vnc: tight: add JPEG and gradient subencoding with smooth image
detection
vnc: JPEG should be disabled if the client don't set tight quality
vnc: add lossless option
ui: move all ui components in ui/
vnc: rename vnc-encoding-* vnc-enc-*
Makefile | 38 +- Makefile.objs | 22 +- Makefile.target | 1 + cocoa.m | 1014 ---------------- configure | 33 + curses.c | 365 ------ curses_keys.h | 508 -------- d3des.c | 424 ------- d3des.h | 51 - keymaps.c | 210 ---- keymaps.h | 77 -- qemu-options.hx | 5 + sdl.c | 879 -------------- sdl_keysym.h | 277 ----- sdl_zoom.c | 95 -- sdl_zoom.h | 25 - sdl_zoom_template.h | 225 ---- ui/cocoa.m | 1014 ++++++++++++++++ ui/curses.c | 365 ++++++ ui/curses_keys.h | 508 ++++++++ ui/d3des.c | 424 +++++++ ui/d3des.h | 51 + ui/keymaps.c | 210 ++++ ui/keymaps.h | 77 ++ ui/sdl.c | 879 ++++++++++++++ ui/sdl_keysym.h | 277 +++++ ui/sdl_zoom.c | 95 ++ ui/sdl_zoom.h | 25 + ui/sdl_zoom_template.h | 225 ++++ ui/vnc-auth-sasl.c | 637 ++++++++++ ui/vnc-auth-sasl.h | 74 ++ ui/vnc-auth-vencrypt.c | 175 +++ ui/vnc-auth-vencrypt.h | 33 + ui/vnc-enc-hextile-template.h | 211 ++++ ui/vnc-enc-hextile.c | 116 ++ ui/vnc-enc-tight.c | 1522 ++++++++++++++++++++++++ ui/vnc-enc-tight.h | 181 +++ ui/vnc-enc-zlib.c | 152 +++ ui/vnc-tls.c | 445 +++++++ ui/vnc-tls.h | 76 ++ ui/vnc.c | 2631 +++++++++++++++++++++++++++++++++++++++++ ui/vnc.h | 430 +++++++ ui/vnc_keysym.h | 324 +++++ ui/x_keymap.c | 168 +++ ui/x_keymap.h | 32 + vnc-auth-sasl.c | 637 ---------- vnc-auth-sasl.h | 74 -- vnc-auth-vencrypt.c | 175 --- vnc-auth-vencrypt.h | 33 - vnc-encoding-hextile.c | 116 -- vnc-encoding-tight.c | 961 --------------- vnc-encoding-tight.h | 176 --- vnc-encoding-zlib.c | 152 --- vnc-tls.c | 445 ------- vnc-tls.h | 76 -- vnc.c | 2629 ---------------------------------------- vnc.h | 424 ------- vnc_keysym.h | 324 ----- vnchextile.h | 211 ---- x_keymap.c | 168 --- x_keymap.h | 32 - 61 files changed, 11413 insertions(+), 10826 deletions(-) delete mode 100644 cocoa.m delete mode 100644 curses.c delete mode 100644 curses_keys.h delete mode 100644 d3des.c delete mode 100644 d3des.h delete mode 100644 keymaps.c delete mode 100644 keymaps.h delete mode 100644 sdl.c delete mode 100644 sdl_keysym.h delete mode 100644 sdl_zoom.c delete mode 100644 sdl_zoom.h delete mode 100644 sdl_zoom_template.h create mode 100644 ui/cocoa.m create mode 100644 ui/curses.c create mode 100644 ui/curses_keys.h create mode 100644 ui/d3des.c create mode 100644 ui/d3des.h create mode 100644 ui/keymaps.c create mode 100644 ui/keymaps.h create mode 100644 ui/sdl.c create mode 100644 ui/sdl_keysym.h create mode 100644 ui/sdl_zoom.c create mode 100644 ui/sdl_zoom.h create mode 100644 ui/sdl_zoom_template.h create mode 100644 ui/vnc-auth-sasl.c create mode 100644 ui/vnc-auth-sasl.h create mode 100644 ui/vnc-auth-vencrypt.c create mode 100644 ui/vnc-auth-vencrypt.h create mode 100644 ui/vnc-enc-hextile-template.h create mode 100644 ui/vnc-enc-hextile.c create mode 100644 ui/vnc-enc-tight.c create mode 100644 ui/vnc-enc-tight.h create mode 100644 ui/vnc-enc-zlib.c create mode 100644 ui/vnc-tls.c create mode 100644 ui/vnc-tls.h create mode 100644 ui/vnc.c create mode 100644 ui/vnc.h create mode 100644 ui/vnc_keysym.h create mode 100644 ui/x_keymap.c create mode 100644 ui/x_keymap.h delete mode 100644 vnc-auth-sasl.c delete mode 100644 vnc-auth-sasl.h delete mode 100644 vnc-auth-vencrypt.c delete mode 100644 vnc-auth-vencrypt.h delete mode 100644 vnc-encoding-hextile.c delete mode 100644 vnc-encoding-tight.c delete mode 100644 vnc-encoding-tight.h delete mode 100644 vnc-encoding-zlib.c delete mode 100644 vnc-tls.c delete mode 100644 vnc-tls.h delete mode 100644 vnc.c delete mode 100644 vnc.h delete mode 100644 vnc_keysym.h delete mode 100644 vnchextile.h delete mode 100644 x_keymap.c delete mode 100644 x_keymap.h
PATCH 1/5 vnc: tight: add JPEG and gradient subencoding with smooth image detection
Add gradient filter and JPEG compression with an heuristic to detect how lossy the comppression will be. This code has been adapted from libvncserver/tight.c.
JPEG support can be enabled/disabled at compile time with --enable-vnc-jpeg and --disable-vnc-jpeg.
--- Makefile.target | 1 + configure | 33 +++ vnc-encoding-tight.c | 559 +++++++++++++++++++++++++++++++++++++++++++++++++- vnc-encoding-tight.h | 5 + vnc.h | 4 + 5 files changed, 601 insertions(+), 1 deletions(-)
Makefile.target +1 -0
@@ -177,6 +177,7 @@ LIBS+=-lz QEMU_CFLAGS += $(VNC_TLS_CFLAGS) QEMU_CFLAGS += $(VNC_SASL_CFLAGS) +QEMU_CFLAGS += $(VNC_JPEG_CFLAGS) # xen backend driver support obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
configure +33 -0
@@ -263,6 +263,7 @@ uuid="" vde="" vnc_tls="" vnc_sasl="" +vnc_jpeg="" xen="" linux_aio="" vhost_net=""
@@ -547,6 +548,10 @@ for opt do ;; --enable-vnc-sasl) vnc_sasl="yes" ;; + --disable-vnc-jpeg) vnc_jpeg="no" + ;; + --enable-vnc-jpeg) vnc_jpeg="yes" + ;; --disable-slirp) slirp="no" ;; --disable-uuid) uuid="no"
@@ -779,6 +784,8 @@ echo " --disable-vnc-tls disable TLS encryption for VNC server" echo " --enable-vnc-tls enable TLS encryption for VNC server" echo " --disable-vnc-sasl disable SASL encryption for VNC server" echo " --enable-vnc-sasl enable SASL encryption for VNC server" +echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" +echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" echo " --disable-curses disable curses output" echo " --enable-curses enable curses output" echo " --disable-curl disable curl connectivity"
@@ -1191,6 +1198,27 @@ EOF fi ########################################## +# VNC JPEG detection +if test "$vnc_jpeg" = "yes" ; then +cat > $TMPC <<EOF +#include <stdio.h> +#include <jpeglib.h> +int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } +EOF + vnc_jpeg_cflags="" + vnc_jpeg_libs="-ljpeg" + if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then + vnc_jpeg=yes + libs_softmmu="$vnc_jpeg_libs $libs_softmmu" + else + if test "$vnc_jpeg" = "yes" ; then + feature_not_found "vnc-jpeg" + fi + vnc_jpeg=no + fi +fi + +########################################## # fnmatch() probe, used for ACL routines fnmatch="no" cat > $TMPC << EOF
@@ -2019,6 +2047,7 @@ echo "Block whitelist $block_drv_whitelist" echo "Mixer emulation $mixemu" echo "VNC TLS support $vnc_tls" echo "VNC SASL support $vnc_sasl" +echo "VNC JPEG support $vnc_jpeg" if test -n "$sparc_cpu"; then echo "Target Sparc Arch $sparc_cpu" fi
@@ -2158,6 +2187,10 @@ if test "$vnc_sasl" = "yes" ; then echo "CONFIG_VNC_SASL=y" >> $config_host_mak echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak fi +if test "$vnc_jpeg" = "yes" ; then + echo "CONFIG_VNC_JPEG=y" >> $config_host_mak + echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak +fi if test "$fnmatch" = "yes" ; then echo "CONFIG_FNMATCH=y" >> $config_host_mak fi
vnc-encoding-tight.c +558 -1
607 lines not on this page · raw message
vnc-encoding-tight.h +5 -0
@@ -173,4 +173,9 @@#define VNC_TIGHT_MIN_SOLID_SUBRECT_SIZE 2048#define VNC_TIGHT_MAX_SPLIT_TILE_SIZE 16 +#define VNC_TIGHT_JPEG_MIN_RECT_SIZE 4096 +#define VNC_TIGHT_DETECT_SUBROW_WIDTH 7 +#define VNC_TIGHT_DETECT_MIN_WIDTH 8 +#define VNC_TIGHT_DETECT_MIN_HEIGHT 8 +#endif /* VNC_ENCODING_TIGHT_H */
vnc.h +4 -0
@@ -176,6 +176,10 @@ struct VncStateBuffer tight;Buffer tight_tmp;Buffer tight_zlib; +Buffer tight_gradient; +#ifdef CONFIG_VNC_JPEG +Buffer tight_jpeg; +#endif int tight_levels[4 ];z_stream tight_stream[4 ];
Signature · 1 line
1.7.1
PATCH 2/5 vnc: JPEG should be disabled if the client don't set tight quality
In reply to Corentin CharyDisable JPEG compression by default and only enable it if the VNC client has sent the requested quality.
--- vnc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
vnc.c +1 -1
@@ -1644,7 +1644,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) vs->features =0 ; vs->vnc_encoding =0 ; vs->tight_compression =9 ; - vs->tight_quality =9 ; + vs->tight_quality =-1 ;/* Lossless by default */ vs->absolute =-1 ;/*
Signature · 1 line
1.7.1
[Qemu-devel] Re: [PATCH 2/5] vnc: JPEG should be disabled if the client don't set tight quality
Quoted 13 lines · Corentin Chary
Disable JPEG compression by default and only enable it if the VNC client has sent the requested quality.
Signed-off-by Corentin Chary <[email protected]>---
vnc.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)vnc.c +0
-0
vnc.c static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) · line 1647
Quoted 5 lines
vnc.c +1
-1@@ -1644,7 +1644,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) vs->features =0 ; vs->vnc_encoding =0 ; vs->tight_compression =9 ; - vs->tight_quality =9 ; + vs->tight_quality =-1 ;/* Lossless by default */
So what's the threshold? When do you start to be lossy?
Alex
[Qemu-devel] Re: [PATCH 2/5] vnc: JPEG should be disabled if the client don't set tight quality
Quoted 11 lines · Alexander Graf
Quoted 8 lines · Corentin Chary
Disable JPEG compression by default and only enable it if the VNC client has sent the requested quality.
Signed-off-by Corentin Chary<[email protected]>---
vnc.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 13 lines
vnc.c static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) · line 1648
Quoted 11 lines
vnc.c +1
-1@@ -1644,7 +1644,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) vs->features =0 ; vs->vnc_encoding =0 ; vs->tight_compression =9 ; - vs->tight_quality =9 ; + vs->tight_quality =-1 ;/* Lossless by default */ So what's the threshold? When do you start to be lossy?
When the client explicitly requests it.
Regards,
Anthony Liguori
Quoted 3 lines
Alex
[Qemu-devel] Re: [PATCH 2/5] vnc: JPEG should be disabled if the client don't set tight quality
Quoted 26 lines · Anthony Liguori
Quoted 11 lines · Alexander Graf
Quoted 8 lines · Corentin Chary
Disable JPEG compression by default and only enable it if the VNC client has sent the requested quality.
Signed-off-by Corentin Chary<[email protected]>---
vnc.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)Quoted 13 lines
vnc.c static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) · line 1648
Quoted 11 lines
vnc.c +1
-1@@ -1644,7 +1644,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) vs->features =0 ; vs->vnc_encoding =0 ; vs->tight_compression =9 ; - vs->tight_quality =9 ; + vs->tight_quality =-1 ;/* Lossless by default */ So what's the threshold? When do you start to be lossy?
Quoted 1 line
When the client explicitly requests it.
The tight quality level is a slider on most clients. A user doesn't know when it starts being lossy. He also can only choose 0 as the lowest (iirc). And IIRC the X tightvnc client also always sent the quality level.
Alex
[Qemu-devel] Re: [PATCH 2/5] vnc: JPEG should be disabled if the client don't set tight quality
Quoted 6 lines
The tight quality level is a slider on most clients. A user doesn't know when it starts being lossy. He also can only choose 0 as the lowest (iirc). And IIRC the X tightvnc client also always sent the quality level.
Alex
You can use -nojpeg for that. Most vnc clients have this options.
Signature · 2 lines
Corentin Chary http://xf.iksaif.net
[Qemu-devel] Re: [PATCH 2/5] vnc: JPEG should be disabled if the client don't set tight quality
Quoted 8 lines · Corentin Chary
Quoted 6 lines
The tight quality level is a slider on most clients. A user doesn't know when it starts being lossy. He also can only choose 0 as the lowest (iirc). And IIRC the X tightvnc client also always sent the quality level.
Alex
You can use -nojpeg for that. Most vnc clients have this options.
Phew - I didn't even know of that option until now. I guess that's a bad sign? :)
One way I thought of it was to start being lossy as of quality level 6 or so. That way people who accidently enable jpeg still know "high quality means lossless". I'm not sure Anthony agrees on this though.
Alex
[Qemu-devel] Re: [PATCH 2/5] vnc: JPEG should be disabled if the client don't set tight quality
Quoted 7 lines
Phew - I didn't even know of that option until now. I guess that's a bad sign? :)
One way I thought of it was to start being lossy as of quality level 6 or so. That way people who accidently enable jpeg still know "high quality means lossless". I'm not sure Anthony agrees on this though.
Alex
If client set a quality it means that we are allowed to send something lossy. If you don't want this behavior, you can add the lossless (or lossy) parameter :).
Signature · 2 lines
Corentin Chary http://xf.iksaif.net
PATCH 3/5 vnc: add lossless option
In reply to Corentin CharyThe lossless option can be used to force lossless compression by disabling all lossy encodings like gradient or jpeg.
--- qemu-options.hx | 5 +++++ vnc-encoding-tight.c | 4 ++++ vnc.c | 2 ++ vnc.h | 2 ++ 4 files changed, 13 insertions(+), 0 deletions(-)
qemu-options.hx +5 -0
@@ -828,6 +828,11 @@ empty, with a @code{deny} policy. Thus no one will be allowed to use the VNC server until the ACLs have been loaded. This can be achieved using the @code{acl} monitor command. +@item lossless + +Turn off all lossy compression methods (gradient, JPEG, ...). If this +option is set, VNC client will only receive lossless framebuffer updates. + @end table ETEXI
vnc-encoding-tight.c +4 -0
@@ -230,6 +230,10 @@ tight_detect_smooth_image(VncState *vs, int w, int h)int compression = vs->tight_compression;int quality = vs->tight_quality; +if (vs->vd->lossless) { +return 0 ; + } +if (ds_get_bytes_per_pixel (vs->ds) ==1 || vs->clientds.pf.bytes_per_pixel ==1 || w <VNC_TIGHT_DETECT_MIN_WIDTH || h <VNC_TIGHT_DETECT_MIN_HEIGHT ) {
vnc.c +2 -0
@@ -2482,6 +2482,8 @@ int vnc_display_open(DisplayState *ds, const char *display)#endif }else if (strncmp (options,"acl" ,3 ) ==0 ) { acl =1 ; + }else if (strncmp (options,"lossless" ,8 ) ==0 ) { + vs->lossless = true; } }
vnc.h +2 -0
@@ -33,6 +33,7 @@#include "monitor.h" #include "audio/audio.h" #include <zlib.h> +#include <stdbool.h> #include "keymaps.h"
@@ -111,6 +112,7 @@ struct VncDisplaychar *display;char *password;int auth; +bool lossless;#ifdef CONFIG_VNC_TLS int subauth;/* Used by VeNCrypt */ VncDisplayTLS tls;
Signature · 1 line
1.7.1
[Qemu-devel] Re: [PATCH 3/5] vnc: add lossless option
Quoted 2 lines · Corentin Chary
The lossless option can be used to force lossless compression by disabling all lossy encodings like gradient or jpeg.
I think this should be reverse. Be lossless by default, but have a lossy option.
Alex
[Qemu-devel] Re: [PATCH 3/5] vnc: add lossless option
Quoted 8 lines · Alexander Graf
Quoted 3 lines · Corentin Chary
The lossless option can be used to force lossless compression by disabling all lossy encodings like gradient or jpeg.
I think this should be reverse. Be lossless by default, but have a lossy option.
I agree. I think we need to disable gradient by default. Maybe we can trigger gradient too whenever jpeg is enabled by the client.
Regards,
Anthony Liguori
Quoted 3 lines
Alex
PATCH 5/5 vnc: rename vnc-encoding-* vnc-enc-*
In reply to Corentin CharyFor the same reason that we don't use vnc-authentication-sasl.c but vnc-auth-sals.c. Because it's tooooo long.
--- Makefile.objs | 4 +- ui/vnc-enc-hextile-template.h | 211 ++++++ ui/vnc-enc-hextile.c | 116 ++++ ui/vnc-enc-tight.c | 1522 +++++++++++++++++++++++++++++++++++++++++ ui/vnc-enc-tight.h | 181 +++++ ui/vnc-enc-zlib.c | 152 ++++ ui/vnc-encoding-hextile.c | 116 ---- ui/vnc-encoding-tight.c | 1522 ----------------------------------------- ui/vnc-encoding-tight.h | 181 ----- ui/vnc-encoding-zlib.c | 152 ---- ui/vnchextile.h | 211 ------ 11 files changed, 2184 insertions(+), 2184 deletions(-) create mode 100644 ui/vnc-enc-hextile-template.h create mode 100644 ui/vnc-enc-hextile.c create mode 100644 ui/vnc-enc-tight.c create mode 100644 ui/vnc-enc-tight.h create mode 100644 ui/vnc-enc-zlib.c delete mode 100644 ui/vnc-encoding-hextile.c delete mode 100644 ui/vnc-encoding-tight.c delete mode 100644 ui/vnc-encoding-tight.h delete mode 100644 ui/vnc-encoding-zlib.c delete mode 100644 ui/vnchextile.h
Makefile.objs +2 -2
@@ -104,8 +104,8 @@ ui-obj-y += keymaps.o ui-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o ui-obj-$(CONFIG_CURSES) += curses.o ui-obj-y += vnc.o d3des.o -ui-obj-y += vnc-encoding-zlib.o vnc-encoding-hextile.o -ui-obj-y += vnc-encoding-tight.o +ui-obj-y += vnc-enc-zlib.o vnc-enc-hextile.o +ui-obj-y += vnc-enc-tight.o ui-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o ui-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o ui-obj-$(CONFIG_COCOA) += cocoa.o
ui/vnc-enc-hextile-template.h new file +211 -0
211 lines not on this page · raw message
ui/vnc-enc-hextile.c new file +116 -0
116 lines not on this page · raw message
ui/vnc-enc-tight.c new file +1522 -0
1,522 lines not on this page · raw message
ui/vnc-enc-tight.h new file +181 -0
181 lines not on this page · raw message
ui/vnc-enc-zlib.c new file +152 -0
152 lines not on this page · raw message
ui/vnc-encoding-hextile.c deleted +0 -116
116 lines not on this page · raw message
ui/vnc-encoding-tight.c deleted +0 -1522
692 lines not on this page · raw message
ui/vnc-encoding-tight.h deleted +0 -181
181 lines not on this page · raw message
ui/vnc-encoding-zlib.c deleted +0 -152
152 lines not on this page · raw message
ui/vnchextile.h deleted +0 -211
211 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.1
Part of the diff is not shown here. View the raw message.
[Qemu-devel] Re: [PATCH 5/5] vnc: rename vnc-encoding-* vnc-enc-*
Quoted 2 lines · Corentin Chary
For the same reason that we don't use
vnc-authentication-sasl.cbutvnc-auth-sals.c. Because it's tooooo long.
This patch would certainly also benefit from the move detection.
Alex
A message that is not in the archive (sent off-list or not yet received): [email protected]
[Qemu-devel] Re: [PATCH 4/5] ui: move all ui components in ui/
Quoted 3 lines · Corentin Chary
Move sdl, vnc, curses and cocoa UI into ui/ to cleanup the root directory. Also remove some unnecessary explicit targets from
Makefile.
There's a magic command to tell git to indicate moves as moves. I guess that'd be a good idea here :)
Alex
[Qemu-devel] Re: [PATCH 4/5] ui: move all ui components in ui/
Quoted 12 lines · Alexander Graf
Quoted 3 lines · Corentin Chary
Move sdl, vnc, curses and cocoa UI into ui/ to cleanup the root directory. Also remove some unnecessary explicit targets from
Makefile.There's a magic command to tell git to indicate moves as moves. I guess that'd be a good idea here :)
Alex
Hum .. right.
Signature · 2 lines
Corentin Chary http://xf.iksaif.net