Commit 7717d245 authored by runge's avatar runge

some -ncache performance improvements, rootpixmap watching, gnome wm heuristics

parent 5b3e420c
This diff is collapsed.
......@@ -2079,6 +2079,10 @@ void print_help(int mode) {
" workarea). The default is to try to guess and when\n"
" detected try to make the transistion more smoothly.\n"
"\n"
"-ncache_no_rootpixmap In -ncache mode, do not try to snapshot the desktop\n"
" background to use in guessing or reconstructing window\n"
" save-unders..\n"
"\n"
"-ncache_pad n In -ncache mode, pad each window with n pixels for the\n"
" caching rectangles. This can be used to try to improve\n"
" the situation with dropshadows or other compositing\n"
......@@ -3344,8 +3348,13 @@ void print_help(int mode) {
" ncache_size:n set -ncache size to n.\n"
" ncache_cr enable -ncache_cr mode.\n"
" noncache_cr disable -ncache_cr mode.\n"
" ncache_no_moveraise enable no_moveraise mode.\n"
" noncache_no_moveraise disable no_moveraise mode.\n"
" ncache_no_moveraise enable no_moveraise mode.\n"
" noncache_no_moveraise disable no_moveraise mode.\n"
" ncache_no_dtchange enable ncache_no_dtchange mode.\n"
" noncache_no_dtchange disable ncache_no_dtchange mode.\n"
" ncache_no_rootpixmap enable ncache_no_rootpixmap.\n"
" noncache_no_rootpixmap disable ncache_no_rootpixmap.\n"
" ncache_reset_rootpixmap recheck the root pixmap\n"
" wireframe enable -wireframe mode. same as \"wf\"\n"
" nowireframe disable -wireframe mode. same as \"nowf\"\n"
" wireframe:str enable -wireframe mode string.\n"
......@@ -3505,29 +3514,31 @@ void print_help(int mode) {
" bell nobell sel nosel primary noprimary setprimary\n"
" nosetprimary clipboard noclipboard setclipboard\n"
" nosetclipboard seldir cursorshape nocursorshape\n"
" cursorpos nocursorpos cursor_drag nocursor_drag\n"
" cursor show_cursor noshow_cursor nocursor arrow\n"
" xfixes noxfixes xdamage noxdamage xd_area xd_mem\n"
" alphacut alphafrac alpharemove noalpharemove alphablend\n"
" noalphablend xwarppointer xwarp noxwarppointer noxwarp\n"
" buttonmap dragging nodragging ncache_cr noncache_cr\n"
" ncache_no_moveraise noncache_no_moveraise ncache\n"
" noncache ncache_size wireframe_mode wireframe wf\n"
" nowireframe nowf wireframelocal wfl nowireframelocal\n"
" nowfl wirecopyrect wcr nowirecopyrect nowcr scr_area\n"
" scr_skip scr_inc scr_keys scr_term scr_keyrepeat\n"
" scr_parms scrollcopyrect scr noscrollcopyrect noscr\n"
" fixscreen noxrecord xrecord reset_record pointer_mode\n"
" pm input_skip allinput noallinput input grabkbd\n"
" nograbkbd grabptr nograbptr client_input ssltimeout\n"
" speeds wmdt debug_pointer dp nodebug_pointer nodp\n"
" debug_keyboard dk nodebug_keyboard nodk deferupdate\n"
" defer wait_ui wait_bog nowait_bog slow_fb wait\n"
" readtimeout nap nonap sb screen_blank fbpm nofbpm\n"
" dpms nodpms fs gaps grow fuzz snapfb nosnapfb rawfb\n"
" uinput_accel uinput_thresh uinput_reset uinput_always\n"
" progressive rfbport http nohttp httpport httpdir\n"
" enablehttpproxy noenablehttpproxy alwaysshared\n"
" cursorpos nocursorpos cursor_drag nocursor_drag cursor\n"
" show_cursor noshow_cursor nocursor arrow xfixes\n"
" noxfixes xdamage noxdamage xd_area xd_mem alphacut\n"
" alphafrac alpharemove noalpharemove alphablend\n"
" noalphablend xwarppointer xwarp noxwarppointer\n"
" noxwarp buttonmap dragging nodragging ncache_cr\n"
" noncache_cr ncache_no_moveraise noncache_no_moveraise\n"
" ncache_no_dtchange noncache_no_dtchange\n"
" ncache_no_rootpixmap noncache_no_rootpixmap\n"
" ncache_reset_rootpixmap ncache noncache ncache_size\n"
" wireframe_mode wireframe wf nowireframe nowf\n"
" wireframelocal wfl nowireframelocal nowfl wirecopyrect\n"
" wcr nowirecopyrect nowcr scr_area scr_skip scr_inc\n"
" scr_keys scr_term scr_keyrepeat scr_parms scrollcopyrect\n"
" scr noscrollcopyrect noscr fixscreen noxrecord xrecord\n"
" reset_record pointer_mode pm input_skip allinput\n"
" noallinput input grabkbd nograbkbd grabptr nograbptr\n"
" client_input ssltimeout speeds wmdt debug_pointer dp\n"
" nodebug_pointer nodp debug_keyboard dk nodebug_keyboard\n"
" nodk deferupdate defer wait_ui wait_bog nowait_bog\n"
" slow_fb wait readtimeout nap nonap sb screen_blank\n"
" fbpm nofbpm dpms nodpms fs gaps grow fuzz snapfb\n"
" nosnapfb rawfb uinput_accel uinput_thresh uinput_reset\n"
" uinput_always progressive rfbport http nohttp httpport\n"
" httpdir enablehttpproxy noenablehttpproxy alwaysshared\n"
" noalwaysshared nevershared noalwaysshared dontdisconnect\n"
" nodontdisconnect desktop debug_xevents nodebug_xevents\n"
" debug_xevents debug_xdamage nodebug_xdamage\n"
......
......@@ -208,7 +208,10 @@ int ncache_pad = 24;
int ncache = NCACHE;
int ncache_pad = 0;
#endif
int ncache_xrootpmap = 1;
#ifndef NCACHE_XROOTPMAP
#define NCACHE_XROOTPMAP 1
#endif
int ncache_xrootpmap = NCACHE_XROOTPMAP;
int ncache0 = 0;
int ncache_copyrect = 0;
int ncache_wf_raises = 1;
......@@ -219,9 +222,11 @@ int ncache_beta_tester = 0;
Atom atom_NET_ACTIVE_WINDOW = None;
Atom atom_NET_CURRENT_DESKTOP = None;
Atom atom_NET_CLIENT_LIST_STACKING = None;
Atom atom_XROOTPMAP_ID = None;
double got_NET_ACTIVE_WINDOW = 0.0;
double got_NET_CURRENT_DESKTOP = 0.0;
double got_NET_CLIENT_LIST_STACKING = 0.0;
double got_XROOTPMAP_ID = 0.0;
/* T+B+L+R,tkey+presist_key,tmouse+persist_mouse */
char *scroll_copyrect_str = NULL;
......
......@@ -169,9 +169,11 @@ extern int ncache_beta_tester;
extern Atom atom_NET_ACTIVE_WINDOW;
extern Atom atom_NET_CURRENT_DESKTOP;
extern Atom atom_NET_CLIENT_LIST_STACKING;
extern Atom atom_XROOTPMAP_ID;
extern double got_NET_ACTIVE_WINDOW;
extern double got_NET_CURRENT_DESKTOP;
extern double got_NET_CLIENT_LIST_STACKING;
extern double got_XROOTPMAP_ID;
extern char *scroll_copyrect_str;
extern char *scroll_copyrect;
......
......@@ -2779,6 +2779,40 @@ char *process_remote_cmd(char *cmd, int stringonly) {
ncache_dt_change = 1;
rfbLog("remote_cmd: disabled -ncache_no_dt_change\n");
} else if (!strcmp(p, "ncache_no_rootpixmap")) {
int orig = ncache_xrootpmap;
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !ncache_xrootpmap);
goto qry;
}
ncache_xrootpmap = 0;
rfbLog("remote_cmd: set -ncache_no_rootpixmap\n");
if (orig != ncache_xrootpmap) {
do_new_fb(1);
}
} else if (!strcmp(p, "noncache_no_rootpixmap")) {
int orig = ncache_xrootpmap;
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, ncache_xrootpmap);
goto qry;
}
ncache_xrootpmap = 1;
rfbLog("remote_cmd: disabled -ncache_no_rootpixmap\n");
if (orig != ncache_xrootpmap) {
do_new_fb(1);
}
} else if (!strcmp(p, "ncache_reset_rootpixmap")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !ncache_xrootpmap);
goto qry;
}
if (ncache_xrootpmap) {
rfbLog("remote_cmd: resetting root pixmap.\n");
set_ncache_xrootpmap();
}
} else if (!strcmp(p, "ncache")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !!ncache);
......
......@@ -2846,11 +2846,15 @@ static int scan_display(int ystart, int rescan) {
y = ystart;
g_now = dnow();
if (! main_fb) {
rfbLog("scan_display: no main_fb!\n");
return 0;
}
X_LOCK;
while (y < dpy_y) {
if (use_xdamage) {
......@@ -2863,7 +2867,6 @@ static int scan_display(int ystart, int rescan) {
}
/* grab the horizontal scanline from the display: */
X_LOCK;
#ifndef NO_NCACHE
/* XXX Y test */
......@@ -2878,12 +2881,18 @@ if (ncache > 0) {
XEvent ev;
if (raw_fb_str) {
;
} else if (XEventsQueued(dpy, QueuedAlready) == 0) {
; /* XXX Y resp */
} else if (XCheckTypedEvent(dpy, MapNotify, &ev)) {
gotone = 1;
} else if (XCheckTypedEvent(dpy, UnmapNotify, &ev)) {
gotone = 2;
} else if (XCheckTypedEvent(dpy, CreateNotify, &ev)) {
gotone = 3;
} else if (XCheckTypedEvent(dpy, ConfigureNotify, &ev)) {
gotone = 4;
} else if (XCheckTypedEvent(dpy, VisibilityNotify, &ev)) {
gotone = 5;
}
if (gotone) {
XPutBackEvent(dpy, &ev);
......@@ -2909,7 +2918,6 @@ fprintf(stderr, "\n*** SCAN_DISPLAY CHECK_NCACHE/%d *** %d rescan=%d\n", gotone,
XRANDR_SET_TRAP_RET(-1, "scan_display-set");
copy_image(scanline, 0, y, 0, 0);
XRANDR_CHK_TRAP_RET(-1, "scan_display-chk");
X_UNLOCK;
/* for better memory i/o try the whole line at once */
src = scanline->data;
......@@ -2979,6 +2987,9 @@ fprintf(stderr, "\n*** SCAN_DISPLAY CHECK_NCACHE/%d *** %d rescan=%d\n", gotone,
}
y += NSCAN;
}
X_UNLOCK;
return tile_count;
}
......
......@@ -746,6 +746,9 @@ void do_new_fb(int reset_mem) {
initialize_blackouts_and_xinerama();
initialize_polling_images();
}
if (ncache) {
check_ncache(1, 0);
}
}
static void remove_fake_fb(void) {
......
......@@ -55,6 +55,8 @@ catch {rename send {}}
# 0 means to skip the item.
# -- means add a separator
#
# The =GAL ... =GAL LOFF stuff is to provide submenus.
#
global env started time_count
set started ""
......@@ -366,6 +368,8 @@ Tuning
ncache_cr
ncache_no_moveraise
ncache_no_dtchange
ncache_no_rootpixmap
=A ncache_reset_rootpixmap
=GAL LOFF
--
=GAL SharedMemory::
......
......@@ -66,6 +66,8 @@ char gui_code[] = "";
"# 0 means to skip the item.\n"
"# -- means add a separator\n"
"#\n"
"# The =GAL ... =GAL LOFF stuff is to provide submenus.\n"
"#\n"
"\n"
"global env started time_count\n"
"set started \"\"\n"
......@@ -377,6 +379,8 @@ char gui_code[] = "";
" ncache_cr\n"
" ncache_no_moveraise\n"
" ncache_no_dtchange\n"
" ncache_no_rootpixmap\n"
" =A ncache_reset_rootpixmap\n"
" =GAL LOFF\n"
" --\n"
" =GAL SharedMemory::\n"
......
This diff is collapsed.
......@@ -39,5 +39,7 @@ extern void do_copyregion(sraRegionPtr region, int dx, int dy, int mode);
extern int check_ncache(int reset, int mode);
extern int find_rect(int idx, int x, int y, int w, int h);
extern int lookup_win_index(Window);
extern void set_ncache_xrootpmap(void);
#endif /* _X11VNC_USERINPUT_H */
......@@ -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-09
version: 0.8.4, lastmod: 2007-01-10
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -2448,6 +2448,12 @@ In \fB-ncache\fR mode, do not try to guess when the desktop
workarea). The default is to try to guess and when
detected try to make the transistion more smoothly.
.PP
\fB-ncache_no_rootpixmap\fR
.IP
In \fB-ncache\fR mode, do not try to snapshot the desktop
background to use in guessing or reconstructing window
save-unders..
.PP
\fB-ncache_pad\fR \fIn\fR
.IP
In \fB-ncache\fR mode, pad each window with n pixels for the
......@@ -4020,9 +4026,19 @@ ncache_cr enable \fB-ncache_cr\fR mode.
.IP
noncache_cr disable \fB-ncache_cr\fR mode.
.IP
ncache_no_moveraise enable no_moveraise mode.
ncache_no_moveraise enable no_moveraise mode.
.IP
noncache_no_moveraise disable no_moveraise mode.
.IP
ncache_no_dtchange enable ncache_no_dtchange mode.
.IP
noncache_no_dtchange disable ncache_no_dtchange mode.
.IP
ncache_no_rootpixmap enable ncache_no_rootpixmap.
.IP
noncache_no_rootpixmap disable ncache_no_rootpixmap.
.IP
noncache_no_moveraise disable no_moveraise mode.
ncache_reset_rootpixmap recheck the root pixmap
.IP
wireframe enable \fB-wireframe\fR mode. same as "wf"
.IP
......@@ -4300,29 +4316,31 @@ clear_keys noclear_keys remap repeat norepeat fb nofb
bell nobell sel nosel primary noprimary setprimary
nosetprimary clipboard noclipboard setclipboard
nosetclipboard seldir cursorshape nocursorshape
cursorpos nocursorpos cursor_drag nocursor_drag
cursor show_cursor noshow_cursor nocursor arrow
xfixes noxfixes xdamage noxdamage xd_area xd_mem
alphacut alphafrac alpharemove noalpharemove alphablend
noalphablend xwarppointer xwarp noxwarppointer noxwarp
buttonmap dragging nodragging ncache_cr noncache_cr
ncache_no_moveraise noncache_no_moveraise ncache
noncache ncache_size wireframe_mode wireframe wf
nowireframe nowf wireframelocal wfl nowireframelocal
nowfl wirecopyrect wcr nowirecopyrect nowcr scr_area
scr_skip scr_inc scr_keys scr_term scr_keyrepeat
scr_parms scrollcopyrect scr noscrollcopyrect noscr
fixscreen noxrecord xrecord reset_record pointer_mode
pm input_skip allinput noallinput input grabkbd
nograbkbd grabptr nograbptr client_input ssltimeout
speeds wmdt debug_pointer dp nodebug_pointer nodp
debug_keyboard dk nodebug_keyboard nodk deferupdate
defer wait_ui wait_bog nowait_bog slow_fb wait
readtimeout nap nonap sb screen_blank fbpm nofbpm
dpms nodpms fs gaps grow fuzz snapfb nosnapfb rawfb
uinput_accel uinput_thresh uinput_reset uinput_always
progressive rfbport http nohttp httpport httpdir
enablehttpproxy noenablehttpproxy alwaysshared
cursorpos nocursorpos cursor_drag nocursor_drag cursor
show_cursor noshow_cursor nocursor arrow xfixes
noxfixes xdamage noxdamage xd_area xd_mem alphacut
alphafrac alpharemove noalpharemove alphablend
noalphablend xwarppointer xwarp noxwarppointer
noxwarp buttonmap dragging nodragging ncache_cr
noncache_cr ncache_no_moveraise noncache_no_moveraise
ncache_no_dtchange noncache_no_dtchange
ncache_no_rootpixmap noncache_no_rootpixmap
ncache_reset_rootpixmap ncache noncache ncache_size
wireframe_mode wireframe wf nowireframe nowf
wireframelocal wfl nowireframelocal nowfl wirecopyrect
wcr nowirecopyrect nowcr scr_area scr_skip scr_inc
scr_keys scr_term scr_keyrepeat scr_parms scrollcopyrect
scr noscrollcopyrect noscr fixscreen noxrecord xrecord
reset_record pointer_mode pm input_skip allinput
noallinput input grabkbd nograbkbd grabptr nograbptr
client_input ssltimeout speeds wmdt debug_pointer dp
nodebug_pointer nodp debug_keyboard dk nodebug_keyboard
nodk deferupdate defer wait_ui wait_bog nowait_bog
slow_fb wait readtimeout nap nonap sb screen_blank
fbpm nofbpm dpms nodpms fs gaps grow fuzz snapfb
nosnapfb rawfb uinput_accel uinput_thresh uinput_reset
uinput_always progressive rfbport http nohttp httpport
httpdir enablehttpproxy noenablehttpproxy alwaysshared
noalwaysshared nevershared noalwaysshared dontdisconnect
nodontdisconnect desktop debug_xevents nodebug_xevents
debug_xevents debug_xdamage nodebug_xdamage
......
......@@ -2171,6 +2171,8 @@ int main(int argc, char* argv[]) {
ncache_wf_raises = 1;
} else if (!strcmp(arg, "-ncache_no_dtchange")) {
ncache_dt_change = 0;
} else if (!strcmp(arg, "-ncache_no_rootpixmap")) {
ncache_xrootpmap = 0;
} else if (!strcmp(arg, "-ncache_pad")) {
CHECK_ARGC
ncache_pad = atoi(argv[++i]);
......
......@@ -467,6 +467,7 @@ extern double last_copyrect_fix;
extern double last_wireframe;
extern double servertime_diff;
extern double x11vnc_start;
extern double g_now;
extern double last_get_wm_frame_time;
extern Window last_get_wm_frame;
......
......@@ -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-09";
char lastmod[] = "0.8.4 lastmod: 2007-01-10";
/* X display info */
......@@ -131,6 +131,7 @@ double last_copyrect_fix = 0.0;
double last_wireframe = 0.0;
double servertime_diff = 0.0;
double x11vnc_start = 0.0;
double g_now = 0.0;
double last_get_wm_frame_time = 0.0;
Window last_get_wm_frame = None;
......
......@@ -542,6 +542,8 @@ if (0) XEventsQueued(dpy, QueuedAfterFlush);
int xdamage_hint_skip(int y) {
static sraRegionPtr scanline = NULL;
static sraRegionPtr tmpl_y = NULL;
int fast_tmpl = 1;
sraRegionPtr reg, tmpl;
int ret, i, n, nreg;
static int ncache_no_skip = 0;
......@@ -559,13 +561,16 @@ int xdamage_hint_skip(int y) {
/* keep it around to avoid malloc etc, recreate */
scanline = sraRgnCreate();
}
if (! tmpl_y) {
tmpl_y = sraRgnCreateRect(0, 0, dpy_x, 1);
}
nreg = (xdamage_memory * NSCAN) + 1;
#ifndef NO_NCACHE
if (ncache > 0) {
if (ncache_no_skip == 0) {
double now = dnow();
double now = g_now;
if (now > last_ncache_no_skip + 8.0) {
ncache_no_skip = 1;
} else if (now < last_bs_restore + 0.5) {
......@@ -595,7 +600,12 @@ int xdamage_hint_skip(int y) {
}
#endif
tmpl = sraRgnCreateRect(0, y, dpy_x, y+1);
if (fast_tmpl) {
sraRgnOffset(tmpl_y, 0, y);
tmpl = tmpl_y;
} else {
tmpl = sraRgnCreateRect(0, y, dpy_x, y+1);
}
ret = 1;
for (i=0; i<nreg; i++) {
......@@ -616,7 +626,11 @@ int xdamage_hint_skip(int y) {
break;
}
}
sraRgnDestroy(tmpl);
if (fast_tmpl) {
sraRgnOffset(tmpl_y, 0, -y);
} else {
sraRgnDestroy(tmpl);
}
if (0) fprintf(stderr, "xdamage_hint_skip: %d -> %d\n", y, ret);
return ret;
......
......@@ -602,13 +602,16 @@ void sync_tod_with_servertime(void) {
RAWFB_RET_VOID
if (atom_NET_ACTIVE_WINDOW == None) {
atom_NET_ACTIVE_WINDOW = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
atom_NET_ACTIVE_WINDOW = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", True);
}
if (atom_NET_CURRENT_DESKTOP == None) {
atom_NET_CURRENT_DESKTOP = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False);
atom_NET_CURRENT_DESKTOP = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", True);
}
if (atom_NET_CLIENT_LIST_STACKING == None) {
atom_NET_CLIENT_LIST_STACKING = XInternAtom(dpy, "_NET_CLIENT_LIST_STACKING", False);
atom_NET_CLIENT_LIST_STACKING = XInternAtom(dpy, "_NET_CLIENT_LIST_STACKING", True);
}
if (atom_XROOTPMAP_ID == None) {
atom_XROOTPMAP_ID = XInternAtom(dpy, "_XROOTPMAP_ID", True);
}
if (! ticker_atom) {
......@@ -755,6 +758,7 @@ void set_prop_atom(Atom atom) {
if (atom == atom_NET_ACTIVE_WINDOW) got_NET_ACTIVE_WINDOW = dnow();
if (atom == atom_NET_CURRENT_DESKTOP) got_NET_CURRENT_DESKTOP = dnow();
if (atom == atom_NET_CLIENT_LIST_STACKING) got_NET_CLIENT_LIST_STACKING = dnow();
if (atom == atom_XROOTPMAP_ID) got_XROOTPMAP_ID = dnow();
}
/*
......
......@@ -418,6 +418,9 @@ void zero_fb(int x1, int y1, int x2, int y2) {
#ifndef NO_NCACHE
if (ncache > 0) {
yfac = 1+ncache;
if (ncache_xrootpmap) {
yfac++;
}
}
#endif
......
......@@ -25,6 +25,7 @@ extern int known_xrandr_mode(char *s);
if (check_xrandr_event(y)) { \
trapped_getimage_xerror = 0; \
XSetErrorHandler(old_getimage_handler); \
X_UNLOCK; \
return(x); \
} \
}
......
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