Make MAXSCREENS run-time configurable
Submitted by Kevin E. Martin
Assigned to Xorg Project Team
The goals of the patch are as follows: 1) Allow MAXSCREENS to be determined at run time instead of compile time (a new -maxscreens command line flag was added). 2) Make minimal source-code changes to the tree: a) The name "MAXSCREENS" was not changed -- this allowed all of the loops that reference MAXSCREENS to remain unchanged. b) MAXSCREENSALLOC is a convenience macro that allocates and zeros memory, allowing 1-line changes to allocate code (and another line to check that allocation succeeded). Memory is zero'd because many routines assume that the previous static allocations are zero'd. The macro is also safe to call multiple times since there are places in the code where the first use of a MAXSCREENS-sized array is difficult to determine (or non-deterministic). c) In some cases, the existing code zeros the memory. These calls are unchanged, but could be removed.
Some of the changes could not be tested because we do not have the appropriate hardware available -- it would be possible to substitute MAXSCREENSDEFAULT for MAXSCREENS in these code paths (i.e., and leave them as compile-time configurable code paths): config/cf/iPAQH3600.cf config/cf/itsy.cf programs/Xserver/hw/darwin/quartz/fullscreen/fullscreen.c programs/Xserver/hw/kdrive/kxv.c programs/Xserver/hw/sun/sunInit.c programs/Xserver/hw/sunLynx/sunLyInit.c programs/Xserver/hw/xfree86/drivers/* [all the changes are similar] programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c programs/Xserver/hw/xwin/InitOutput.c