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
This commit is contained in:
Peter Åstrand 2004-12-21 15:54:44 +00:00
parent 1b4b568981
commit dd747d86e7
4 changed files with 76 additions and 37 deletions

View File

@ -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)",

View File

@ -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

View File

@ -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.

View File

@ -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", "");