Commit c9e24e5b authored by runge's avatar runge

more speed and accuracy improvements to -ncache mode.

parent 5b607a44
This diff is collapsed.
......@@ -2064,6 +2064,10 @@ void print_help(int mode) {
" smoother drags than tightvnc viewer. Response may also\n"
" be choppy if the server side machine is too slow.\n"
"\n"
" Sometimes on very slow modem connections, this actually\n"
" gives an improvement because no pixel data at all\n"
" (not even the box animation) is sent during the drag.\n"
"\n"
"-ncache_no_moveraise In -ncache mode, do not assume that moving a window\n"
" will cause the window manager to raise it to the top\n"
" of the stack. The default is to assume it does, and\n"
......
......@@ -195,8 +195,12 @@ int wireframe_in_progress = 0;
int wireframe_local = 1;
#ifndef NCACHE
#ifdef NO_NCACHE
#define NCACHE 0
#else
#define NCACHE -12
#endif
#endif
#ifdef MACOSX
int ncache = 0;
int ncache_pad = 24;
......@@ -204,6 +208,7 @@ int ncache_pad = 24;
int ncache = NCACHE;
int ncache_pad = 0;
#endif
int ncache_xrootpmap = 1;
int ncache0 = 0;
int ncache_copyrect = 0;
int ncache_wf_raises = 1;
......
......@@ -162,6 +162,7 @@ extern int ncache_copyrect;
extern int ncache_wf_raises;
extern int ncache_dt_change;
extern int ncache_pad;
extern int ncache_xrootpmap;
extern int macosx_ncache_macmenu;
extern int ncache_beta_tester;
......
......@@ -2733,6 +2733,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
rfbLog("remote_cmd: enabling mouse nodragging mode.\n");
show_dragging = 0;
#ifndef NO_NCACHE
} else if (!strcmp(p, "ncache_cr")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, ncache_copyrect);
......@@ -2810,6 +2811,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
check_ncache(1,0);
}
}
#endif
} else if (strstr(p, "wireframe_mode") == p) {
COLON_CHECK("wireframe_mode:")
......
......@@ -2059,23 +2059,28 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
#ifndef NO_NCACHE
if (ncache > 0 && !nofb) {
#ifdef MACOSX
# ifdef MACOSX
if (! raw_fb_str || macosx_console) {
#else
# else
if (! raw_fb_str) {
#endif
# endif
char *new_fb;
int sz = fb->height * fb->bytes_per_line;
int ns = 1+ncache;
if (ncache_xrootpmap) {
ns++;
}
new_fb = (char *) calloc((size_t) (sz * (1+ncache)), 1);
new_fb = (char *) calloc((size_t) (sz * ns), 1);
if (fb->data) {
memcpy(new_fb, fb->data, sz);
free(fb->data);
}
fb->data = new_fb;
fb->height *= (1+ncache);
height *= (1+ncache);
fb->height *= (ns);
height *= (ns);
ncache0 = ncache;
}
}
......
......@@ -13,7 +13,7 @@ void solid_bg(int restore);
static void usr_bin_path(int restore);
static int dt_cmd(char *cmd);
static char *cmd_output(char *cmd);
static void solid_root(char *color);
XImage *solid_root(char *color);
static void solid_cde(char *color);
static void solid_gnome(char *color);
static void solid_kde(char *color);
......@@ -113,11 +113,11 @@ static char *cmd_output(char *cmd) {
return(output);
}
static void solid_root(char *color) {
XImage *solid_root(char *color) {
#if NO_X11
RAWFB_RET_VOID
if (!color) {}
return;
return NULL;
#else
Window expose;
static XImage *image = NULL;
......@@ -130,11 +130,11 @@ static void solid_root(char *color) {
XColor cdef;
Colormap cmap;
RAWFB_RET_VOID
RAWFB_RET(NULL)
if (subwin || window != rootwin) {
rfbLog("cannot set subwin to solid color, must be rootwin\n");
return;
return NULL;
}
/* create the "clear" window just for generating exposures */
......@@ -155,7 +155,7 @@ static void solid_root(char *color) {
/* whoops */
XDestroyWindow(dpy, expose);
rfbLog("no root snapshot available.\n");
return;
return NULL;
}
......@@ -180,7 +180,7 @@ static void solid_root(char *color) {
XMapWindow(dpy, expose);
XSync(dpy, False);
XDestroyWindow(dpy, expose);
return;
return NULL;
}
if (! image) {
......@@ -205,6 +205,13 @@ static void solid_root(char *color) {
ZPixmap);
XSync(dpy, False);
XDestroyWindow(dpy, iwin);
rfbLog("done.\n");
}
if (color == (char *) 0x1) {
/* caller will XDestroyImage it: */
XImage *xi = image;
image = NULL;
return xi;
}
/* use black for low colors or failure */
......@@ -225,6 +232,7 @@ static void solid_root(char *color) {
XSync(dpy, False);
XDestroyWindow(dpy, expose);
#endif /* NO_X11 */
return NULL;
}
static void solid_cde(char *color) {
......
......@@ -5,5 +5,6 @@
extern char *guess_desktop(void);
extern void solid_bg(int restore);
extern XImage *solid_root(char *color);
#endif /* _X11VNC_SOLID_H */
This diff is collapsed.
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "January 2007" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.8.4, lastmod: 2007-01-07
version: 0.8.4, lastmod: 2007-01-08
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -2428,6 +2428,10 @@ Some VNC Viewers provide better response than others
with this option. On Unix, realvnc viewer gives
smoother drags than tightvnc viewer. Response may also
be choppy if the server side machine is too slow.
.IP
Sometimes on very slow modem connections, this actually
gives an improvement because no pixel data at all
(not even the box animation) is sent during the drag.
.PP
\fB-ncache_no_moveraise\fR
.IP
......
......@@ -1463,6 +1463,8 @@ char msg[] =
"\n"
" x11vnc -ncache 0 ...\n"
"\n"
"Your current setting is: -ncache %d\n"
"\n"
"The feature needs additional testing because we want to have x11vnc\n"
"performance enhancements on by default. Otherwise, only a relative few\n"
"would notice and use the -ncache option (e.g. the wireframe and scroll\n"
......@@ -1483,8 +1485,11 @@ char msg[] =
if (nofb) {
return;
}
#ifdef NO_NCACHE
return;
#endif
fprintf(stderr, "%s", msg);
fprintf(stderr, msg, ncache);
}
......
......@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.8.4 lastmod: 2007-01-07";
char lastmod[] = "0.8.4 lastmod: 2007-01-08";
/* X display info */
......
......@@ -546,6 +546,7 @@ int xdamage_hint_skip(int y) {
int ret, i, n, nreg;
static int ncache_no_skip = 0;
static double last_ncache_no_skip = 0.0;
static double last_ncache_no_skip_long = 0.0, ncache_fac = 0.25;
if (! xdamage_present || ! use_xdamage) {
return 0; /* cannot skip */
......@@ -561,6 +562,7 @@ int xdamage_hint_skip(int y) {
nreg = (xdamage_memory * NSCAN) + 1;
#ifndef NO_NCACHE
if (ncache > 0) {
if (ncache_no_skip == 0) {
double now = dnow();
......@@ -575,16 +577,23 @@ int xdamage_hint_skip(int y) {
}
if (ncache_no_skip) {
last_ncache_no_skip = dnow();
if (now > last_ncache_no_skip_long + 60.0) {
ncache_fac = 2.0;
last_ncache_no_skip_long = now;
} else {
ncache_fac = 0.25;
}
return 0;
}
} else {
if (ncache_no_skip++ >= 1*nreg + 4) {
if (ncache_no_skip++ >= ncache_fac*nreg + 4) {
ncache_no_skip = 0;
} else {
return 0;
}
}
}
#endif
tmpl = sraRgnCreateRect(0, y, dpy_x, y+1);
......
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