aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Halim <adaab301@student.liu.se>2023-07-10 11:15:33 +0200
committer= <adaab301@student.liu.se>2023-11-20 13:02:01 +0100
commitcd78d50a7353548619af92cdd2d427f54bc6f219 (patch)
treec4d23bbc5d1112eab8b122e32e31299e67b081a2
parent9abf88e8d6bcd12254d8da434e4935cb9fc26bc0 (diff)
downloadtigervnc-cd78d50a7353548619af92cdd2d427f54bc6f219.tar.gz
tigervnc-cd78d50a7353548619af92cdd2d427f54bc6f219.zip
Use compressionLevel in ZRLEEncoder
This change makes the ZRLEEncoder respect a client's desired compressionLevel. The ZlibLevel option is marked deprecated and removed from the manpages.
-rw-r--r--common/rfb/ZRLEEncoder.cxx17
-rw-r--r--common/rfb/ZRLEEncoder.h2
-rw-r--r--unix/x0vncserver/x0vncserver.man6
-rw-r--r--unix/xserver/hw/vnc/Xvnc.man6
4 files changed, 17 insertions, 14 deletions
diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx
index 4e25d49f..ad3aec1a 100644
--- a/common/rfb/ZRLEEncoder.cxx
+++ b/common/rfb/ZRLEEncoder.cxx
@@ -28,15 +28,23 @@
#include <rfb/SConnection.h>
#include <rfb/ZRLEEncoder.h>
#include <rfb/Configuration.h>
+#include <rfb/LogWriter.h>
using namespace rfb;
-IntParameter zlibLevel("ZlibLevel","Zlib compression level",-1);
+static LogWriter vlog("ZRLEEncoder");
+
+IntParameter zlibLevel("ZlibLevel","[DEPRECATED] Zlib compression level",-1);
ZRLEEncoder::ZRLEEncoder(SConnection* conn)
: Encoder(conn, encodingZRLE, EncoderPlain, 127),
- zos(0,zlibLevel), mos(129*1024)
+ zos(0, 2), mos(129*1024)
{
+ if (zlibLevel != -1) {
+ vlog.info("Warning: The ZlibLevel option is deprecated and is "
+ "ignored by the server. The compression level can be set "
+ "by the client instead.");
+ }
zos.setUnderlying(&mos);
}
@@ -50,6 +58,11 @@ bool ZRLEEncoder::isSupported()
return conn->client.supportsEncoding(encodingZRLE);
}
+void ZRLEEncoder::setCompressLevel(int level)
+{
+ zos.setCompressionLevel(level);
+}
+
void ZRLEEncoder::writeRect(const PixelBuffer* pb, const Palette& palette)
{
int x, y;
diff --git a/common/rfb/ZRLEEncoder.h b/common/rfb/ZRLEEncoder.h
index 4cfff75d..fa89f10f 100644
--- a/common/rfb/ZRLEEncoder.h
+++ b/common/rfb/ZRLEEncoder.h
@@ -32,6 +32,8 @@ namespace rfb {
virtual bool isSupported();
+ virtual void setCompressLevel(int level);
+
virtual void writeRect(const PixelBuffer* pb, const Palette& palette);
virtual void writeSolidRect(int width, int height,
const PixelFormat& pf,
diff --git a/unix/x0vncserver/x0vncserver.man b/unix/x0vncserver/x0vncserver.man
index c36ae34e..fda435bc 100644
--- a/unix/x0vncserver/x0vncserver.man
+++ b/unix/x0vncserver/x0vncserver.man
@@ -287,12 +287,6 @@ Use MIT-SHM extension if available. Using that extension accelerates reading
the screen. Default is on.
.
.TP
-.B \-ZlibLevel \fIlevel\fP
-Zlib compression level for ZRLE encoding (it does not affect Tight encoding).
-Acceptable values are between 0 and 9. Default is to use the standard
-compression level provided by the \fBzlib\fP(3) compression library.
-.
-.TP
.B \-ImprovedHextile
Use improved compression algorithm for Hextile encoding which achieves better
compression ratios by the cost of using slightly more CPU time. Default is
diff --git a/unix/xserver/hw/vnc/Xvnc.man b/unix/xserver/hw/vnc/Xvnc.man
index ea87deaf..4f26b07d 100644
--- a/unix/xserver/hw/vnc/Xvnc.man
+++ b/unix/xserver/hw/vnc/Xvnc.man
@@ -171,12 +171,6 @@ be either \fB0\fP (off), \fB1\fP (always) or \fB2\fP (auto). Default is
\fB2\fP.
.
.TP
-.B \-ZlibLevel \fIlevel\fP
-Zlib compression level for ZRLE encoding (it does not affect Tight encoding).
-Acceptable values are between 0 and 9. Default is to use the standard
-compression level provided by the \fBzlib\fP(3) compression library.
-.
-.TP
.B \-ImprovedHextile
Use improved compression algorithm for Hextile encoding which achieves better
compression ratios by the cost of using slightly more CPU time. Default is