diff options
author | Peter Åstrand <astrand@cendio.se> | 2004-12-21 15:54:44 +0000 |
---|---|---|
committer | Peter Åstrand <astrand@cendio.se> | 2004-12-21 15:54:44 +0000 |
commit | dd747d86e7cf6c05a6e21d495d9e7e051381929c (patch) | |
tree | e89bed8c7a56b70c9482311c3f68df5ddf966dcd | |
parent | 1b4b5689810bfb3d787673331936ab7cdda9cc4b (diff) | |
download | tigervnc-dd747d86e7cf6c05a6e21d495d9e7e051381929c.tar.gz tigervnc-dd747d86e7cf6c05a6e21d495d9e7e051381929c.zip |
New AutoSelect policy:
* Never autoselect ZRLE, chose Tight instead.
* Only select Hextile if we've been timing for at least a second.
* Start with full colour enabled. Turn full colour on/off as the
bandwidth changes. Note, however: This code is currently disabled. See
comment.
* Default to lowcolourlevel 2 instead of 1.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@49 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | vncviewer/CViewOptions.cxx | 6 | ||||
-rw-r--r-- | vncviewer/cview.cxx | 54 | ||||
-rw-r--r-- | vncviewer_unix/CConn.cxx | 47 | ||||
-rw-r--r-- | vncviewer_unix/vncviewer.cxx | 6 |
4 files changed, 76 insertions, 37 deletions
diff --git a/vncviewer/CViewOptions.cxx b/vncviewer/CViewOptions.cxx index 1740c191..d4c647a1 100644 --- a/vncviewer/CViewOptions.cxx +++ b/vncviewer/CViewOptions.cxx @@ -35,13 +35,11 @@ static BoolParameter useLocalCursor("UseLocalCursor", "Render the mouse cursor l static BoolParameter useDesktopResize("UseDesktopResize", "Support dynamic desktop resizing", true); static BoolParameter fullColour("FullColour", - "Use full colour (default is to use low colour " - "unless auto select decides the link is fast enough)", - false); + "Use full colour", true); static IntParameter lowColourLevel("LowColourLevel", "Colour level to use on slow connections. " "0 = Very Low (8 colours), 1 = Low (64 colours), 2 = Medium (256 colours)", - 1); + 2); static BoolParameter fullScreen("FullScreen", "Use the whole display to show the remote desktop." "(Press F8 to access the viewer menu)", diff --git a/vncviewer/cview.cxx b/vncviewer/cview.cxx index 782758de..5f8a901f 100644 --- a/vncviewer/cview.cxx +++ b/vncviewer/cview.cxx @@ -1112,41 +1112,63 @@ CView::framebufferUpdateEnd() { showLocalCursor(); } + +// Note: The method below is duplicated in vncviewer_unix/CConn.cxx! + // autoSelectFormatAndEncoding() chooses the format and encoding appropriate // to the connection speed: +// // Above 16Mbps (timing for at least a second), same machine, switch to raw // Above 3Mbps, switch to hextile -// Below 1.5Mbps, switch to ZRLE -// Above 1Mbps, switch to full colour mode -void +// Otherwise, switch to Tight +// +// Above 256Kbps, use full colour mode +// +void CView::autoSelectFormatAndEncoding() { int kbitsPerSecond = sock->inStream().kbitsPerSecond(); unsigned int newEncoding = options.preferredEncoding; + bool newFullColour = options.fullColour; + unsigned int timeWaited = sock->inStream().timeWaited(); - if (kbitsPerSecond > 16000 && sameMachine && - sock->inStream().timeWaited() >= 10000) { + // Select best encoding + if (kbitsPerSecond > 16000 && sameMachine && timeWaited >= 10000) { newEncoding = encodingRaw; - } else if (kbitsPerSecond > 3000) { + } else if (kbitsPerSecond > 3000 && timeWaited >= 10000) { newEncoding = encodingHextile; - } else if (kbitsPerSecond < 1500) { - newEncoding = encodingZRLE; + } else { + newEncoding = encodingTight; } if (newEncoding != options.preferredEncoding) { vlog.info("Throughput %d kbit/s - changing to %s encoding", - kbitsPerSecond, encodingName(newEncoding)); + kbitsPerSecond, encodingName(newEncoding)); options.preferredEncoding = newEncoding; encodingChange = true; } - if (kbitsPerSecond > 1000) { - if (!options.fullColour) { - vlog.info("Throughput %d kbit/s - changing to full colour", - kbitsPerSecond); - options.fullColour = true; - formatChange = true; - } + if (kbitsPerSecond == 0) { + return; } + + // FIXME: The code below is currently disabled, since, as far as I + // understand, it is not possible to switch pixel format on the fly + // against TightVNC 1.2.X servers, for example. See mail to the + // mailing list, sent on 2004-12-21. If we cannot find any better + // solution, we could add code to only allow pixel format switching + // against VNC4 servers (if these don't use deferred updates). + +#if 0 + // Select best color level + newFullColour = (kbitsPerSecond > 256); + if (newFullColour != options.fullColour) { + vlog.info("Throughput %d kbit/s - full colour is now %s", + kbitsPerSecond, + newFullColour ? "enabled" : "disabled"); + options.fullColour = newFullColour; + formatChange = true; + } +#endif } void diff --git a/vncviewer_unix/CConn.cxx b/vncviewer_unix/CConn.cxx index faab2a4b..692c6dd7 100644 --- a/vncviewer_unix/CConn.cxx +++ b/vncviewer_unix/CConn.cxx @@ -597,23 +597,30 @@ void CConn::reconfigureViewport() } } +// Note: The method below is duplicated in vncviewer/cview.cxx! + // autoSelectFormatAndEncoding() chooses the format and encoding appropriate // to the connection speed: +// // Above 16Mbps (timing for at least a second), same machine, switch to raw // Above 3Mbps, switch to hextile -// Below 1.5Mbps, switch to Tight -// Above 1Mbps, switch to full colour mode +// Otherwise, switch to Tight +// +// Above 256Kbps, use full colour mode +// void CConn::autoSelectFormatAndEncoding() { int kbitsPerSecond = sock->inStream().kbitsPerSecond(); unsigned int newEncoding = currentEncoding; + bool newFullColour = fullColour; + unsigned int timeWaited = sock->inStream().timeWaited(); - if (kbitsPerSecond > 16000 && sameMachine && - sock->inStream().timeWaited() >= 10000) { + // Select best encoding + if (kbitsPerSecond > 16000 && sameMachine && timeWaited >= 10000) { newEncoding = encodingRaw; - } else if (kbitsPerSecond > 3000) { + } else if (kbitsPerSecond > 3000 && timeWaited >= 10000) { newEncoding = encodingHextile; - } else if (kbitsPerSecond < 1500) { + } else { newEncoding = encodingTight; } @@ -624,14 +631,28 @@ void CConn::autoSelectFormatAndEncoding() encodingChange = true; } - if (kbitsPerSecond > 1000) { - if (!fullColour) { - vlog.info("Throughput %d kbit/s - changing to full colour", - kbitsPerSecond); - fullColour = true; - formatChange = true; - } + if (kbitsPerSecond == 0) { + return; } + + // FIXME: The code below is currently disabled, since, as far as I + // understand, it is not possible to switch pixel format on the fly + // against TightVNC 1.2.X servers, for example. See mail to the + // mailing list, sent on 2004-12-21. If we cannot find any better + // solution, we could add code to only allow pixel format switching + // against VNC4 servers (if these don't use deferred updates). + +#if 0 + // Select best color level + newFullColour = (kbitsPerSecond > 256); + if (newFullColour != fullColour) { + vlog.info("Throughput %d kbit/s - full colour is now %s", + kbitsPerSecond, + newFullColour ? "enabled" : "disabled"); + fullColour = newFullColour; + formatChange = true; + } +#endif } // checkEncodings() sends a setEncodings message if one is needed. diff --git a/vncviewer_unix/vncviewer.cxx b/vncviewer_unix/vncviewer.cxx index 431aee44..ad2db155 100644 --- a/vncviewer_unix/vncviewer.cxx +++ b/vncviewer_unix/vncviewer.cxx @@ -59,14 +59,12 @@ BoolParameter dotWhenNoCursor("DotWhenNoCursor", BoolParameter autoSelect("AutoSelect", "Auto select pixel format and encoding", true); BoolParameter fullColour("FullColour", - "Use full colour - otherwise low colour level is used" - " until AutoSelect decides the link is fast enough", - false); + "Use full colour", true); AliasParameter fullColor("FullColor", "Alias for FullColour", &fullColour); IntParameter lowColourLevel("LowColourLevel", "Colour level to use on slow connections. " "0 = Very Low (8 colours), 1 = Low (64 colours), " - "2 = Medium (256 colours)", 1); + "2 = Medium (256 colours)", 2); StringParameter preferredEncoding("PreferredEncoding", "Preferred encoding to use (ZRLE, hextile or" " raw) - implies AutoSelect=0", ""); |