x11vnc: -8to24 speedups and improvements.

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

File diff suppressed because it is too large Load Diff

@ -8,6 +8,6 @@ extern int multivis_24count;
extern void check_for_multivis(void); extern void check_for_multivis(void);
extern void bpp8to24(int, int, int, int); extern void bpp8to24(int, int, int, int);
extern void mark_8bpp(void); extern void mark_8bpp(int);
#endif /* _X11VNC_8TO24_H */ #endif /* _X11VNC_8TO24_H */

@ -1,3 +1,6 @@
2006-02-04 Karl Runge <runge@karlrunge.com>
* x11vnc: -8to24 speedups and improvements.
2006-01-21 Karl Runge <runge@karlrunge.com> 2006-01-21 Karl Runge <runge@karlrunge.com>
* x11vnc: -8to24 opts, use XGetSubImage. fix -threads deadlocks and * x11vnc: -8to24 opts, use XGetSubImage. fix -threads deadlocks and
-rawfb crash. -rawfb crash.

@ -1,5 +1,5 @@
x11vnc README file Date: Sat Jan 21 20:25:28 EST 2006 x11vnc README file Date: Sat Feb 4 22:21:00 EST 2006
The following information is taken from these URLs: The following information is taken from these URLs:
@ -585,7 +585,7 @@ make
I'd appreciate any additional testing very much! I'd appreciate any additional testing very much!
Please help test and debug the 0.8 version for release sometime in Please help test and debug the 0.8 version for release sometime in
Jan/2006. Feb/2006.
[53]x11vnc-0.8.tar.gz [53]x11vnc-0.8.tar.gz
@ -4289,7 +4289,7 @@ ied)
Based on the bpp x11vnc will try to guess the red, green, and blue Based on the bpp x11vnc will try to guess the red, green, and blue
masks (these indicate which bits correspond to each color). It if gets masks (these indicate which bits correspond to each color). It if gets
it wrong you can specify them manually via the optional ":R/G/B" it wrong you can specify them manually via the optional ":R/G/B"
field. E.g. ":0xff000/0x00ff00/0x0000ff" (this is the default for field. E.g. ":0xff0000/0x00ff00/0x0000ff" (this is the default for
32bpp). 32bpp).
Finally, the framebuffer may not begin at the beginning of the memory Finally, the framebuffer may not begin at the beginning of the memory
@ -4898,7 +4898,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options: Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions) % x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.8 lastmod: 2006-01-21 x11vnc: allow VNC connections to real X11 displays. 0.8 lastmod: 2006-02-04
x11vnc options: x11vnc options:
-display disp -auth file -display disp -auth file
@ -5009,7 +5009,7 @@ libvncserver-tight-extension options:
% x11vnc -help % x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.8 lastmod: 2006-01-21 x11vnc: allow VNC connections to real X11 displays. 0.8 lastmod: 2006-02-04
Typical usage is: Typical usage is:
@ -5143,55 +5143,66 @@ Options:
-8to24 [opts] Try this option if -overlay is not supported on your -8to24 [opts] Try this option if -overlay is not supported on your
OS, and you have a legacy 8bpp app that you want to OS, and you have a legacy 8bpp app that you want to
view on a multi-depth display with default depth 24 view on a multi-depth display with default depth 24
(and is 32 bpp) or have default depth 8 display with (and is 32 bpp) OR have a default depth 8 display with
depth 24 overlay windows for some apps. This option depth 24 overlay windows for some apps. This option
may not work on all X servers and hardware (tested on may not work on all X servers and hardware (tested
XFree86/Xorg mga driver). The "opts" string is not on XFree86/Xorg mga driver and Xsun). The "opts"
required and is described below. string is not required and is described below.
This mode enables a hack where x11vnc monitors windows This mode enables a hack where x11vnc monitors windows
within 3 levels from the root window. If it finds within 3 levels from the root window. If it finds
any that are 8bpp it will apply a transformation for any that are 8bpp it extracts the indexed color
pixel data in these regions where it extracts the 8bpp pixel values using XGetImage() and then applies a
index color value from bits 25-32 and maps them on transformation using the colormap(s) to create TrueColor
to TrueColor values and inserts them into bits 1-24 RGB values that it in turn inserts into bits 1-24 of
(i.e. overwrites bits 1-24). Whereas for default the framebuffer. This creates a depth 24 "view"
depth 8 displays, everything is tranformed to 32bpp of the display that is then exported via VNC.
(and is potentially a improvement over -flashcmap).
Conversely, for default depth 8 displays, the depth
These schemes appear to work, but may still have 24 regions are read by XGetImage() and everything is
bugs and note that they do hog resources. If there transformed and inserted into a depth 24 TrueColor
are multiple 8bpp windows using different colormaps, framebuffer.
one may have to iconify all but one for the colors to
be correct. Note that even if there are *no* depth 24 visuals or
windows (i.e. pure 8bpp), this mode is potentially
There may also be painting errors for clipping and a improvement over -flashcmap because it avoids the
switching between windows of depths 8 and 24. flashing and shows each window in the correct color.
Heuristics are applied to try to minimize the painting
errors. One can also press 3 Alt_L's in a row to This method appear to work, but may still have bugs
refresh the screen if the error does not repair itself. and it does hog resources. If there are multiple 8bpp
Also the option, say, -fixscreen V=3.0 may be use windows using different colormaps, one may have to
to periodically refresh the screen (at the cost of iconify all but one for the colors to be correct.
bandwidth).
There may be painting errors for clipping and switching
between windows of depths 8 and 24. Heuristics are
applied to try to minimize the painting errors.
One can also press 3 Alt_L's in a row to refresh the
screen if the error does not repair itself. Also the
option -fixscreen 8=3.0 or -fixscreen V=3.0 may be
use to periodically refresh the screen at the cost of
bandwidth (every 3 sec for this example).
The [opts] string can contain the following settings. The [opts] string can contain the following settings.
Multiple settings are separated by commas. Multiple settings are separated by commas.
For when there are still color problems, enable an even For for some X servers with default depth 24 a
more experimental mode via the option "getimage". speedup may be achieved via the option "nogetimage".
This enables a scheme were XGetImage() is used to This enables a scheme were XGetImage() is not used
retrieve the 8bpp data instead of assuming that data to retrieve the 8bpp data. Instead, it assumes that
is in bits 25-32. This mode is significantly slower the 8bpp data is in bits 25-32 of the 32bit X pixels.
than the above mode. For the default depth 8 case, There is no reason the X server should put the data
XGetImage() is always used to access depth 24 pixel there for our poll requests, but some do and so the
data. extra steps to retrieve it can be skipped. Tested with
mga driver with XFree86/Xorg. For the default depth
For default depth 8 displays, setting option 8 case this option is ignored.
"highbits" may give a speedup for transforming 8bpp
pixel data. To adjust how often XGetImage() is used to poll the
non-default visual regions for changes, use the option
"poll=t" where "t" is a floating point time.
(default: 0.05)
Debugging for this mode can be enabled by setting Debugging for this mode can be enabled by setting
"dbg=1", "dbg=2", or "dbg=3" "dbg=1", "dbg=2", or "dbg=3".
-scale fraction Scale the framebuffer by factor "fraction". Values -scale fraction Scale the framebuffer by factor "fraction". Values
less than 1 shrink the fb, larger ones expand it. Note: less than 1 shrink the fb, larger ones expand it. Note:
@ -6185,22 +6196,25 @@ Options:
but it can be used for any scenario. This option but it can be used for any scenario. This option
periodically performs costly operations and so periodically performs costly operations and so
interactive response may be reduced when it is on. interactive response may be reduced when it is on.
You can use 3 Alt_L's (the Left "Alt" key) taps in a You can use 3 Alt_L's (the Left "Alt" key) taps in
row described under -scrollcopyrect instead to manually a row (as described under -scrollcopyrect) instead to
request a screen repaint when it is needed. manually request a screen repaint when it is needed.
"string" is a comma separated list of one or more of "string" is a comma separated list of one or more of
the following: "V=t", "C=t", and "X=t". In these the following: "V=t", "C=t", "X=t", and "8=t".
"t" stands for a time in seconds (it is a floating In these "t" stands for a time in seconds (it is
point even though one should usually use values > 2 to a floating point even though one should usually use
avoid wasting resources). V sets how frequently the values > 2 to avoid wasting resources). V sets how
entire screen should be sent to viewers (it is like the frequently the entire screen should be sent to viewers
3 Alt_L's). C sets how long to wait after a CopyRect (it is like the 3 Alt_L's). C sets how long to wait
to repaint the full screen. X sets how frequently after a CopyRect to repaint the full screen. X sets
to reread the full X11 framebuffer from the X server how frequently to reread the full X11 framebuffer from
and push it out to connected viewers. Use of X should the X server and push it out to connected viewers.
be rare, please report a bug if you find you need it. Use of X should be rare, please report a bug if you
Examples: -fixscreen V=10 -fixscreen C=10 find you need it. 8= applies only for -8to24 mode: it
sets how often the non-default visual regions of the
screen (e.g. 8bpp windows) are refreshed. Examples:
-fixscreen V=10 -fixscreen C=10
-debug_scroll Turn on debugging info printout for the scroll -debug_scroll Turn on debugging info printout for the scroll
heuristics. "-ds" is an alias. Specify it multiple heuristics. "-ds" is an alias. Specify it multiple

@ -151,55 +151,66 @@ void print_help(int mode) {
"-8to24 [opts] Try this option if -overlay is not supported on your\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" " OS, and you have a legacy 8bpp app that you want to\n"
" view on a multi-depth display with default depth 24\n" " view on a multi-depth display with default depth 24\n"
" (and is 32 bpp) or have default depth 8 display with\n" " (and is 32 bpp) OR have a default depth 8 display with\n"
" depth 24 overlay windows for some apps. This option\n" " depth 24 overlay windows for some apps. This option\n"
" may not work on all X servers and hardware (tested on\n" " may not work on all X servers and hardware (tested\n"
" XFree86/Xorg mga driver). The \"opts\" string is not\n" " on XFree86/Xorg mga driver and Xsun). The \"opts\"\n"
" required and is described below.\n" " string is not required and is described below.\n"
"\n" "\n"
" This mode enables a hack where x11vnc monitors windows\n" " This mode enables a hack where x11vnc monitors windows\n"
" within 3 levels from the root window. If it finds\n" " within 3 levels from the root window. If it finds\n"
" any that are 8bpp it will apply a transformation for\n" " any that are 8bpp it extracts the indexed color\n"
" pixel data in these regions where it extracts the 8bpp\n" " pixel values using XGetImage() and then applies a\n"
" index color value from bits 25-32 and maps them on\n" " transformation using the colormap(s) to create TrueColor\n"
" to TrueColor values and inserts them into bits 1-24\n" " RGB values that it in turn inserts into bits 1-24 of\n"
" (i.e. overwrites bits 1-24). Whereas for default\n" " the framebuffer. This creates a depth 24 \"view\"\n"
" depth 8 displays, everything is tranformed to 32bpp\n" " of the display that is then exported via VNC.\n"
" (and is potentially a improvement over -flashcmap).\n" "\n"
"\n" " Conversely, for default depth 8 displays, the depth\n"
" These schemes appear to work, but may still have\n" " 24 regions are read by XGetImage() and everything is\n"
" bugs and note that they do hog resources. If there\n" " transformed and inserted into a depth 24 TrueColor\n"
" are multiple 8bpp windows using different colormaps,\n" " framebuffer.\n"
" one may have to iconify all but one for the colors to\n" "\n"
" be correct.\n" " Note that even if there are *no* depth 24 visuals or\n"
"\n" " windows (i.e. pure 8bpp), this mode is potentially\n"
" There may also be painting errors for clipping and\n" " a improvement over -flashcmap because it avoids the\n"
" switching between windows of depths 8 and 24.\n" " flashing and shows each window in the correct color.\n"
" Heuristics are applied to try to minimize the painting\n" "\n"
" errors. One can also press 3 Alt_L's in a row to\n" " This method appear to work, but may still have bugs\n"
" refresh the screen if the error does not repair itself.\n" " and it does hog resources. If there are multiple 8bpp\n"
" Also the option, say, -fixscreen V=3.0 may be use\n" " windows using different colormaps, one may have to\n"
" to periodically refresh the screen (at the cost of\n" " iconify all but one for the colors to be correct.\n"
" bandwidth).\n" "\n"
" There may be painting errors for clipping and switching\n"
" between windows of depths 8 and 24. Heuristics are\n"
" applied to try to minimize the painting errors.\n"
" One can also press 3 Alt_L's in a row to refresh the\n"
" screen if the error does not repair itself. Also the\n"
" option -fixscreen 8=3.0 or -fixscreen V=3.0 may be\n"
" use to periodically refresh the screen at the cost of\n"
" bandwidth (every 3 sec for this example).\n"
"\n" "\n"
" The [opts] string can contain the following settings.\n" " The [opts] string can contain the following settings.\n"
" Multiple settings are separated by commas.\n" " Multiple settings are separated by commas.\n"
"\n" "\n"
" For when there are still color problems, enable an even\n" " For for some X servers with default depth 24 a\n"
" more experimental mode via the option \"getimage\".\n" " speedup may be achieved via the option \"nogetimage\".\n"
" This enables a scheme were XGetImage() is used to\n" " This enables a scheme were XGetImage() is not used\n"
" retrieve the 8bpp data instead of assuming that data\n" " to retrieve the 8bpp data. Instead, it assumes that\n"
" is in bits 25-32. This mode is significantly slower\n" " the 8bpp data is in bits 25-32 of the 32bit X pixels.\n"
" than the above mode. For the default depth 8 case,\n" " There is no reason the X server should put the data\n"
" XGetImage() is always used to access depth 24 pixel\n" " there for our poll requests, but some do and so the\n"
" data.\n" " extra steps to retrieve it can be skipped. Tested with\n"
"\n" " mga driver with XFree86/Xorg. For the default depth\n"
" For default depth 8 displays, setting option\n" " 8 case this option is ignored.\n"
" \"highbits\" may give a speedup for transforming 8bpp\n" "\n"
" pixel data.\n" " To adjust how often XGetImage() is used to poll the\n"
" non-default visual regions for changes, use the option\n"
" \"poll=t\" where \"t\" is a floating point time.\n"
" (default: %.2f)\n"
"\n" "\n"
" Debugging for this mode can be enabled by setting \n" " Debugging for this mode can be enabled by setting \n"
" \"dbg=1\", \"dbg=2\", or \"dbg=3\"\n" " \"dbg=1\", \"dbg=2\", or \"dbg=3\".\n"
"\n" "\n"
"-scale fraction Scale the framebuffer by factor \"fraction\". Values\n" "-scale fraction Scale the framebuffer by factor \"fraction\". Values\n"
" less than 1 shrink the fb, larger ones expand it. Note:\n" " less than 1 shrink the fb, larger ones expand it. Note:\n"
@ -1202,22 +1213,25 @@ void print_help(int mode) {
" but it can be used for any scenario. This option\n" " but it can be used for any scenario. This option\n"
" periodically performs costly operations and so\n" " periodically performs costly operations and so\n"
" interactive response may be reduced when it is on.\n" " interactive response may be reduced when it is on.\n"
" You can use 3 Alt_L's (the Left \"Alt\" key) taps in a\n" " You can use 3 Alt_L's (the Left \"Alt\" key) taps in\n"
" row described under -scrollcopyrect instead to manually\n" " a row (as described under -scrollcopyrect) instead to\n"
" request a screen repaint when it is needed.\n" " manually request a screen repaint when it is needed.\n"
"\n" "\n"
" \"string\" is a comma separated list of one or more of\n" " \"string\" is a comma separated list of one or more of\n"
" the following: \"V=t\", \"C=t\", and \"X=t\". In these\n" " the following: \"V=t\", \"C=t\", \"X=t\", and \"8=t\".\n"
" \"t\" stands for a time in seconds (it is a floating\n" " In these \"t\" stands for a time in seconds (it is\n"
" point even though one should usually use values > 2 to\n" " a floating point even though one should usually use\n"
" avoid wasting resources). V sets how frequently the\n" " values > 2 to avoid wasting resources). V sets how\n"
" entire screen should be sent to viewers (it is like the\n" " frequently the entire screen should be sent to viewers\n"
" 3 Alt_L's). C sets how long to wait after a CopyRect\n" " (it is like the 3 Alt_L's). C sets how long to wait\n"
" to repaint the full screen. X sets how frequently\n" " after a CopyRect to repaint the full screen. X sets\n"
" to reread the full X11 framebuffer from the X server\n" " how frequently to reread the full X11 framebuffer from\n"
" and push it out to connected viewers. Use of X should\n" " the X server and push it out to connected viewers.\n"
" be rare, please report a bug if you find you need it.\n" " Use of X should be rare, please report a bug if you\n"
" Examples: -fixscreen V=10 -fixscreen C=10\n" " find you need it. 8= applies only for -8to24 mode: it\n"
" sets how often the non-default visual regions of the\n"
" screen (e.g. 8bpp windows) are refreshed. Examples:\n"
" -fixscreen V=10 -fixscreen C=10\n"
"\n" "\n"
"-debug_scroll Turn on debugging info printout for the scroll\n" "-debug_scroll Turn on debugging info printout for the scroll\n"
" heuristics. \"-ds\" is an alias. Specify it multiple\n" " heuristics. \"-ds\" is an alias. Specify it multiple\n"
@ -2062,6 +2076,7 @@ void print_help(int mode) {
exit(1); exit(1);
} }
fprintf(stderr, help, lastmod, fprintf(stderr, help, lastmod,
POLL_8TO24_DELAY,
scaling_copyrect ? ":cr":":nocr", scaling_copyrect ? ":cr":":nocr",
view_only ? "on":"off", view_only ? "on":"off",
shared ? "on":"off", shared ? "on":"off",

@ -24,7 +24,7 @@ char *solid_default = "cyan4";
char *wmdt_str = NULL; /* -wmdt */ char *wmdt_str = NULL; /* -wmdt */
char *speeds_str = NULL; /* -speeds TBD */ char *speeds_str = NULL; /* -speeds */
char *rc_rcfile = NULL; /* -rc */ char *rc_rcfile = NULL; /* -rc */
int rc_rcfile_default = 0; int rc_rcfile_default = 0;
@ -208,6 +208,7 @@ char* screen_fixup_str = NULL;
double screen_fixup_V = 0.0; double screen_fixup_V = 0.0;
double screen_fixup_C = 0.0; double screen_fixup_C = 0.0;
double screen_fixup_X = 0.0; double screen_fixup_X = 0.0;
double screen_fixup_8 = 0.0;
#ifndef NOREPEAT #ifndef NOREPEAT
#define NOREPEAT 1 #define NOREPEAT 1

@ -154,6 +154,7 @@ extern char* screen_fixup_str;
extern double screen_fixup_V; extern double screen_fixup_V;
extern double screen_fixup_C; extern double screen_fixup_C;
extern double screen_fixup_X; extern double screen_fixup_X;
extern double screen_fixup_8;
extern int no_autorepeat; extern int no_autorepeat;
extern int no_repeat_countdown; extern int no_repeat_countdown;

@ -13,6 +13,10 @@
#define SCROLL_COPYRECT_PARMS "0+64+32+32,0.02+0.10+0.9,0.03+0.06+0.5+0.1+5.0" #define SCROLL_COPYRECT_PARMS "0+64+32+32,0.02+0.10+0.9,0.03+0.06+0.5+0.1+5.0"
#endif #endif
#ifndef POLL_8TO24_DELAY
#define POLL_8TO24_DELAY 0.05
#endif
#define LATENCY0 20 /* 20ms */ #define LATENCY0 20 /* 20ms */
#define NETRATE0 20 /* 20KB/sec */ #define NETRATE0 20 /* 20KB/sec */

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

@ -2379,7 +2379,7 @@ static int scan_display(int ystart, int rescan) {
} }
static int scanlines[NSCAN] = { int scanlines[NSCAN] = {
0, 16, 8, 24, 4, 20, 12, 28, 0, 16, 8, 24, 4, 20, 12, 28,
10, 26, 18, 2, 22, 6, 30, 14, 10, 26, 18, 2, 22, 6, 30, 14,
1, 17, 9, 25, 7, 23, 15, 31, 1, 17, 9, 25, 7, 23, 15, 31,
@ -2435,7 +2435,7 @@ int scan_for_updates(int count_only) {
/* check for changed colormap */ /* check for changed colormap */
set_colormap(0); set_colormap(0);
} }
if (cmap8to24 && scan_count % 4 == 0) { if (cmap8to24 && scan_count % 1 == 0) {
check_for_multivis(); check_for_multivis();
} }
if (use_xdamage) { if (use_xdamage) {

@ -4,6 +4,7 @@
/* -- scan.h -- */ /* -- scan.h -- */
extern int nap_ok; extern int nap_ok;
extern int scanlines[];
extern void initialize_tiles(void); extern void initialize_tiles(void);
extern void free_tiles(void); extern void free_tiles(void);

@ -211,6 +211,7 @@ void parse_fixscreen(void) {
screen_fixup_V = 0.0; screen_fixup_V = 0.0;
screen_fixup_C = 0.0; screen_fixup_C = 0.0;
screen_fixup_X = 0.0; screen_fixup_X = 0.0;
screen_fixup_8 = 0.0;
if (! screen_fixup_str) { if (! screen_fixup_str) {
return; return;
@ -227,6 +228,8 @@ void parse_fixscreen(void) {
screen_fixup_C = t; screen_fixup_C = t;
} else if (*p == 'X' && sscanf(p, "X=%lf", &t) == 1) { } else if (*p == 'X' && sscanf(p, "X=%lf", &t) == 1) {
screen_fixup_X = t; screen_fixup_X = t;
} else if (*p == 'X' && sscanf(p, "8=%lf", &t) == 1) {
screen_fixup_8 = t;
} }
p = strtok(NULL, ","); p = strtok(NULL, ",");
} }
@ -235,6 +238,7 @@ void parse_fixscreen(void) {
if (screen_fixup_V < 0.0) screen_fixup_V = 0.0; if (screen_fixup_V < 0.0) screen_fixup_V = 0.0;
if (screen_fixup_C < 0.0) screen_fixup_C = 0.0; if (screen_fixup_C < 0.0) screen_fixup_C = 0.0;
if (screen_fixup_X < 0.0) screen_fixup_X = 0.0; if (screen_fixup_X < 0.0) screen_fixup_X = 0.0;
if (screen_fixup_8 < 0.0) screen_fixup_8 = 0.0;
} }
/* /*
@ -716,11 +720,11 @@ typedef struct saveline {
*/ */
static void draw_box(int x, int y, int w, int h, int restore) { static void draw_box(int x, int y, int w, int h, int restore) {
int x0, y0, x1, y1, i, pixelsize = bpp/8; int x0, y0, x1, y1, i, pixelsize = bpp/8;
char *dst, *src; char *dst, *src, *use_fb;
static saveline_t *save[4]; static saveline_t *save[4];
static int first = 1, len = 0; static int first = 1, len = 0;
int max = dpy_x > dpy_y ? dpy_x : dpy_y; int max = dpy_x > dpy_y ? dpy_x : dpy_y;
int sz, lw = wireframe_lw; int use_Bpl, lw = wireframe_lw;
unsigned long shade = wireframe_shade; unsigned long shade = wireframe_shade;
int color = 0; int color = 0;
unsigned short us = 0; unsigned short us = 0;
@ -730,7 +734,18 @@ static void draw_box(int x, int y, int w, int h, int restore) {
x -= coff_x; x -= coff_x;
y -= coff_y; y -= coff_y;
} }
/* no subwin for wireframe */
/* handle -8to24 mode: use 2nd fb only */
use_fb = main_fb;
use_Bpl = main_bytes_per_line;
if (cmap8to24 && cmap8to24_fb) {
use_fb = cmap8to24_fb;
pixelsize = 4;
if (depth == 8) {
use_Bpl *= 4;
}
}
if (max > len) { if (max > len) {
/* create/resize storage lines: */ /* create/resize storage lines: */
@ -745,8 +760,7 @@ static void draw_box(int x, int y, int w, int h, int restore) {
} }
save[i] = (saveline_t *) malloc(sizeof(saveline_t)); save[i] = (saveline_t *) malloc(sizeof(saveline_t));
save[i]->saved = 0; save[i]->saved = 0;
sz = (LW_MAX+1)*len*pixelsize; save[i]->data = (char *) malloc( (LW_MAX+1)*len*4 );
save[i]->data = (char *) malloc(sz);
/* /*
* Four types of lines: * Four types of lines:
@ -813,8 +827,7 @@ static void draw_box(int x, int y, int w, int h, int restore) {
y_max = yu; y_max = yu;
} }
src = save[i]->data + (yu-y_start)*y_step; src = save[i]->data + (yu-y_start)*y_step;
dst = main_fb + yu*main_bytes_per_line + dst = use_fb + yu*use_Bpl + x0*pixelsize;
x0*pixelsize;
memcpy(dst, src, (x1-x0)*pixelsize); memcpy(dst, src, (x1-x0)*pixelsize);
} }
if (y_min >= 0) { if (y_min >= 0) {
@ -917,8 +930,7 @@ if (0) fprintf(stderr, " DrawBox: %dx%d+%d+%d\n", w, h, x, y);
/* save fb data for this line: */ /* save fb data for this line: */
save[i]->saved = 1; save[i]->saved = 1;
src = main_fb + yu*main_bytes_per_line + src = use_fb + yu*use_Bpl + x0*pixelsize;
x0*pixelsize;
dst = save[i]->data + (yu-y_start)*y_step; dst = save[i]->data + (yu-y_start)*y_step;
memcpy(dst, src, (x1-x0)*pixelsize); memcpy(dst, src, (x1-x0)*pixelsize);
@ -1577,6 +1589,7 @@ if (0) fprintf(stderr, " try_copyrect dt: %.4f\n", dt);
win_area += (tx2 - tx1)*(ty2 - ty1); win_area += (tx2 - tx1)*(ty2 - ty1);
} }
sraRgnReleaseIterator(iter); sraRgnReleaseIterator(iter);
sraRgnDestroy(tmpregion); sraRgnDestroy(tmpregion);
@ -1634,6 +1647,7 @@ if (db) fprintf(stderr, " DFC(%d,%d-%d,%d)", tx1, ty1, tx2, ty2);
PUSH_TEST(0); PUSH_TEST(0);
} }
sraRgnReleaseIterator(iter); sraRgnReleaseIterator(iter);
dt = dtime(&tm); dt = dtime(&tm);
if (db) fprintf(stderr, " dfc---- dt: %.4f", dt); if (db) fprintf(stderr, " dfc---- dt: %.4f", dt);
@ -3726,20 +3740,22 @@ if (db) fprintf(stderr, "send_copyrect: %d\n", sent_copyrect);
rfbPE(1000); rfbPE(1000);
wireframe_in_progress = 0; wireframe_in_progress = 0;
if (0) {
/* No longer needed. see draw_box() */
if (frame_changed && cmap8to24 && multivis_count) { if (frame_changed && cmap8to24 && multivis_count) {
/* handle -8to24 tweak, mark area and check 8bpp... */ /* handle -8to24 kludge, mark area and check 8bpp... */
int x1, x2, y1, y2, f = 16; int x1, x2, y1, y2, f = 16;
x1 = nmin(box_x, orig_x) - f; x1 = nmin(box_x, orig_x) - f;
y1 = nmin(box_y, orig_y) - f; y1 = nmin(box_y, orig_y) - f;
x2 = nmax(box_x + box_w, orig_x + orig_w) + f; x2 = nmax(box_x + box_w, orig_x + orig_w) + f;
y2 = nmax(box_y + box_h, orig_y + orig_h) + f; y2 = nmax(box_y + box_h, orig_y + orig_h) + f;
x1 = nfix(x1, dpy_x); x1 = nfix(x1, dpy_x);
x2 = nfix(x2, dpy_x); x2 = nfix(x2, dpy_x+1);
y1 = nfix(y1, dpy_y); y1 = nfix(y1, dpy_y);
y2 = nfix(y2, dpy_y); y2 = nfix(y2, dpy_y+1);
if (0) fprintf(stderr, "wireframe_in_progress over: %d %d %d %d\n", x1, y1, x2, y2);
check_for_multivis(); check_for_multivis();
if (1) mark_rect_as_modified(x1, y1, x2, y2, 0); mark_rect_as_modified(x1, y1, x2, y2, 0);
}
} }
urgent_update = 1; urgent_update = 1;

@ -1,8 +1,8 @@
.\" This file was automatically generated from x11vnc -help output. .\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "January 2006" "x11vnc " "User Commands" .TH X11VNC "1" "February 2006" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays x11vnc - allow VNC connections to real X11 displays
version: 0.8, lastmod: 2006-01-21 version: 0.8, lastmod: 2006-02-04
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
@ -183,55 +183,66 @@ cursor shape using the overlay mechanism.
Try this option if \fB-overlay\fR is not supported on your Try this option if \fB-overlay\fR is not supported on your
OS, and you have a legacy 8bpp app that you want to OS, and you have a legacy 8bpp app that you want to
view on a multi-depth display with default depth 24 view on a multi-depth display with default depth 24
(and is 32 bpp) or have default depth 8 display with (and is 32 bpp) OR have a default depth 8 display with
depth 24 overlay windows for some apps. This option depth 24 overlay windows for some apps. This option
may not work on all X servers and hardware (tested on may not work on all X servers and hardware (tested
XFree86/Xorg mga driver). The "opts" string is not on XFree86/Xorg mga driver and Xsun). The "opts"
required and is described below. string is not required and is described below.
.IP .IP
This mode enables a hack where x11vnc monitors windows This mode enables a hack where x11vnc monitors windows
within 3 levels from the root window. If it finds within 3 levels from the root window. If it finds
any that are 8bpp it will apply a transformation for any that are 8bpp it extracts the indexed color
pixel data in these regions where it extracts the 8bpp pixel values using XGetImage() and then applies a
index color value from bits 25-32 and maps them on transformation using the colormap(s) to create TrueColor
to TrueColor values and inserts them into bits 1-24 RGB values that it in turn inserts into bits 1-24 of
(i.e. overwrites bits 1-24). Whereas for default the framebuffer. This creates a depth 24 "view"
depth 8 displays, everything is tranformed to 32bpp of the display that is then exported via VNC.
(and is potentially a improvement over \fB-flashcmap).\fR .IP
.IP Conversely, for default depth 8 displays, the depth
These schemes appear to work, but may still have 24 regions are read by XGetImage() and everything is
bugs and note that they do hog resources. If there transformed and inserted into a depth 24 TrueColor
are multiple 8bpp windows using different colormaps, framebuffer.
one may have to iconify all but one for the colors to .IP
be correct. Note that even if there are *no* depth 24 visuals or
.IP windows (i.e. pure 8bpp), this mode is potentially
There may also be painting errors for clipping and a improvement over \fB-flashcmap\fR because it avoids the
switching between windows of depths 8 and 24. flashing and shows each window in the correct color.
Heuristics are applied to try to minimize the painting .IP
errors. One can also press 3 Alt_L's in a row to This method appear to work, but may still have bugs
refresh the screen if the error does not repair itself. and it does hog resources. If there are multiple 8bpp
Also the option, say, \fB-fixscreen\fR V=3.0 may be use windows using different colormaps, one may have to
to periodically refresh the screen (at the cost of iconify all but one for the colors to be correct.
bandwidth). .IP
There may be painting errors for clipping and switching
between windows of depths 8 and 24. Heuristics are
applied to try to minimize the painting errors.
One can also press 3 Alt_L's in a row to refresh the
screen if the error does not repair itself. Also the
option \fB-fixscreen\fR 8=3.0 or \fB-fixscreen\fR V=3.0 may be
use to periodically refresh the screen at the cost of
bandwidth (every 3 sec for this example).
.IP .IP
The [opts] string can contain the following settings. The [opts] string can contain the following settings.
Multiple settings are separated by commas. Multiple settings are separated by commas.
.IP .IP
For when there are still color problems, enable an even For for some X servers with default depth 24 a
more experimental mode via the option "getimage". speedup may be achieved via the option "nogetimage".
This enables a scheme were XGetImage() is used to This enables a scheme were XGetImage() is not used
retrieve the 8bpp data instead of assuming that data to retrieve the 8bpp data. Instead, it assumes that
is in bits 25-32. This mode is significantly slower the 8bpp data is in bits 25-32 of the 32bit X pixels.
than the above mode. For the default depth 8 case, There is no reason the X server should put the data
XGetImage() is always used to access depth 24 pixel there for our poll requests, but some do and so the
data. extra steps to retrieve it can be skipped. Tested with
.IP mga driver with XFree86/Xorg. For the default depth
For default depth 8 displays, setting option 8 case this option is ignored.
"highbits" may give a speedup for transforming 8bpp .IP
pixel data. To adjust how often XGetImage() is used to poll the
non-default visual regions for changes, use the option
"poll=t" where "t" is a floating point time.
(default: 0.05)
.IP .IP
Debugging for this mode can be enabled by setting Debugging for this mode can be enabled by setting
"dbg=1", "dbg=2", or "dbg=3" "dbg=1", "dbg=2", or "dbg=3".
.PP .PP
\fB-scale\fR \fIfraction\fR \fB-scale\fR \fIfraction\fR
.IP .IP
@ -1477,22 +1488,25 @@ it is intended for cases when the \fB-scrollcopyrect\fR or
but it can be used for any scenario. This option but it can be used for any scenario. This option
periodically performs costly operations and so periodically performs costly operations and so
interactive response may be reduced when it is on. interactive response may be reduced when it is on.
You can use 3 Alt_L's (the Left "Alt" key) taps in a You can use 3 Alt_L's (the Left "Alt" key) taps in
row described under \fB-scrollcopyrect\fR instead to manually a row (as described under \fB-scrollcopyrect)\fR instead to
request a screen repaint when it is needed. manually request a screen repaint when it is needed.
.IP .IP
\fIstring\fR is a comma separated list of one or more of \fIstring\fR is a comma separated list of one or more of
the following: "V=t", "C=t", and "X=t". In these the following: "V=t", "C=t", "X=t", and "8=t".
"t" stands for a time in seconds (it is a floating In these "t" stands for a time in seconds (it is
point even though one should usually use values > 2 to a floating point even though one should usually use
avoid wasting resources). V sets how frequently the values > 2 to avoid wasting resources). V sets how
entire screen should be sent to viewers (it is like the frequently the entire screen should be sent to viewers
3 Alt_L's). C sets how long to wait after a CopyRect (it is like the 3 Alt_L's). C sets how long to wait
to repaint the full screen. X sets how frequently after a CopyRect to repaint the full screen. X sets
to reread the full X11 framebuffer from the X server how frequently to reread the full X11 framebuffer from
and push it out to connected viewers. Use of X should the X server and push it out to connected viewers.
be rare, please report a bug if you find you need it. Use of X should be rare, please report a bug if you
Examples: \fB-fixscreen\fR V=10 \fB-fixscreen\fR C=10 find you need it. 8= applies only for \fB-8to24\fR mode: it
sets how often the non-default visual regions of the
screen (e.g. 8bpp windows) are refreshed. Examples:
\fB-fixscreen\fR V=10 \fB-fixscreen\fR C=10
.PP .PP
\fB-debug_scroll\fR \fB-debug_scroll\fR
.IP .IP

@ -908,6 +908,8 @@ static void print_settings(int try_http, int bg, char *gui_str) {
fprintf(stderr, " shiftcmap: %d\n", shift_cmap); fprintf(stderr, " shiftcmap: %d\n", shift_cmap);
fprintf(stderr, " force_idx: %d\n", force_indexed_color); fprintf(stderr, " force_idx: %d\n", force_indexed_color);
fprintf(stderr, " cmap8to24: %d\n", cmap8to24); fprintf(stderr, " cmap8to24: %d\n", cmap8to24);
fprintf(stderr, " 8to24_opts: %s\n", cmap8to24_str ? cmap8to24_str
: "null");
fprintf(stderr, " visual: %s\n", visual_str ? visual_str fprintf(stderr, " visual: %s\n", visual_str ? visual_str
: "null"); : "null");
fprintf(stderr, " overlay: %d\n", overlay); fprintf(stderr, " overlay: %d\n", overlay);
@ -1277,6 +1279,7 @@ int main(int argc, char* argv[]) {
char *s = argv[i+1]; char *s = argv[i+1];
if (s[0] != '-') { if (s[0] != '-') {
cmap8to24_str = strdup(s); cmap8to24_str = strdup(s);
i++;
} }
} }
} else if (!strcmp(arg, "-visual")) { } else if (!strcmp(arg, "-visual")) {

@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.8 lastmod: 2006-01-21"; char lastmod[] = "0.8 lastmod: 2006-02-04";
/* X display info */ /* X display info */

@ -213,8 +213,8 @@ static void blackout_tiles(void) {
break; break;
} }
} }
sraRgnReleaseIterator(iter); sraRgnReleaseIterator(iter);
sraRgnDestroy(black_reg); sraRgnDestroy(black_reg);
sraRgnDestroy(tile_reg); sraRgnDestroy(tile_reg);
@ -322,6 +322,7 @@ static void initialize_xinerama (void) {
sprintf(tstr, "%dx%d+%d+%d,", w, h, x, y); sprintf(tstr, "%dx%d+%d+%d,", w, h, x, y);
strcat(bstr, tstr); strcat(bstr, tstr);
} }
sraRgnReleaseIterator(iter);
initialize_blackouts(bstr); initialize_blackouts(bstr);
free(bstr); free(bstr);

Loading…
Cancel
Save