x11vnc: -8to24 opts, use XGetSubImage. fix -threads deadlocks and -rawfb crash

pull/1/head
runge 19 years ago
parent 17e6b6a2bf
commit 1967913e95

@ -14,6 +14,7 @@ void mark_8bpp(void);
static void set_root_cmap(void);
static void check_pointer_in_depth24(void);
static void parse_cmap8to24(void);
static int check_depth(Window win, Window top, int doall);
static int check_depth_win(Window win, Window top, XWindowAttributes attr);
static int get_8pp_region(sraRegionPtr region8bpp, sraRegionPtr rect,
@ -44,10 +45,12 @@ static void set_root_cmap(void) {
root_cmap = 0;
}
if (! root_cmap) {
X_LOCK;
if (valid_window(window, &attr, 1)) {
last_set = now;
root_cmap = attr.colormap;
}
X_UNLOCK;
}
}
@ -58,6 +61,7 @@ static window8bpp_t windows_8bpp[MAX_8BPP_WINDOWS];
static int db24 = 0;
static int xgetimage_8to24 = 0;
static int do_hibits = 0;
static double poll_8to24_delay = 0.0;
static void check_pointer_in_depth24(void) {
int tries = 0, in_24 = 0;
@ -98,13 +102,50 @@ if (db24 > 1) fprintf(stderr, "check_pointer_in_depth24 %d %d %d %d\n", x1, y1,
}
}
static void parse_cmap8to24(void) {
if (cmap8to24_str) {
char *p, *str = strdup(cmap8to24_str);
p = strtok(str, ",");
db24 = 0;
xgetimage_8to24 = 0;
do_hibits = 0;
while (p) {
if (strstr(p, "dbg=") == p) {
db24 = atoi(p + strlen("dbg="));
} else if (!strcmp(p, "highbits")) {
do_hibits = 1;
} else if (!strcmp(p, "getimage")) {
xgetimage_8to24 = 1;
}
p = strtok(NULL, ",");
}
free(str);
} else {
if (getenv("DEBUG_8TO24") != NULL) {
db24 = atoi(getenv("DEBUG_8TO24"));
}
if (getenv("XGETIMAGE_8TO24") != NULL) {
xgetimage_8to24 = 1;
}
if (getenv("HIGHBITS_8TO24") != NULL) {
do_hibits = 1;
}
}
}
void poll_8bpp(void) {
}
void check_for_multivis(void) {
XWindowAttributes attr;
int doall = 0;
int k, i, cnt, diff;
static int first = 1;
static double last_parse = 0.0;
static double last_update = 0.0;
static double last_clear = 0.0;
static double last_poll = 0.0;
double now = dnow();
static Window *stack_old = NULL;
static int stack_old_len = 0;
@ -119,18 +160,15 @@ void check_for_multivis(void) {
windows_8bpp[i].cmap = (Colormap) 0;
windows_8bpp[i].fetched = 0;
}
if (getenv("DEBUG_8TO24") != NULL) {
db24 = atoi(getenv("DEBUG_8TO24"));
}
if (getenv("XGETIMAGE_8TO24") != NULL) {
xgetimage_8to24 = 1;
}
if (getenv("HIGHBITS_8TO24") != NULL) {
do_hibits = 1;
}
first = 0;
doall = 1; /* fetch everything first time */
}
if (now > last_parse + 0.75) {
last_parse = now;
parse_cmap8to24();
}
set_root_cmap();
/*
@ -178,6 +216,10 @@ void check_for_multivis(void) {
}
}
if (poll_8to24_delay > 0.0 && now > last_poll + poll_8to24_delay) {
last_poll = now;
}
/*
* if there are 8bpp visible and a stacking order change
* refresh vnc with coverage of the 8bpp regions:
@ -410,7 +452,9 @@ if (db24 > 1) fprintf(stderr, "multivis: STORE 0x%lx j: %3d ms: %d dep=%d\n", wi
windows_8bpp[j].h = attr.height;
/* translate x y to be WRT the root window (not parent) */
X_LOCK;
xtranslate(win, window, 0, 0, &x, &y, &w, 1);
X_UNLOCK;
windows_8bpp[j].x = x;
windows_8bpp[j].y = y;
@ -670,7 +714,7 @@ static void do_8bpp_region(sraRect rect) {
int ps, pixelsize = bpp/8;
int do_getimage = xgetimage_8to24;
int line, n_off, j, h, w;
int line, n_off, j, h, w, vw;
unsigned int hi, idx;
XWindowAttributes attr;
XErrorHandler old_handler = NULL;
@ -770,9 +814,18 @@ if (db24 > 1) fprintf(stderr, "transform %d %d %d %d\n", rect.x1, rect.y1, rect.
}
}
if (do_getimage && valid_window(best_win, &attr, 1)) {
XImage *xi;
if (do_getimage) {
X_LOCK;
vw = valid_window(best_win, &attr, 1);
X_UNLOCK;
}
if (do_getimage && vw) {
static XImage *xi_8 = NULL;
static XImage *xi_24 = NULL;
XImage *xi = NULL;
Window c;
char *d;
unsigned int wu, hu;
int xo, yo;
@ -792,11 +845,44 @@ if (db24 > 1) fprintf(stderr, "skipping due to potential bad match...\n");
return;
}
#define GETSUBIMAGE
#ifdef GETSUBIMAGE
if (best_depth == 8) {
if (xi_8 == NULL || xi_8->width != dpy_x || xi_8->height != dpy_y) {
if (xi_8) {
XDestroyImage(xi_8);
}
d = (char *) malloc(dpy_x * dpy_y * attr.depth/8);
xi_8 = XCreateImage(dpy, attr.visual, attr.depth,
ZPixmap, 0, d, dpy_x, dpy_y, 8, 0);
if (db24) fprintf(stderr, "xi_8: %p\n", (void *) xi_8);
}
xi = xi_8;
} else if (best_depth == 24) {
if (xi_24 == NULL || xi_24->width != dpy_x || xi_24->height != dpy_y) {
if (xi_24) {
XDestroyImage(xi_24);
}
d = (char *) malloc(dpy_x * dpy_y * attr.depth/8);
xi_24 = XCreateImage(dpy, attr.visual, attr.depth,
ZPixmap, 0, d, dpy_x, dpy_y, 8, 0);
if (db24) fprintf(stderr, "xi_24: %p\n", (void *) xi_24);
}
xi = xi_24;
}
#endif
trapped_xerror = 0;
old_handler = XSetErrorHandler(trap_xerror);
/* FIXME: XGetSubImage? */
#ifndef GETSUBIMAGE
xi = XGetImage(dpy, best_win, xo, yo, wu, hu,
AllPlanes, ZPixmap);
#else
XGetSubImage(dpy, best_win, xo, yo, wu, hu, AllPlanes,
ZPixmap, xi, 0, 0);
#endif
XSetErrorHandler(old_handler);
X_UNLOCK;
@ -810,9 +896,11 @@ if (db24 > 1) fprintf(stderr, "xi: 0x%p %d %d %d %d -- %d %d\n", (void *)xi, xo
trapped_xerror = 0;
if (xi->depth != 8 && xi->depth != 24) {
#ifndef GETSUBIMAGE
X_LOCK;
XDestroyImage(xi);
X_UNLOCK;
#endif
if (db24) fprintf(stderr, "xi: wrong depth: %d\n", xi->depth);
return;
}
@ -835,9 +923,9 @@ if (db24) fprintf(stderr, "xi: wrong depth: %d\n", xi->depth);
/* line by line ... */
for (line = 0; line < xi->height; line++) {
for (line = 0; line < h; line++) {
/* pixel by pixel... */
for (j = 0; j < xi->width; j++) {
for (j = 0; j < w; j++) {
uc = (unsigned char *) (src + ps1 * j);
ui = (unsigned int *) (dst + ps2 * j);
@ -861,16 +949,18 @@ if (db24) fprintf(stderr, "xi: wrong depth: %d\n", xi->depth);
src = xi->data;
dst = cmap8to24_fb + fac * n_off;
for (line = 0; line < xi->height; line++) {
for (line = 0; line < h; line++) {
memcpy(dst, src, w * ps1);
src += xi->bytes_per_line;
dst += main_bytes_per_line * fac;
}
}
#ifndef GETSUBIMAGE
X_LOCK;
XDestroyImage(xi);
X_UNLOCK;
#endif
} else if (! do_getimage) {
/* normal mode. */

@ -1,3 +1,7 @@
2006-01-21 Karl Runge <runge@karlrunge.com>
* x11vnc: -8to24 opts, use XGetSubImage. fix -threads deadlocks and
-rawfb crash.
2006-01-18 Karl Runge <runge@karlrunge.com>
* x11vnc: -8to24 now works on default depth 8 screens.

@ -1,5 +1,5 @@
x11vnc README file Date: Wed Jan 18 22:06:12 EST 2006
x11vnc README file Date: Sat Jan 21 20:25:28 EST 2006
The following information is taken from these URLs:
@ -4898,7 +4898,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.8 lastmod: 2006-01-18
x11vnc: allow VNC connections to real X11 displays. 0.8 lastmod: 2006-01-21
x11vnc options:
-display disp -auth file
@ -4906,7 +4906,7 @@ x11vnc options:
-clip WxH+X+Y -flashcmap
-shiftcmap n -notruecolor
-visual n -overlay
-overlay_nocursor -8to24
-overlay_nocursor -8to24 [opts]
-scale fraction -scale_cursor frac
-viewonly -shared
-once -forever
@ -5009,7 +5009,7 @@ libvncserver-tight-extension options:
% x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.8 lastmod: 2006-01-18
x11vnc: allow VNC connections to real X11 displays. 0.8 lastmod: 2006-01-21
Typical usage is:
@ -5140,25 +5140,24 @@ Options:
-overlay_nocursor Sets -overlay, but does not try to draw the exact mouse
cursor shape using the overlay mechanism.
-8to24 If -overlay is not supported on your OS, and you have a
legacy 8bpp app that you want to view on a multi-depth
display with default depth 24 (and is 32 bpp), try
this option. It will also work for a default depth 8
display with depth 24 overlay windows. This option
-8to24 [opts] Try this option if -overlay is not supported on your
OS, and you have a legacy 8bpp app that you want to
view on a multi-depth display with default depth 24
(and is 32 bpp) or have default depth 8 display with
depth 24 overlay windows for some apps. This option
may not work on all X servers and hardware (tested on
XFree86/Xorg mga driver).
It enables a hack where x11vnc monitors windows within 3
levels from the root window. If it finds any that are
8bpp it will apply a transformation for pixel data in
these regions where it extracts the 8bpp index color
value from bits 25-32 and maps them on to TrueColor
values and inserts them into bits 1-24 (i.e. overwrites
bits 1-24).
For default depth 8 displays, everything is tranformed
to 32bpp (and is potentially a improvement over
-flashcmap).
XFree86/Xorg mga driver). The "opts" string is not
required and is described below.
This mode enables a hack where x11vnc monitors windows
within 3 levels from the root window. If it finds
any that are 8bpp it will apply a transformation for
pixel data in these regions where it extracts the 8bpp
index color value from bits 25-32 and maps them on
to TrueColor values and inserts them into bits 1-24
(i.e. overwrites bits 1-24). Whereas for default
depth 8 displays, everything is tranformed to 32bpp
(and is potentially a improvement over -flashcmap).
These schemes appear to work, but may still have
bugs and note that they do hog resources. If there
@ -5175,17 +5174,24 @@ Options:
to periodically refresh the screen (at the cost of
bandwidth).
Debugging for this mode can be enabled by setting the
environment variable DEBUG_8TO24 to 1, 2, or 3.
The [opts] string can contain the following settings.
Multiple settings are separated by commas.
For when there are still color problems, enable an even
more experimental mode via the option "getimage".
This enables a scheme were XGetImage() is used to
retrieve the 8bpp data instead of assuming that data
is in bits 25-32. This mode is significantly slower
than the above mode. For the default depth 8 case,
XGetImage() is always used to access depth 24 pixel
data.
For default depth 8 displays, setting option
"highbits" may give a speedup for transforming 8bpp
pixel data.
If there are problems, to enable an even more
experimental mode, set the environment variable
XGETIMAGE_8TO24=1 before starting x11vnc. This enables
a scheme were XGetImage() is used to retrieve the 8bpp
data instead of assuming that data is in bits 25-32.
This mode is significantly slower than the above mode.
For the default depth 8 case, XGetImage() is always
used to access depth 24 pixel data.
Debugging for this mode can be enabled by setting
"dbg=1", "dbg=2", or "dbg=3"
-scale fraction Scale the framebuffer by factor "fraction". Values
less than 1 shrink the fb, larger ones expand it. Note:
@ -6623,6 +6629,7 @@ n
nooverlay_cursor.
8to24 enable -8to24 mode (if applicable).
no8to24 disable -8to24 mode.
8to24_opts:str set the -8to24 opts to "str".
visual:vis set -visual to "vis"
scale:frac set -scale to "frac"
scale_cursor:f set -scale_cursor to "f"
@ -6877,22 +6884,22 @@ n
truecolor notruecolor overlay nooverlay overlay_cursor
overlay_yescursor nooverlay_nocursor nooverlay_cursor
nooverlay_yescursor overlay_nocursor 8to24 no8to24
visual scale scale_cursor viewonly noviewonly shared
noshared forever noforever once timeout filexfer deny
lock nodeny unlock connect allowonce allow localhost
nolocalhost listen lookup nolookup accept afteraccept
gone shm noshm flipbyteorder noflipbyteorder onetile
noonetile solid_color solid nosolid blackout xinerama
noxinerama xtrap noxtrap xrandr noxrandr xrandr_mode
padgeom quiet q noquiet modtweak nomodtweak xkb
noxkb skip_keycodes sloppy_keys nosloppy_keys
skip_dups noskip_dups add_keysyms noadd_keysyms
clear_mods noclear_mods clear_keys noclear_keys
remap repeat norepeat fb nofb bell nobell sel nosel
primary noprimary seldir cursorshape nocursorshape
cursorpos nocursorpos cursor show_cursor noshow_cursor
nocursor arrow xfixes noxfixes xdamage noxdamage
xd_area xd_mem alphacut alphafrac alpharemove
8to24_opts visual scale scale_cursor viewonly
noviewonly shared noshared forever noforever once
timeout filexfer deny lock nodeny unlock connect
allowonce allow localhost nolocalhost listen lookup
nolookup accept afteraccept gone shm noshm flipbyteorder
noflipbyteorder onetile noonetile solid_color solid
nosolid blackout xinerama noxinerama xtrap noxtrap
xrandr noxrandr xrandr_mode padgeom quiet q noquiet
modtweak nomodtweak xkb noxkb skip_keycodes sloppy_keys
nosloppy_keys skip_dups noskip_dups add_keysyms
noadd_keysyms clear_mods noclear_mods clear_keys
noclear_keys remap repeat norepeat fb nofb bell
nobell sel nosel primary noprimary seldir cursorshape
nocursorshape cursorpos nocursorpos 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 wireframe_mode wireframe wf nowireframe

@ -148,27 +148,24 @@ void print_help(int mode) {
"-overlay_nocursor Sets -overlay, but does not try to draw the exact mouse\n"
" cursor shape using the overlay mechanism.\n"
"\n"
"-8to24 If -overlay is not supported on your OS, and you have a\n"
" legacy 8bpp app that you want to view on a multi-depth\n"
" display with default depth 24 (and is 32 bpp), try\n"
" this option. It will also work for a default depth 8\n"
" display with depth 24 overlay windows. This option\n"
"-8to24 [opts] Try this option if -overlay is not supported on your\n"
" OS, and you have a legacy 8bpp app that you want to\n"
" view on a multi-depth display with default depth 24\n"
" (and is 32 bpp) or have default depth 8 display with\n"
" depth 24 overlay windows for some apps. This option\n"
" may not work on all X servers and hardware (tested on\n"
" XFree86/Xorg mga driver).\n"
"\n"
" It enables a hack where x11vnc monitors windows within 3\n"
" levels from the root window. If it finds any that are\n"
" 8bpp it will apply a transformation for pixel data in\n"
" these regions where it extracts the 8bpp index color\n"
" value from bits 25-32 and maps them on to TrueColor\n"
" values and inserts them into bits 1-24 (i.e. overwrites\n"
" bits 1-24).\n"
"\n"
" For default depth 8 displays, everything is tranformed\n"
" to 32bpp (and is potentially a improvement over\n"
" -flashcmap). Also for default depth 8 displays, setting\n"
" the env. var. HIGHBITS_8TO24 may give a speedup for\n"
" transforming 8bpp pixel data.\n"
" XFree86/Xorg mga driver). The \"opts\" string is not\n"
" required and is described below.\n"
"\n"
" This mode enables a hack where x11vnc monitors windows\n"
" within 3 levels from the root window. If it finds\n"
" any that are 8bpp it will apply a transformation for\n"
" pixel data in these regions where it extracts the 8bpp\n"
" index color value from bits 25-32 and maps them on\n"
" to TrueColor values and inserts them into bits 1-24\n"
" (i.e. overwrites bits 1-24). Whereas for default\n"
" depth 8 displays, everything is tranformed to 32bpp\n"
" (and is potentially a improvement over -flashcmap).\n"
"\n"
" These schemes appear to work, but may still have\n"
" bugs and note that they do hog resources. If there\n"
@ -185,17 +182,24 @@ void print_help(int mode) {
" to periodically refresh the screen (at the cost of\n"
" bandwidth).\n"
"\n"
" Debugging for this mode can be enabled by setting the\n"
" environment variable DEBUG_8TO24 to 1, 2, or 3.\n"
" The [opts] string can contain the following settings.\n"
" Multiple settings are separated by commas.\n"
"\n"
" If there are problems, to enable an even more\n"
" experimental mode, set the environment variable\n"
" XGETIMAGE_8TO24=1 before starting x11vnc. This enables\n"
" a scheme were XGetImage() is used to retrieve the 8bpp\n"
" data instead of assuming that data is in bits 25-32.\n"
" This mode is significantly slower than the above mode.\n"
" For the default depth 8 case, XGetImage() is always\n"
" used to access depth 24 pixel data.\n"
" For when there are still color problems, enable an even\n"
" more experimental mode via the option \"getimage\".\n"
" This enables a scheme were XGetImage() is used to\n"
" retrieve the 8bpp data instead of assuming that data\n"
" is in bits 25-32. This mode is significantly slower\n"
" than the above mode. For the default depth 8 case,\n"
" XGetImage() is always used to access depth 24 pixel\n"
" data.\n"
"\n"
" For default depth 8 displays, setting option\n"
" \"highbits\" may give a speedup for transforming 8bpp\n"
" pixel data.\n"
"\n"
" Debugging for this mode can be enabled by setting \n"
" \"dbg=1\", \"dbg=2\", or \"dbg=3\"\n"
"\n"
"-scale fraction Scale the framebuffer by factor \"fraction\". Values\n"
" less than 1 shrink the fb, larger ones expand it. Note:\n"
@ -1642,6 +1646,7 @@ void print_help(int mode) {
" nooverlay_cursor.\n"
" 8to24 enable -8to24 mode (if applicable).\n"
" no8to24 disable -8to24 mode.\n"
" 8to24_opts:str set the -8to24 opts to \"str\".\n"
" visual:vis set -visual to \"vis\"\n"
" scale:frac set -scale to \"frac\"\n"
" scale_cursor:f set -scale_cursor to \"f\"\n"
@ -1902,22 +1907,22 @@ void print_help(int mode) {
" truecolor notruecolor overlay nooverlay overlay_cursor\n"
" overlay_yescursor nooverlay_nocursor nooverlay_cursor\n"
" nooverlay_yescursor overlay_nocursor 8to24 no8to24\n"
" visual scale scale_cursor viewonly noviewonly shared\n"
" noshared forever noforever once timeout filexfer deny\n"
" lock nodeny unlock connect allowonce allow localhost\n"
" nolocalhost listen lookup nolookup accept afteraccept\n"
" gone shm noshm flipbyteorder noflipbyteorder onetile\n"
" noonetile solid_color solid nosolid blackout xinerama\n"
" noxinerama xtrap noxtrap xrandr noxrandr xrandr_mode\n"
" padgeom quiet q noquiet modtweak nomodtweak xkb\n"
" noxkb skip_keycodes sloppy_keys nosloppy_keys\n"
" skip_dups noskip_dups add_keysyms noadd_keysyms\n"
" clear_mods noclear_mods clear_keys noclear_keys\n"
" remap repeat norepeat fb nofb bell nobell sel nosel\n"
" primary noprimary seldir cursorshape nocursorshape\n"
" cursorpos nocursorpos cursor show_cursor noshow_cursor\n"
" nocursor arrow xfixes noxfixes xdamage noxdamage\n"
" xd_area xd_mem alphacut alphafrac alpharemove\n"
" 8to24_opts visual scale scale_cursor viewonly\n"
" noviewonly shared noshared forever noforever once\n"
" timeout filexfer deny lock nodeny unlock connect\n"
" allowonce allow localhost nolocalhost listen lookup\n"
" nolookup accept afteraccept gone shm noshm flipbyteorder\n"
" noflipbyteorder onetile noonetile solid_color solid\n"
" nosolid blackout xinerama noxinerama xtrap noxtrap\n"
" xrandr noxrandr xrandr_mode padgeom quiet q noquiet\n"
" modtweak nomodtweak xkb noxkb skip_keycodes sloppy_keys\n"
" nosloppy_keys skip_dups noskip_dups add_keysyms\n"
" noadd_keysyms clear_mods noclear_mods clear_keys\n"
" noclear_keys remap repeat norepeat fb nofb bell\n"
" nobell sel nosel primary noprimary seldir cursorshape\n"
" nocursorshape cursorpos nocursorpos cursor show_cursor\n"
" noshow_cursor nocursor arrow xfixes noxfixes xdamage\n"
" noxdamage xd_area xd_mem alphacut alphafrac alpharemove\n"
" noalpharemove alphablend noalphablend xwarppointer\n"
" xwarp noxwarppointer noxwarp buttonmap dragging\n"
" nodragging wireframe_mode wireframe wf nowireframe\n"

@ -89,6 +89,7 @@ int flash_cmap = 0; /* follow installed colormaps */
int shift_cmap = 0; /* ncells < 256 and needs shift of pixel values */
int force_indexed_color = 0; /* whether to force indexed color for 8bpp */
int cmap8to24 = 0; /* -8to24 */
char *cmap8to24_str = NULL;
int launch_gui = 0; /* -gui */
int use_modifier_tweak = 1; /* use the shift/altgr modifier tweak */

@ -64,6 +64,7 @@ extern int flash_cmap;
extern int shift_cmap;
extern int force_indexed_color;
extern int cmap8to24;
extern char *cmap8to24_str;
extern int launch_gui;
extern int use_modifier_tweak;

@ -411,6 +411,7 @@ static void update_x11_pointer_mask(int mask) {
int skip = 0;
if (!button_mask) {
X_LOCK;
if (get_wm_frame_pos(&px, &py, &x, &y, &w, &h,
&frame, &mwin)) {
got_wm_frame = 1;
@ -423,6 +424,7 @@ if (debug_scroll > 1) fprintf(stderr, "wm_win: 0x%lx\n", mwin);
} else {
got_wm_frame = 0;
}
X_UNLOCK;
}
if (got_wm_frame) {
if (wireframe && near_wm_edge(x, y, w, h, px, py)) {

@ -200,7 +200,9 @@ void initialize_speeds(void) {
int n = 0;
double dt, timer;
dtime0(&timer);
if (fullscreen) {
if (raw_fb && ! dpy) { /* raw_fb hack */
n = 0;
} else if (fullscreen) {
copy_image(fullscreen, 0, 0, 0, 0);
n = fullscreen->bytes_per_line * fullscreen->height;
} else if (scanline) {

@ -563,6 +563,7 @@ int remote_control_access_ok(void) {
rfbLog("XAUTHORITY is not required on display.\n");
rfbLog(" %s\n", DisplayString(dpy));
XCloseDisplay(dpy2);
dpy2 = NULL;
return 0;
}
@ -1005,6 +1006,26 @@ char *process_remote_cmd(char *cmd, int stringonly) {
cmap8to24 = 0;
do_new_fb(0);
} else if (strstr(p, "8to24_opts") == p) {
COLON_CHECK("8to24_opts:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%s", p, co,
NONUL(cmap8to24_str));
goto qry;
}
p += strlen("8to24_opts:");
if (cmap8to24_str) {
free(cmap8to24_str);
}
cmap8to24_str = strdup(p);
if (*p == '\0') {
cmap8to24 = 0;
} else {
cmap8to24 = 1;
}
rfbLog("remote_cmd: set cmap8to24_str to: %s\n", cmap8to24_str);
do_new_fb(0);
} else if (strstr(p, "visual") == p) {
COLON_CHECK("visual:")
if (query) {

@ -980,6 +980,8 @@ static XImage *initialize_raw_fb(void) {
raw_fb_image->depth = (b == 32) ? 24 : b;
}
depth = raw_fb_image->depth;
if (clipshift) {
memset(raw_fb, 0xff, dpy_x * dpy_y * b/8);
} else if (raw_fb_addr) {

@ -122,6 +122,7 @@ Screen
overlay
overlay_nocursor
8to24
8to24_opts:
=GAL LOFF
=GAL 8-Bit-Color::
flashcmap

@ -133,6 +133,7 @@ char gui_code[] = "";
" overlay\n"
" overlay_nocursor\n"
" 8to24\n"
" 8to24_opts:\n"
" =GAL LOFF\n"
" =GAL 8-Bit-Color::\n"
" flashcmap\n"

@ -217,6 +217,7 @@ void update_stack_list(void) {
dtime0(&now);
X_LOCK;
for (k=0; k < stack_list_num; k++) {
Window win = stack_list[k].win;
if (win != None && win < 10) {
@ -241,6 +242,7 @@ void update_stack_list(void) {
stack_list[k].fetched = 1;
stack_list[k].time = now;
}
X_UNLOCK;
if (0) fprintf(stderr, "update_stack_list[%d]: %.4f %.4f\n", stack_list_num, now - x11vnc_start, dtime(&now));
}

@ -2,7 +2,7 @@
.TH X11VNC "1" "January 2006" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.8, lastmod: 2006-01-18
version: 0.8, lastmod: 2006-01-21
.SH SYNOPSIS
.B x11vnc
[OPTION]...
@ -178,29 +178,26 @@ visual (e.g. some apps have \fB-use24\fR or \fB-visual\fR options).
Sets \fB-overlay,\fR but does not try to draw the exact mouse
cursor shape using the overlay mechanism.
.PP
\fB-8to24\fR
\fB-8to24\fR \fI[opts]\fR
.IP
If \fB-overlay\fR is not supported on your OS, and you have a
legacy 8bpp app that you want to view on a multi-depth
display with default depth 24 (and is 32 bpp), try
this option. It will also work for a default depth 8
display with depth 24 overlay windows. This option
Try this option if \fB-overlay\fR is not supported on your
OS, and you have a legacy 8bpp app that you want to
view on a multi-depth display with default depth 24
(and is 32 bpp) or have default depth 8 display with
depth 24 overlay windows for some apps. This option
may not work on all X servers and hardware (tested on
XFree86/Xorg mga driver).
.IP
It enables a hack where x11vnc monitors windows within 3
levels from the root window. If it finds any that are
8bpp it will apply a transformation for pixel data in
these regions where it extracts the 8bpp index color
value from bits 25-32 and maps them on to TrueColor
values and inserts them into bits 1-24 (i.e. overwrites
bits 1-24).
.IP
For default depth 8 displays, everything is tranformed
to 32bpp (and is potentially a improvement over
\fB-flashcmap).\fR Also for default depth 8 displays, setting
the env. var. HIGHBITS_8TO24 may give a speedup for
transforming 8bpp pixel data.
XFree86/Xorg mga driver). The "opts" string is not
required and is described below.
.IP
This mode enables a hack where x11vnc monitors windows
within 3 levels from the root window. If it finds
any that are 8bpp it will apply a transformation for
pixel data in these regions where it extracts the 8bpp
index color value from bits 25-32 and maps them on
to TrueColor values and inserts them into bits 1-24
(i.e. overwrites bits 1-24). Whereas for default
depth 8 displays, everything is tranformed to 32bpp
(and is potentially a improvement over \fB-flashcmap).\fR
.IP
These schemes appear to work, but may still have
bugs and note that they do hog resources. If there
@ -217,17 +214,24 @@ Also the option, say, \fB-fixscreen\fR V=3.0 may be use
to periodically refresh the screen (at the cost of
bandwidth).
.IP
Debugging for this mode can be enabled by setting the
environment variable DEBUG_8TO24 to 1, 2, or 3.
The [opts] string can contain the following settings.
Multiple settings are separated by commas.
.IP
If there are problems, to enable an even more
experimental mode, set the environment variable
XGETIMAGE_8TO24=1 before starting x11vnc. This enables
a scheme were XGetImage() is used to retrieve the 8bpp
data instead of assuming that data is in bits 25-32.
This mode is significantly slower than the above mode.
For the default depth 8 case, XGetImage() is always
used to access depth 24 pixel data.
For when there are still color problems, enable an even
more experimental mode via the option "getimage".
This enables a scheme were XGetImage() is used to
retrieve the 8bpp data instead of assuming that data
is in bits 25-32. This mode is significantly slower
than the above mode. For the default depth 8 case,
XGetImage() is always used to access depth 24 pixel
data.
.IP
For default depth 8 displays, setting option
"highbits" may give a speedup for transforming 8bpp
pixel data.
.IP
Debugging for this mode can be enabled by setting
"dbg=1", "dbg=2", or "dbg=3"
.PP
\fB-scale\fR \fIfraction\fR
.IP
@ -2035,6 +2039,8 @@ nooverlay_cursor.
.IP
no8to24 disable \fB-8to24\fR mode.
.IP
8to24_opts:str set the \fB-8to24\fR opts to "str".
.IP
visual:vis set \fB-visual\fR to "vis"
.IP
scale:frac set \fB-scale\fR to "frac"
@ -2474,22 +2480,22 @@ nowaitmapped clip flashcmap noflashcmap shiftcmap
truecolor notruecolor overlay nooverlay overlay_cursor
overlay_yescursor nooverlay_nocursor nooverlay_cursor
nooverlay_yescursor overlay_nocursor 8to24 no8to24
visual scale scale_cursor viewonly noviewonly shared
noshared forever noforever once timeout filexfer deny
lock nodeny unlock connect allowonce allow localhost
nolocalhost listen lookup nolookup accept afteraccept
gone shm noshm flipbyteorder noflipbyteorder onetile
noonetile solid_color solid nosolid blackout xinerama
noxinerama xtrap noxtrap xrandr noxrandr xrandr_mode
padgeom quiet q noquiet modtweak nomodtweak xkb
noxkb skip_keycodes sloppy_keys nosloppy_keys
skip_dups noskip_dups add_keysyms noadd_keysyms
clear_mods noclear_mods clear_keys noclear_keys
remap repeat norepeat fb nofb bell nobell sel nosel
primary noprimary seldir cursorshape nocursorshape
cursorpos nocursorpos cursor show_cursor noshow_cursor
nocursor arrow xfixes noxfixes xdamage noxdamage
xd_area xd_mem alphacut alphafrac alpharemove
8to24_opts visual scale scale_cursor viewonly
noviewonly shared noshared forever noforever once
timeout filexfer deny lock nodeny unlock connect
allowonce allow localhost nolocalhost listen lookup
nolookup accept afteraccept gone shm noshm flipbyteorder
noflipbyteorder onetile noonetile solid_color solid
nosolid blackout xinerama noxinerama xtrap noxtrap
xrandr noxrandr xrandr_mode padgeom quiet q noquiet
modtweak nomodtweak xkb noxkb skip_keycodes sloppy_keys
nosloppy_keys skip_dups noskip_dups add_keysyms
noadd_keysyms clear_mods noclear_mods clear_keys
noclear_keys remap repeat norepeat fb nofb bell
nobell sel nosel primary noprimary seldir cursorshape
nocursorshape cursorpos nocursorpos 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 wireframe_mode wireframe wf nowireframe

@ -1273,6 +1273,12 @@ int main(int argc, char* argv[]) {
overlay_cursor = 2;
} else if (!strcmp(arg, "-8to24")) {
cmap8to24 = 1;
if (i < argc-1) {
char *s = argv[i+1];
if (s[0] != '-') {
cmap8to24_str = strdup(s);
}
}
} else if (!strcmp(arg, "-visual")) {
CHECK_ARGC
visual_str = strdup(argv[++i]);

@ -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 lastmod: 2006-01-18";
char lastmod[] = "0.8 lastmod: 2006-01-21";
/* X display info */

Loading…
Cancel
Save