Commit e7152a7f authored by runge's avatar runge

Allow range for X11VNC_SKIP_DISPLAY, document grab

Xserver issue.  Add progress_client() to proceed more quickly
thru handshake.  Improvements to turbovnc hack.
parent eb1cc760
2009-03-07 Karl Runge <runge@karlrunge.com>
* x11vnc: allow range for X11VNC_SKIP_DISPLAY, document grab
Xserver issue. Add progress_client() to proceed more quickly
thru handshake. Improvements to turbovnc hack.
2009-02-28 Karl Runge <runge@karlrunge.com>
* x11vnc: add kludge to experiment with turbovnc.
......
This diff is collapsed.
......@@ -2448,6 +2448,7 @@ void reverse_connect(char *str) {
p = list[j];
if ((n = do_reverse_connect(p)) != 0) {
progress_client();
rfbPE(-1);
}
cnt += n;
......
......@@ -1090,12 +1090,21 @@ void print_help(int mode) {
" As a special case, WAIT:cmd=FINDDISPLAY will run a\n"
" script that works on most Unixes to determine a user's\n"
" DISPLAY variable and xauthority data (see who(1)).\n"
" The option \"-find\" is an alias for this mode.\n"
"\n"
" To have this default script printed to stdout (e.g. for\n"
" customization) run with WAIT:cmd=FINDDISPLAY-print To\n"
" have the script run to print what display it would find\n"
" use \"-finddpy\" or WAIT:cmd=FINDDISPLAY-run\n"
"\n"
" The standard script runs xdpyinfo(1) run on potential\n"
" displays. If your X server(s) have a login greeter\n"
" that exclusively grabs the Xserver, then xdpyinfo\n"
" blocks forever and this mode will not work. See\n"
" www.karlrunge.com/x11vnc/faq.html#faq-display-manager\n"
" for how to disable this for dtgreet on Solaris and\n"
" possibly for other greeters.\n"
"\n"
" As another special case, WAIT:cmd=HTTPONCE will allow\n"
" x11vnc to service one http request and then exit.\n"
" This is usually done in -inetd mode to run on, say,\n"
......@@ -1109,10 +1118,12 @@ void print_help(int mode) {
" Where /.../x11vnc is the full path to x11vnc.\n"
" It is used in the Apache SSL-portal example (see FAQ).\n"
"\n"
" In this mode you can set X11VNC_SKIP_DISPLAY to a comma\n"
" separated list of displays (e.g. \":0,:1\") to ignore\n"
" in the finding process. This can also be set by the\n"
" user via \"nd=\" using \"-\" instead of \",\"\n"
" In this mode you can set X11VNC_SKIP_DISPLAY to a\n"
" comma separated list of displays (e.g. \":0,:1\") to\n"
" ignore in the finding process. The \":\" is optional.\n"
" Ranges n-m e.g. 0-20 can also be supplied. This string\n"
" can also be set by the connecting user via \"nd=\"\n"
" using \"+\" instead of \",\"\n"
"\n"
" An interesting option is WAIT:cmd=FINDCREATEDISPLAY\n"
" that is like FINDDISPLAY in that is uses the same method\n"
......@@ -1121,6 +1132,8 @@ void print_help(int mode) {
" for the user. This is the only time x11vnc tries to\n"
" actually start up an X server.\n"
"\n"
" The option \"-create\" is an alias for this mode.\n"
"\n"
" It will start looking for an open display number at :20\n"
" Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n\n"
"\n"
......
EXTRA_DIST=README apply_turbovnc convert tight.c turbojpeg.h undo_turbovnc
EXTRA_DIST=README apply_turbovnc convert convert_rfbserver tight.c turbojpeg.h undo_turbovnc
......@@ -4,6 +4,7 @@ INTRO:
This is a "patch" to make x11vnc/libvncserver work with TurboVNC:
http://www.virtualgl.org/About/TurboVNC
http://www.karlrunge.com/x11vnc/faq.html#faq-turbovnc
It is very experimental/kludgy. Not all TurboVNC features may be enabled.
We are currently evaluating whether TurboVNC support should be officially
......@@ -122,7 +123,9 @@ Whereas if you see this:
28/02/2009 00:54:46 fast read: reset defer ms to: 10
28/02/2009 00:54:46 screen setup finished.
that is very fast.
that is very fast. In such a situation you may want to dial down
x11vnc's delay, e.g.: -wait 5 -defer 5, or even smaller to push things
out more quickly.
We have only seen it this fast on Linux by using the nvidia proprietary
graphics drivers. The Xorg drivers are typically slow 10 MB/sec.
......
......@@ -16,18 +16,24 @@ if [ ! -f "$ldir/tight.c" ]; then
ls -l "$ldir/tight.c"
fail=1
fi
if [ ! -f "$ldir/rfbserver.c" ]; then
ls -l "$ldir/rfbserver.c"
fail=1
fi
if [ "X$fail" = "X1" ]; then
echo "Must be run from inside the directory containing 'apply_turbovnc'"
exit 1
fi
if [ -f "$ldir/tight.c.ORIG" ]; then
set -xv
else
set -xv
set -x
if [ ! -f "$ldir/tight.c.ORIG" ]; then
cp -p "$ldir/tight.c" "$ldir/tight.c.ORIG"
fi
if [ ! -f "$ldir/rfbserver.c.ORIG" ]; then
cp -p "$ldir/rfbserver.c" "$ldir/rfbserver.c.ORIG"
fi
perl ./convert ./tight.c > "$ldir/tight.c"
perl ./convert_rfbserver $ldir/rfbserver.c.ORIG > "$ldir/rfbserver.c"
cp -p ./turbojpeg.h "$ldir"
ls -l $ldir/tight.c* $ldir/turbojpeg.h
ls -l $ldir/tight.c* $ldir/rfbserver.c* $ldir/turbojpeg.h
......@@ -11,6 +11,7 @@ while (<>) {
#define xalloc malloc
#define xrealloc realloc
#define rfbTightNoZlib 0x0A
#define tightSubsampLevel correMaxWidth
END
next;
}
......@@ -22,11 +23,13 @@ END
$_ =~ s/\b\Q$func\E\b(\s*)\(/$func$1(cl, /;
}
}
if (/^\s*subsampLevel\s*=\s*cl/) {
$_ = "//$_";
print "subsampLevel = 0;\n";
}
$_ =~ s/cl->tightQualityLevel;/cl->tightQualityLevel * 10;/;
# if (/^\s*subsampLevel\s*=\s*cl/) {
# $_ = "//$_";
# print "subsampLevel = 0;\n";
# }
# $_ =~ s/cl->tightQualityLevel;/cl->tightQualityLevel * 10;/;
$_ =~ s/rfbScreen.pfbMemory/cl->scaledScreen->frameBuffer/g;
$_ =~ s/rfbScreen.paddedWidthInBytes/cl->scaledScreen->paddedWidthInBytes/g;
......
#!/usr/bin/perl
$saw_mark = 0;
$done = 0;
while (<>) {
if (! $saw_mark && /case rfbEncodingServerIdentity:/) {
$saw_mark = 1;
}
if ($saw_mark && !$done && /default:/) {
print;
print <<END;
/* for turbovnc */
#define rfbJpegQualityLevel1 0xFFFFFE01
#define rfbJpegQualityLevel100 0xFFFFFE64
#define rfbJpegSubsamp1X 0xFFFFFD00
#define rfbJpegSubsamp4X 0xFFFFFD01
#define rfbJpegSubsamp2X 0xFFFFFD02
#define rfbJpegSubsampGray 0xFFFFFD03
if ( enc >= (uint32_t)rfbJpegSubsamp1X &&
enc <= (uint32_t)rfbJpegSubsampGray ) {
/* XXX member really should be tightSubsample not correMaxWidth */
cl->correMaxWidth = enc & 0xFF;
rfbLog("Using JPEG subsampling %d for client %s\\n",
cl->correMaxWidth, cl->host);
} else if ( enc >= (uint32_t)rfbEncodingQualityLevel0 &&
enc <= (uint32_t)rfbEncodingQualityLevel9 ) {
static int JPEG_QUAL[10] = {
5, 10, 15, 25, 37, 50, 60, 70, 75, 80
};
cl->tightQualityLevel = JPEG_QUAL[enc & 0x0F];
/* XXX member really should be tightSubsample not correMaxWidth */
cl->correMaxWidth = 2;
rfbLog("Using image level Subsample %d Quality %d for client %s\\n",
cl->correMaxWidth, cl->tightQualityLevel, cl->host);
} else if ( enc >= (uint32_t)rfbJpegQualityLevel1 &&
enc <= (uint32_t)rfbJpegQualityLevel100 ) {
cl->tightQualityLevel = enc & 0xFF;
rfbLog("Using image quality level %d for client %s\\n",
cl->tightQualityLevel, cl->host);
} else
END
$done = 1;
next;
}
print;
}
......@@ -6,8 +6,13 @@ if [ ! -f "$ldir/tight.c.ORIG" ]; then
ls -l "$ldir/tight.c.ORIG"
exit 1
fi
if [ ! -f "$ldir/rfbserver.c.ORIG" ]; then
ls -l "$ldir/rfbserver.c.ORIG"
exit 1
fi
set -xv
rm -f "$ldir/tight.c" "$ldir/turbojpeg.h"
mv "$ldir/tight.c.ORIG" "$ldir/tight.c"
ls -l $ldir/tight.c*
mv "$ldir/rfbserver.c.ORIG" "$ldir/rfbserver.c"
ls -l $ldir/tight.c* $ldir/rfbserver.c*
......@@ -3345,7 +3345,7 @@ int scan_for_updates(int count_only) {
scan_count %= NSCAN;
/* some periodic maintenance */
if (subwin) {
if (subwin && scan_count % 4 == 0) {
set_offset(); /* follow the subwindow */
}
if (indexed_color && scan_count % 4 == 0) {
......
......@@ -8,6 +8,7 @@
#include "connections.h"
#include "sslcmds.h"
#include "unixpw.h"
#include "user.h"
#define OPENSSL_INETD 1
#define OPENSSL_VNC 2
......@@ -2558,6 +2559,8 @@ void accept_openssl(int mode, int presock) {
client->protocolMinorVersion = 8;
rfbAuthNewClient(client);
}
/* try to get RFB proto done now. */
progress_client();
} else {
rfbLog("SSL: accept_openssl: rfbNewClient failed.\n");
close(vsock);
......
......@@ -908,6 +908,62 @@ char find_display[] =
" echo \"$tf\"\n"
"}\n"
"\n"
"skip_display() {\n"
" dtry=$1\n"
" if [ \"X$X11VNC_SKIP_DISPLAY\" = \"X\" ]; then\n"
" # no skip list, return display:\n"
" echo \"$dtry\"\n"
" else\n"
" # user supplied skip list:\n"
" mat=\"\"\n"
" slist=\"\"\n"
" for skip in `echo \"$X11VNC_SKIP_DISPLAY\" | tr ',' '\\n'`\n"
" do\n"
" if echo \"$skip\" | sed -e 's/://g' | grep '^[0-9][0-9]*-[0-9][0-9]*$' > /dev/null; then\n"
" # a range n-m\n"
" min=`echo \"$skip\" | sed -e 's/://g' | awk -F- '{print $1}'`\n"
" max=`echo \"$skip\" | sed -e 's/://g' | awk -F- '{print $2}'`\n"
" if [ \"$min\" -le \"$max\" ]; then\n"
" while [ $min -le $max ]\n"
" do\n"
" if [ \"X$slist\" = \"X\" ]; then\n"
" slist=\"$min\"\n"
" else\n"
" slist=\"$slist $min\"\n"
" fi\n"
" min=`expr $min + 1`\n"
" done\n"
" continue\n"
" fi\n"
" fi\n"
" # a simple :n or n (or user supplied garbage).\n"
" if [ \"X$slist\" = \"X\" ]; then\n"
" slist=\"$skip\"\n"
" else\n"
" slist=\"$slist $skip\"\n"
" fi\n"
" done\n"
"\n"
" for skip in $slist\n"
" do\n"
" if echo \"$skip\" | grep \"^:\" > /dev/null; then\n"
" :\n"
" else\n"
" skip=\":$skip\"\n"
" fi\n"
" if echo \"$skip\" | grep \":$dtry\\>\" > /dev/null; then\n"
" mat=1\n"
" break\n"
" fi\n"
" done\n"
" if [ \"X$mat\" = \"X1\" ]; then\n"
" echo \"\"\n"
" else\n"
" echo \"$dtry\"\n"
" fi\n"
" fi\n"
"}\n"
"\n"
"\n"
"# this mode is to try to grab a display manager (gdm, kdm, xdm...) display\n"
"# when we are run as root (e.g. no one is logged in yet). We look at the\n"
......@@ -919,6 +975,10 @@ char find_display[] =
" do\n"
" da=`echo \"$pair\" | awk -F, '{print $1}'`\n"
" xa=`echo \"$pair\" | awk -F, '{print $2}'`\n"
" da=`skip_display \"$da\"`\n"
" if [ \"X$da\" = \"X\" ]; then\n"
" continue\n"
" fi\n"
" if [ -f $xa -a -r $xa ]; then\n"
" # if we have an xauth file, we proceed to test it:\n"
" #\n"
......@@ -1036,25 +1096,9 @@ char find_display[] =
" xa=`echo \"$p\" | awk -F, '{print $2}'`\n"
" d=`echo \"$p\" | sed -e 's/,.*$//' -e 's/://' -e 's/\\..*$//'`\n"
" ok=\"\"\n"
" if [ \"X$X11VNC_SKIP_DISPLAY\" != \"X\" ]; then\n"
" # user supplied skip list:\n"
" mat=\"\"\n"
" for skip in `echo $X11VNC_SKIP_DISPLAY | tr ',' '\\n'`\n"
" do\n"
" if echo \"$skip\" | grep \"^:\" > /dev/null; then\n"
" :\n"
" else\n"
" skip=\":$skip\"\n"
" fi\n"
" if echo \"$skip\" | grep \":$d\\>\" > /dev/null; then\n"
" mat=1\n"
" break\n"
" \n"
" fi\n"
" done\n"
" if [ \"X$mat\" = \"X1\" ]; then\n"
" continue\n"
" fi\n"
" d=`skip_display \"$d\"`\n"
" if [ \"X$d\" = \"X\" ]; then\n"
" continue;\n"
" fi\n"
"\n"
" # check for the local X11 files:\n"
......@@ -1158,6 +1202,10 @@ char find_display[] =
" else\n"
" myenv=\"FOO_BAR_=baz\"\n"
" fi\n"
" p=`skip_display \"$p\"`\n"
" if [ \"X$p\" = \"X\" ]; then\n"
" continue\n"
" fi\n"
" env \"$myenv\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" rc=$?\n"
" if [ $rc != 0 -a \"X$XAUTHLOCALHOSTNAME\" = \"X\" ]; then\n"
......
......@@ -22,6 +22,7 @@ int switch_user(char *user, int fb_mode);
int read_passwds(char *passfile);
void install_passwds(void);
void check_new_passwds(int force);
void progress_client(void);
int wait_for_client(int *argc, char** argv, int http);
rfbBool custom_passwd_check(rfbClientPtr cl, const char *response, int len);
char *xdmcp_insert = NULL;
......@@ -2137,7 +2138,7 @@ static void check_nodisplay(char **nd) {
t2 = strchr(t, ',');
if (t2) *t2 = '\0';
while (*t != '\0') {
if (*t == '-') {
if (*t == '+') {
*t = ',';
}
t++;
......@@ -2591,6 +2592,36 @@ void ssh_remote_tunnel(char *, int);
static XImage ximage_struct;
void progress_client(void) {
int i, j = 0, progressed = 0, db = 0;
double start = dnow();
if (getenv("PROGRESS_CLIENT_DBG")) {
rfbLog("progress_client: begin\n");
db = 1;
}
for (i = 0; i < 15; i++) {
if (latest_client) {
for (j = 0; j < 10; j++) {
if (latest_client->state != RFB_PROTOCOL_VERSION) {
progressed = 1;
break;
}
if (db) rfbLog("progress_client: calling-1 rfbCFD(1) %.6f\n", dnow()-start);
rfbCFD(1);
}
}
if (progressed) {
break;
}
if (db) rfbLog("progress_client: calling-2 rfbCFD(1) %.6f\n", dnow()-start);
rfbCFD(1);
}
if (!quiet) {
rfbLog("client progressed=%d in %d/%d %.6f s\n",
progressed, i, j, dnow() - start);
}
}
int wait_for_client(int *argc, char** argv, int http) {
/* ugh, here we go... */
XImage* fb_image;
......@@ -2767,6 +2798,10 @@ int wait_for_client(int *argc, char** argv, int http) {
}
}
do_unixpw_loop();
} else if (cmd && !use_threads) {
/* try to get RFB proto done now. */
progress_client();
}
}
......
......@@ -9,6 +9,7 @@ extern int switch_user(char *, int);
extern int read_passwds(char *passfile);
extern void install_passwds(void);
extern void check_new_passwds(int force);
extern void progress_client(void);
extern int wait_for_client(int *argc, char** argv, int http);
extern rfbBool custom_passwd_check(rfbClientPtr cl, const char *response, int len);
extern char *xdmcp_insert;
......
.\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "February 2009" "x11vnc " "User Commands"
.TH X11VNC "1" "March 2009" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.9.7, lastmod: 2009-02-25
version: 0.9.7, lastmod: 2009-03-07
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -1275,12 +1275,23 @@ script that works on most Unixes to determine a user's
DISPLAY variable and xauthority data (see
.IR who (1)
).
The option "\fB-find\fR" is an alias for this mode.
.IP
To have this default script printed to stdout (e.g. for
customization) run with WAIT:cmd=FINDDISPLAY-print To
have the script run to print what display it would find
use "\fB-finddpy\fR" or WAIT:cmd=FINDDISPLAY-run
.IP
The standard script runs
.IR xdpyinfo (1)
run on potential
displays. If your X server(s) have a login greeter
that exclusively grabs the Xserver, then xdpyinfo
blocks forever and this mode will not work. See
www.karlrunge.com/x11vnc/faq.html#faq-display-manager
for how to disable this for dtgreet on Solaris and
possibly for other greeters.
.IP
As another special case, WAIT:cmd=HTTPONCE will allow
x11vnc to service one http request and then exit.
This is usually done in \fB-inetd\fR mode to run on, say,
......@@ -1294,10 +1305,12 @@ by client web browsers. For example:
Where /.../x11vnc is the full path to x11vnc.
It is used in the Apache SSL-portal example (see FAQ).
.IP
In this mode you can set X11VNC_SKIP_DISPLAY to a comma
separated list of displays (e.g. ":0,:1") to ignore
in the finding process. This can also be set by the
user via "nd=" using "-" instead of ","
In this mode you can set X11VNC_SKIP_DISPLAY to a
comma separated list of displays (e.g. ":0,:1") to
ignore in the finding process. The ":" is optional.
Ranges n-m e.g. 0-20 can also be supplied. This string
can also be set by the connecting user via "nd="
using "+" instead of ","
.IP
An interesting option is WAIT:cmd=FINDCREATEDISPLAY
that is like FINDDISPLAY in that is uses the same method
......@@ -1306,6 +1319,8 @@ find one it will try to *start* up an X server session
for the user. This is the only time x11vnc tries to
actually start up an X server.
.IP
The option "\fB-create\fR" is an alias for this mode.
.IP
It will start looking for an open display number at :20
Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n
.IP
......
......@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.7 lastmod: 2009-02-25";
char lastmod[] = "0.9.7 lastmod: 2009-03-07";
/* X display info */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment