XORG_NV/sun-src/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c
changeset 31 6fef7fb81fc7
parent 30 09d07a831488
child 32 235a80428f96
equal deleted inserted replaced
30:09d07a831488 31:6fef7fb81fc7
     1 /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.42 2004/01/27 01:31:44 dawes Exp $ */
       
     2 
       
     3 /*
       
     4  * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
       
     5  *
       
     6  * Permission is hereby granted, free of charge, to any person obtaining a
       
     7  * copy of this software and associated documentation files (the "Software"),
       
     8  * to deal in the Software without restriction, including without limitation
       
     9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
       
    10  * and/or sell copies of the Software, and to permit persons to whom the
       
    11  * Software is furnished to do so, subject to the following conditions:
       
    12  *
       
    13  * The above copyright notice and this permission notice shall be included in
       
    14  * all copies or substantial portions of the Software.
       
    15  *
       
    16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
       
    17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       
    18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
       
    19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
       
    20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
       
    21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
       
    22  * OTHER DEALINGS IN THE SOFTWARE.
       
    23  *
       
    24  * Except as contained in this notice, the name of the copyright holder(s)
       
    25  * and author(s) shall not be used in advertising or otherwise to promote
       
    26  * the sale, use or other dealings in this Software without prior written
       
    27  * authorization from the copyright holder(s) and author(s).
       
    28  */
       
    29 
       
    30 /*
       
    31  * This file contains all the XFree86 global variables.
       
    32  */
       
    33 
       
    34 #ifdef HAVE_XORG_CONFIG_H
       
    35 #include <xorg-config.h>
       
    36 #endif
       
    37 
       
    38 #include <X11/X.h>
       
    39 #include "os.h"
       
    40 #include "windowstr.h"
       
    41 #include "propertyst.h"
       
    42 #include "xf86.h"
       
    43 #include "xf86Priv.h"
       
    44 #include "xf86Parser.h"
       
    45 #include "xf86Xinput.h"
       
    46 #include "xf86InPriv.h"
       
    47 #include "xf86DDC.h"
       
    48 
       
    49 /* Globals that video drivers may access */
       
    50 
       
    51 int xf86ScreenIndex = -1;	/* Index of ScrnInfo in pScreen.devPrivates */
       
    52 int xf86CreateRootWindowIndex = -1;	/* Index into pScreen.devPrivates */
       
    53 ScrnInfoPtr *xf86Screens = NULL;	/* List of ScrnInfos */
       
    54 int xf86PixmapIndex = 0;
       
    55 const unsigned char byte_reversed[256] =
       
    56 {
       
    57     0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
       
    58     0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
       
    59     0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
       
    60     0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
       
    61     0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
       
    62     0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
       
    63     0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
       
    64     0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
       
    65     0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
       
    66     0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
       
    67     0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
       
    68     0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
       
    69     0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
       
    70     0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
       
    71     0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
       
    72     0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
       
    73     0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
       
    74     0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
       
    75     0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
       
    76     0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
       
    77     0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
       
    78     0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
       
    79     0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
       
    80     0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
       
    81     0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
       
    82     0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
       
    83     0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
       
    84     0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
       
    85     0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
       
    86     0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
       
    87     0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
       
    88     0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
       
    89 };
       
    90 
       
    91 /* Globals that input drivers may access */
       
    92 InputInfoPtr xf86InputDevs = NULL;
       
    93 
       
    94 
       
    95 /* Globals that video drivers may not access */
       
    96 
       
    97 xf86InfoRec xf86Info = {
       
    98 	NULL,		/* pKeyboard */
       
    99 	NULL,		/* kbdProc */
       
   100 	NULL,		/* kbdEvents */
       
   101 	-1,		/* consoleFd */
       
   102 	-1,		/* kbdFd */
       
   103 	-1,		/* vtno */
       
   104 	-1,		/* kbdType */
       
   105 	-1,		/* kbdRate */
       
   106 	-1, 		/* kbdDelay */
       
   107 	-1,		/* bell_pitch */
       
   108 	-1,		/* bell_duration */
       
   109 	TRUE,		/* autoRepeat */
       
   110 	0,		/* leds */
       
   111 	0,		/* xleds */
       
   112 	NULL,		/* vtinit */
       
   113 	0,		/* scanPrefix */
       
   114 	FALSE,		/* capsLock */
       
   115 	FALSE,		/* numLock */
       
   116 	FALSE,		/* scrollLock */
       
   117 	FALSE,		/* modeSwitchLock */
       
   118 	FALSE,		/* composeLock */
       
   119 	FALSE,		/* vtSysreq */
       
   120 	SKWhenNeeded,	/* ddxSpecialKeys */
       
   121 	FALSE,		/* ActionKeyBindingsSet */
       
   122 #if defined(SVR4) && defined(i386)
       
   123 	FALSE,		/* panix106 */
       
   124 #endif
       
   125 #if defined(__OpenBSD__) || defined(__NetBSD__)
       
   126 	0,		/* wskbdType */
       
   127 #endif
       
   128 	NULL,		/* pMouse */
       
   129 #ifdef XINPUT
       
   130 	NULL,		/* mouseLocal */
       
   131 #endif
       
   132 	-1,		/* lastEventTime */
       
   133 	FALSE,		/* vtRequestsPending */
       
   134 	FALSE,		/* inputPending */
       
   135 	FALSE,		/* dontVTSwitch */
       
   136 	FALSE,		/* dontZap */
       
   137 	FALSE,		/* dontZoom */
       
   138 	FALSE,		/* notrapSignals */
       
   139 	FALSE,		/* caughtSignal */
       
   140 	FALSE,		/* sharedMonitor */
       
   141 	NULL,		/* currentScreen */
       
   142 #ifdef CSRG_BASED
       
   143 	-1,		/* screenFd */
       
   144 	-1,		/* consType */
       
   145 #endif
       
   146 #ifdef XKB
       
   147 	NULL,		/* xkbkeymap */
       
   148 	NULL,		/* xkbkeycodes */
       
   149 	NULL,		/* xkbtypes */
       
   150 	NULL,		/* xkbcompat */
       
   151 	NULL,		/* xkbsymbols */
       
   152 	NULL,		/* xkbgeometry */
       
   153 	FALSE,		/* xkbcomponents_specified */
       
   154 	NULL,		/* xkbrules */
       
   155 	NULL,		/* xkbmodel */
       
   156 	NULL,		/* xkblayout */
       
   157 	NULL,		/* xkbvariant */
       
   158 	NULL,		/* xkboptions */
       
   159 #endif
       
   160 	FALSE,		/* allowMouseOpenFail */
       
   161 	TRUE,		/* vidModeEnabled */
       
   162 	FALSE,		/* vidModeAllowNonLocal */
       
   163 	TRUE,		/* miscModInDevEnabled */
       
   164 	FALSE,		/* miscModInDevAllowNonLocal */
       
   165 	PCIOsConfig,	/* pciFlags */
       
   166 	Pix24DontCare,	/* pixmap24 */
       
   167 	X_DEFAULT,	/* pix24From */
       
   168 #if defined(i386) || defined(__i386__)
       
   169 	FALSE,		/* pc98 */
       
   170 #endif
       
   171 	TRUE,		/* pmFlag */
       
   172 	LogNone,	/* syncLog */
       
   173 	0,		/* estimateSizesAggressively */
       
   174 	FALSE,		/* kbdCustomKeycodes */
       
   175 	FALSE,		/* disableRandR */
       
   176 	X_DEFAULT	/* randRFrom */
       
   177 };
       
   178 const char *xf86ConfigFile = NULL;
       
   179 const char *xf86InputDeviceList = NULL;
       
   180 const char *xf86ModulePath = DEFAULT_MODULE_PATH;
       
   181 MessageType xf86ModPathFrom = X_DEFAULT;
       
   182 const char *xf86LogFile = DEFAULT_LOGPREFIX;
       
   183 MessageType xf86LogFileFrom = X_DEFAULT;
       
   184 Bool xf86LogFileWasOpened = FALSE;
       
   185 serverLayoutRec xf86ConfigLayout = {NULL, };
       
   186 confDRIRec xf86ConfigDRI = {0, };
       
   187 XF86ConfigPtr xf86configptr = NULL;
       
   188 Bool xf86Resetting = FALSE;
       
   189 Bool xf86Initialising = FALSE;
       
   190 Bool xf86ProbeFailed = FALSE;
       
   191 Bool xf86DoProbe = FALSE;
       
   192 Bool xf86DoConfigure = FALSE;
       
   193 #ifdef XFree86LOADER
       
   194 DriverPtr *xf86DriverList = NULL;
       
   195 int xf86NumDrivers = 0;
       
   196 InputDriverPtr *xf86InputDriverList = NULL;
       
   197 int xf86NumInputDrivers = 0;
       
   198 ModuleInfoPtr *xf86ModuleInfoList = NULL;
       
   199 int xf86NumModuleInfos = 0;
       
   200 xf86MonPtr (*xf86FallbackDDCProbe) (int entityIndex, ScrnInfoPtr scrp) = NULL;
       
   201 #endif
       
   202 int xf86NumScreens = 0;
       
   203 
       
   204 const char *xf86VisualNames[] = {
       
   205 	"StaticGray",
       
   206 	"GrayScale",
       
   207 	"StaticColor",
       
   208 	"PseudoColor",
       
   209 	"TrueColor",
       
   210 	"DirectColor"
       
   211 };
       
   212 
       
   213 /* Parameters set only from the command line */
       
   214 char *xf86ServerName = "no-name";
       
   215 Bool xf86fpFlag = FALSE;
       
   216 Bool xf86coFlag = FALSE;
       
   217 Bool xf86sFlag = FALSE;
       
   218 Bool xf86bsEnableFlag = FALSE;
       
   219 Bool xf86bsDisableFlag = FALSE;
       
   220 Bool xf86silkenMouseDisableFlag = FALSE;
       
   221 Bool xf86acpiDisableFlag = FALSE;
       
   222 char *xf86LayoutName = NULL;
       
   223 char *xf86ScreenName = NULL;
       
   224 char *xf86PointerName = NULL;
       
   225 char *xf86KeyboardName = NULL;
       
   226 Bool xf86ProbeOnly = FALSE;
       
   227 int xf86Verbose = DEFAULT_VERBOSE;
       
   228 int xf86LogVerbose = DEFAULT_LOG_VERBOSE;
       
   229 int xf86FbBpp = -1;
       
   230 Pix24Flags xf86Pix24 = Pix24DontCare;
       
   231 int xf86Depth = -1;
       
   232 rgb xf86Weight = {0, 0, 0};
       
   233 Bool xf86FlipPixels = FALSE;
       
   234 Gamma xf86Gamma = {0.0, 0.0, 0.0};
       
   235 Bool xf86ShowUnresolved = DEFAULT_UNRESOLVED;
       
   236 Bool xf86BestRefresh = DEFAULT_BEST_REFRESH;
       
   237 Bool xf86AllowMouseOpenFail = FALSE;
       
   238 #ifdef XF86VIDMODE
       
   239 Bool xf86VidModeDisabled = FALSE;
       
   240 Bool xf86VidModeAllowNonLocal = FALSE;
       
   241 #endif
       
   242 #ifdef XF86MISC
       
   243 Bool xf86MiscModInDevDisabled = FALSE;
       
   244 Bool xf86MiscModInDevAllowNonLocal = FALSE;
       
   245 #endif
       
   246 RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
       
   247 Bool xf86inSuspend = FALSE;
       
   248 Bool xorgHWAccess = FALSE;
       
   249 PciBusId xf86IsolateDevice;
       
   250 
       
   251 #ifdef DLOPEN_HACK
       
   252 /*
       
   253  * This stuff is a hack to allow dlopen() modules to work.  It is intended
       
   254  * only to be used when using dlopen() modules for debugging purposes.
       
   255  */
       
   256 #endif