1
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.212 2004/01/27 01:31:45 dawes Exp $ */
2
/* $XdotOrg: xserver/xorg/hw/xfree86/common/xf86Init.c,v 1.29 2005/12/14 20:11:16 ajax Exp $ */
5
* Loosely based on code bearing the following copyright:
7
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
10
* Copyright (c) 1992-2003 by The XFree86 Project, Inc.
12
* Permission is hereby granted, free of charge, to any person obtaining a
13
* copy of this software and associated documentation files (the "Software"),
14
* to deal in the Software without restriction, including without limitation
15
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
16
* and/or sell copies of the Software, and to permit persons to whom the
17
* Software is furnished to do so, subject to the following conditions:
19
* The above copyright notice and this permission notice shall be included in
20
* all copies or substantial portions of the Software.
22
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
26
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28
* OTHER DEALINGS IN THE SOFTWARE.
30
* Except as contained in this notice, the name of the copyright holder(s)
31
* and author(s) shall not be used in advertising or otherwise to promote
32
* the sale, use or other dealings in this Software without prior written
33
* authorization from the copyright holder(s) and author(s).
36
#ifdef HAVE_XORG_CONFIG_H
37
#include <xorg-config.h>
43
#if !defined(WIN32) && !defined(__UNIXOS2__)
45
#include <sys/utsname.h>
54
#include <X11/Xproto.h>
55
#include <X11/Xatom.h>
58
#include "windowstr.h"
59
#include "scrnintstr.h"
66
#include "loaderProcs.h"
75
#include "xf86Config.h"
76
#include "xf86_OSlib.h"
77
#include "xorgVersion.h"
79
#include "xf86Build.h"
80
#include "mipointer.h"
82
#include <X11/extensions/XI.h>
83
#include <X11/extensions/XIproto.h>
88
#include "xf86Xinput.h"
89
#include "xf86InPriv.h"
91
#include "picturestr.h"
97
#include "atKeynames.h"
98
extern int xtest_command_key;
99
#endif /* XTESTEXT1 */
103
#include <X11/extensions/dpms.h>
104
#include "dpmsproc.h"
108
/* forward declarations */
110
static void xf86PrintBanner(void);
111
static void xf86PrintMarkers(void);
112
static void xf86RunVtInit(void);
115
extern void os2ServerVideoAccess();
119
void (*xf86OSPMClose)(void) = NULL;
123
static char *baseModules[] = {
130
/* Common pixmap formats */
132
static PixmapFormatRec formats[MAXFORMATS] = {
133
{ 1, 1, BITMAP_SCANLINE_PAD },
134
{ 4, 8, BITMAP_SCANLINE_PAD },
135
{ 8, 8, BITMAP_SCANLINE_PAD },
136
{ 15, 16, BITMAP_SCANLINE_PAD },
137
{ 16, 16, BITMAP_SCANLINE_PAD },
138
{ 24, 32, BITMAP_SCANLINE_PAD },
140
{ 32, 32, BITMAP_SCANLINE_PAD },
144
static int numFormats = 7;
146
static int numFormats = 6;
148
static Bool formatsDone = FALSE;
150
InputDriverRec XF86KEYBOARD = {
161
xf86CreateRootWindow(WindowPtr pWin)
165
ScreenPtr pScreen = pWin->drawable.pScreen;
166
RootWinPropPtr pProp;
167
CreateWindowProcPtr CreateWindow =
168
(CreateWindowProcPtr)(pScreen->devPrivates[xf86CreateRootWindowIndex].ptr);
171
ErrorF("xf86CreateRootWindow(%p)\n", pWin);
174
if ( pScreen->CreateWindow != xf86CreateRootWindow ) {
175
/* Can't find hook we are hung on */
176
xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */,
177
"xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
178
(void *)xf86CreateRootWindow,
179
(void *)pScreen->CreateWindow );
182
/* Unhook this function ... */
183
pScreen->CreateWindow = CreateWindow;
184
pScreen->devPrivates[xf86CreateRootWindowIndex].ptr = NULL;
186
/* ... and call the previous CreateWindow fuction, if any */
187
if (NULL!=pScreen->CreateWindow) {
188
ret = (*pScreen->CreateWindow)(pWin);
191
/* Now do our stuff */
192
if (xf86RegisteredPropertiesTable != NULL) {
193
if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) {
194
for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum];
195
pProp != NULL && err==Success;
196
pProp = pProp->next )
200
prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
201
err = ChangeWindowProperty(pWin,
203
pProp->format, PropModeReplace,
204
pProp->size, pProp->data,
210
ret &= (err==Success);
213
xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
214
"non-root window %p (parent %p)\n",
215
(void *)pWin, (void *)pWin->parent);
221
ErrorF("xf86CreateRootWindow() returns %d\n", ret);
229
* Initialize screenInfo for all actually accessible framebuffers.
230
* That includes vt-manager setup, querying all possible devices and
231
* collecting the pixmap formats.
238
* Install signal handler for unexpected signals
240
xf86Info.caughtSignal=FALSE;
241
if (!xf86Info.notrapSignals) {
242
signal(SIGSEGV,xf86SigHandler);
243
signal(SIGILL,xf86SigHandler);
245
signal(SIGEMT,xf86SigHandler);
247
signal(SIGFPE,xf86SigHandler);
249
signal(SIGBUS,xf86SigHandler);
252
signal(SIGSYS,xf86SigHandler);
255
signal(SIGXCPU,xf86SigHandler);
258
signal(SIGXFSZ,xf86SigHandler);
261
signal(SIGUSR2,xf86SigMemDebug);
266
xf86OSPMClose = xf86OSPMOpen();
269
/* Run an external VT Init program if specified in the config file */
272
/* Do this after XF86Config is read (it's normally in OsInit()) */
277
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
279
int i, j, k, scr_index;
280
static unsigned long generation = 0;
285
screenLayoutPtr layout;
286
Pix24Flags screenpix24, pix24;
287
MessageType pix24From = X_DEFAULT;
288
Bool pix24Fail = FALSE;
289
Bool autoconfig = FALSE;
292
os2ServerVideoAccess(); /* See if we have access to the screen before doing anything */
295
xf86Initialising = TRUE;
298
if (generation != serverGeneration) {
299
xf86ScreenIndex = AllocateScreenPrivateIndex();
300
xf86CreateRootWindowIndex = AllocateScreenPrivateIndex();
301
xf86PixmapIndex = AllocatePixmapPrivateIndex();
302
generation = serverGeneration;
305
if (serverGeneration == 1) {
307
pScreenInfo->numScreens = 0;
309
if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
312
xf86ServerName = argv[0];
321
xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
325
/* Read and parse the config file */
326
if (!xf86DoProbe && !xf86DoConfigure) {
327
switch (xf86HandleConfigFile(FALSE)) {
330
case CONFIG_PARSE_ERROR:
331
xf86Msg(X_ERROR, "Error parsing the config file\n");
343
/* Initialise the loader */
346
/* Tell the loader the default module search path */
347
LoaderSetPath(xf86ModulePath);
352
const char *subdirs[] = {
356
const char *patlist[] = {
361
ErrorF("Getting module listing...\n");
362
list = LoaderListDirs(NULL, NULL);
364
for (l = list; *l; l++)
365
ErrorF("module: %s\n", *l);
366
LoaderFreeDirList(list);
367
ErrorF("Getting video driver listing...\n");
368
list = LoaderListDirs(subdirs, NULL);
370
for (l = list; *l; l++)
371
ErrorF("video driver: %s\n", *l);
372
LoaderFreeDirList(list);
373
ErrorF("Getting driver listing...\n");
374
list = LoaderListDirs(NULL, patlist);
376
for (l = list; *l; l++)
377
ErrorF("video driver: %s\n", *l);
378
LoaderFreeDirList(list);
382
/* Force load mandatory base modules */
383
if (!xf86LoadModules(baseModules, NULL))
384
FatalError("Unable to load required base modules, Exiting...\n");
390
/* Do a general bus probe. This will be a PCI probe for x86 platforms */
400
if (!xf86AutoConfig()) {
401
xf86Msg(X_ERROR, "Auto configuration failed\n");
407
/* Initialise the resource broker */
408
xf86ResourceBrokerInit();
411
/* Load all modules specified explicitly in the config file */
412
if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
413
xf86LoadModules(modulelist, optionlist);
418
/* Load all driver modules specified in the config file */
419
if ((modulelist = xf86DriverlistFromConfig())) {
420
xf86LoadModules(modulelist, NULL);
424
#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
425
/* Setup the builtin input drivers */
426
xf86AddInputDriver(&XF86KEYBOARD, NULL, 0);
428
/* Load all input driver modules specified in the config file. */
429
if ((modulelist = xf86InputDriverlistFromConfig())) {
430
xf86LoadModules(modulelist, NULL);
435
* It is expected that xf86AddDriver()/xf86AddInputDriver will be
436
* called for each driver as it is loaded. Those functions save the
437
* module pointers for drivers.
438
* XXX Nothing keeps track of them for other modules.
440
/* XXX What do we do if not all of these could be loaded? */
444
* At this point, xf86DriverList[] is all filled in with entries for
445
* each of the drivers to try and xf86NumDrivers has the number of
446
* drivers. If there are none, return now.
449
if (xf86NumDrivers == 0) {
450
xf86Msg(X_ERROR, "No drivers available.\n");
455
* Call each of the Identify functions and call the driverFunc to check
456
* if HW access is required. The Identify functions print out some
457
* identifying information, and anything else that might be
458
* needed at this early stage.
461
for (i = 0; i < xf86NumDrivers; i++) {
463
/* The Identify function is mandatory, but if it isn't there continue */
464
if (xf86DriverList[i]->Identify != NULL)
465
xf86DriverList[i]->Identify(0);
467
xf86Msg(X_WARNING, "Driver `%s' has no Identify function\n",
468
xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName
472
&& (!xf86DriverList[i]->driverFunc
473
|| !xf86DriverList[i]->driverFunc(NULL,
474
GET_REQUIRED_HW_INTERFACES,
476
|| NEED_IO_ENABLED(flags)))
480
/* Enable full I/O access */
483
/* oops, we have failed */
484
xorgHWAccess = FALSE;
488
* Locate bus slot that had register IO enabled at server startup
492
xf86FindPrimaryDevice();
495
* Now call each of the Probe functions. Each successful probe will
496
* result in an extra entry added to the xf86Screens[] list for each
497
* instance of the hardware found.
500
for (i = 0; i < xf86NumDrivers; i++) {
503
if (!xf86DriverList[i]->driverFunc
504
|| !xf86DriverList[i]->driverFunc(NULL,
505
GET_REQUIRED_HW_INTERFACES,
507
|| NEED_IO_ENABLED(flags))
511
if (xf86DriverList[i]->Probe != NULL)
512
xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DEFAULT);
514
xf86MsgVerb(X_WARNING, 0,
515
"Driver `%s' has no Probe function (ignoring)\n",
516
xf86DriverList[i]->driverName
517
? xf86DriverList[i]->driverName : "noname");
519
xf86SetPciVideo(NULL,NONE);
523
* If nothing was detected, return now.
526
if (xf86NumScreens == 0) {
527
xf86Msg(X_ERROR, "No devices detected.\n");
532
* Match up the screens found by the probes against those specified
533
* in the config file. Remove the ones that won't be used. Sort
534
* them in the order specified.
538
* What is the best way to do this?
540
* For now, go through the screens allocated by the probes, and
541
* look for screen config entry which refers to the same device
542
* section as picked out by the probe.
546
for (i = 0; i < xf86NumScreens; i++) {
547
for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
550
for (j = 0; j < xf86Screens[i]->numEntities; j++) {
553
xf86GetDevFromEntity(xf86Screens[i]->entityList[j],
554
xf86Screens[i]->entityInstanceList[j]);
556
if (dev == layout->screen->device) {
557
/* A match has been found */
558
xf86Screens[i]->confScreen = layout->screen;
565
if (layout->screen == NULL) {
568
"Screen %d deleted because of no matching config section.\n", i);
569
xf86DeleteScreen(i--, 0);
574
* If no screens left, return now.
577
if (xf86NumScreens == 0) {
579
"Device(s) detected, but none match those in the config file.\n");
587
* Sort the drivers to match the requested ording. Using a slow
590
for (j = 0; j < xf86NumScreens - 1; j++) {
591
for (i = 0; i < xf86NumScreens - j - 1; i++) {
592
if (xf86Screens[i + 1]->confScreen->screennum <
593
xf86Screens[i]->confScreen->screennum) {
594
ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
595
xf86Screens[i + 1] = xf86Screens[i];
596
xf86Screens[i] = tmpScrn;
600
/* Fix up the indexes */
601
for (i = 0; i < xf86NumScreens; i++) {
602
xf86Screens[i]->scrnIndex = i;
606
* Call the driver's PreInit()'s to complete initialisation for the first
610
for (i = 0; i < xf86NumScreens; i++) {
611
xf86EnableAccess(xf86Screens[i]);
612
if (xf86Screens[i]->PreInit &&
613
xf86Screens[i]->PreInit(xf86Screens[i], 0))
614
xf86Screens[i]->configured = TRUE;
616
for (i = 0; i < xf86NumScreens; i++)
617
if (!xf86Screens[i]->configured)
618
xf86DeleteScreen(i--, 0);
621
* If no screens left, return now.
624
if (xf86NumScreens == 0) {
626
"Screen(s) found, but none have a usable configuration.\n");
630
/* This could be moved into a separate function */
633
* Check that all screens have initialised the mandatory function
634
* entry points. Delete those which have not.
637
#define WARN_SCREEN(func) \
638
xf86Msg(X_ERROR, "Driver `%s' has no %s function, deleting.\n", \
639
xf86Screens[i]->name, (warned++, func))
641
for (i = 0; i < xf86NumScreens; i++) {
643
if (xf86Screens[i]->name == NULL) {
644
xf86Screens[i]->name = xnfalloc(strlen("screen") + 1 + 1);
646
sprintf(xf86Screens[i]->name, "screen%c", i + '0');
648
sprintf(xf86Screens[i]->name, "screen%c", i - 10 + 'A');
649
xf86MsgVerb(X_WARNING, 0,
650
"Screen driver %d has no name set, using `%s'.\n",
651
i, xf86Screens[i]->name);
653
if (xf86Screens[i]->ScreenInit == NULL)
654
WARN_SCREEN("ScreenInit");
655
if (xf86Screens[i]->EnterVT == NULL)
656
WARN_SCREEN("EnterVT");
657
if (xf86Screens[i]->LeaveVT == NULL)
658
WARN_SCREEN("LeaveVT");
660
xf86DeleteScreen(i--, 0);
664
* If no screens left, return now.
667
if (xf86NumScreens == 0) {
668
xf86Msg(X_ERROR, "Screen(s) found, but drivers were unusable.\n");
672
/* XXX Should this be before or after loading dependent modules? */
682
/* Remove (unload) drivers that are not required */
683
for (i = 0; i < xf86NumDrivers; i++)
684
if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
689
* At this stage we know how many screens there are.
692
for (i = 0; i < xf86NumScreens; i++)
693
xf86InitViewport(xf86Screens[i]);
696
* Collect all pixmap formats and check for conflicts at the display
697
* level. Should we die here? Or just delete the offending screens?
698
* Also, should this be done for -probeonly?
700
screenpix24 = Pix24DontCare;
701
for (i = 0; i < xf86NumScreens; i++) {
702
if (xf86Screens[i]->imageByteOrder !=
703
xf86Screens[0]->imageByteOrder)
704
FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
705
if (xf86Screens[i]->bitmapScanlinePad !=
706
xf86Screens[0]->bitmapScanlinePad)
707
FatalError("Inconsistent display bitmapScanlinePad. Exiting\n");
708
if (xf86Screens[i]->bitmapScanlineUnit !=
709
xf86Screens[0]->bitmapScanlineUnit)
710
FatalError("Inconsistent display bitmapScanlineUnit. Exiting\n");
711
if (xf86Screens[i]->bitmapBitOrder !=
712
xf86Screens[0]->bitmapBitOrder)
713
FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
715
/* Determine the depth 24 pixmap format the screens would like */
716
if (xf86Screens[i]->pixmap24 != Pix24DontCare) {
717
if (screenpix24 == Pix24DontCare)
718
screenpix24 = xf86Screens[i]->pixmap24;
719
else if (screenpix24 != xf86Screens[i]->pixmap24)
720
FatalError("Inconsistent depth 24 pixmap format. Exiting\n");
723
/* check if screenpix24 is consistent with the config/cmdline */
724
if (xf86Info.pixmap24 != Pix24DontCare) {
725
pix24 = xf86Info.pixmap24;
726
pix24From = xf86Info.pix24From;
727
if (screenpix24 != Pix24DontCare && screenpix24 != xf86Info.pixmap24)
729
} else if (screenpix24 != Pix24DontCare) {
731
pix24From = X_PROBED;
736
FatalError("Screen(s) can't use the required depth 24 pixmap format"
737
" (%d). Exiting\n", PIX24TOBPP(pix24));
739
/* Initialise the depth 24 format */
740
for (j = 0; j < numFormats && formats[j].depth != 24; j++)
742
formats[j].bitsPerPixel = PIX24TOBPP(pix24);
744
/* Collect additional formats */
745
for (i = 0; i < xf86NumScreens; i++) {
746
for (j = 0; j < xf86Screens[i]->numFormats; j++) {
748
if (k >= numFormats) {
750
FatalError("Too many pixmap formats! Exiting\n");
751
formats[k] = xf86Screens[i]->formats[j];
755
if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
756
if ((formats[k].bitsPerPixel ==
757
xf86Screens[i]->formats[j].bitsPerPixel) &&
758
(formats[k].scanlinePad ==
759
xf86Screens[i]->formats[j].scanlinePad))
761
FatalError("Inconsistent pixmap format for depth %d."
762
" Exiting\n", formats[k].depth);
769
if (xf86Info.vtno >= 0 ) {
770
#define VT_ATOM_NAME "XFree86_VT"
775
/* This memory needs to stay available until the screen has been
776
initialized, and we can create the property for real.
778
if ( (VT = xalloc(sizeof(CARD32)))==NULL ) {
779
FatalError("Unable to make VT property - out of memory. Exiting...\n");
783
VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME), TRUE);
785
for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) {
786
ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
787
VTAtom, XA_INTEGER, 32,
790
xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
791
"Failed to register VT property\n");
795
/* If a screen uses depth 24, show what the pixmap format is */
796
for (i = 0; i < xf86NumScreens; i++) {
797
if (xf86Screens[i]->depth == 24) {
798
xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n",
804
#if BITMAP_SCANLINE_UNIT == 64
806
* cfb24 doesn't currently work on architectures with a 64 bit
807
* BITMAP_SCANLINE_UNIT, so check for 24 bit pixel size for pixmaps
811
Bool usesCfb24 = FALSE;
813
if (PIX24TOBPP(pix24) == 24)
815
for (i = 0; i < xf86NumScreens; i++)
816
if (xf86Screens[i]->bitsPerPixel == 24)
819
FatalError("24-bit pixel size is not supported on systems with"
820
" 64-bit scanlines.\n");
828
/* set up the proper access funcs */
831
AddCallback(&ServerGrabCallback, xf86GrabServerCallback, NULL);
835
* serverGeneration != 1; some OSs have to do things here, too.
841
should we reopen it here? We need to deal with an already opened
842
device. We could leave this to the OS layer. For now we simply
847
if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
848
xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
851
/* Make sure full I/O access is enabled */
858
* Install signal handler for unexpected signals
860
xf86Info.caughtSignal=FALSE;
861
if (!xf86Info.notrapSignals)
863
signal(SIGSEGV,xf86SigHandler);
864
signal(SIGILL,xf86SigHandler);
866
signal(SIGEMT,xf86SigHandler);
868
signal(SIGFPE,xf86SigHandler);
870
signal(SIGBUS,xf86SigHandler);
873
signal(SIGSYS,xf86SigHandler);
876
signal(SIGXCPU,xf86SigHandler);
879
signal(SIGXFSZ,xf86SigHandler);
885
* Use the previously collected parts to setup pScreenInfo
888
pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
889
pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
890
pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
891
pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
892
pScreenInfo->numPixmapFormats = numFormats;
893
for (i = 0; i < numFormats; i++)
894
pScreenInfo->formats[i] = formats[i];
896
/* Make sure the server's VT is active */
898
if (serverGeneration != 1) {
899
xf86Resetting = TRUE;
900
/* All screens are in the same state, so just check the first */
901
if (!xf86Screens[0]->vtSema) {
903
ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
906
xf86EnterServerState(SETUP);
912
* Under SCO we must ack that we got the console at startup,
913
* I think this is the safest way to assure it.
918
if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
919
xf86Msg(X_WARNING, "VT_ACKACQ failed");
924
for (i = 0; i < xf86NumScreens; i++) {
925
xf86EnableAccess(xf86Screens[i]);
927
* Almost everything uses these defaults, and many of those that
928
* don't, will wrap them.
930
xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
931
xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
932
xf86Screens[i]->DPMSSet = NULL;
933
xf86Screens[i]->LoadPalette = NULL;
934
xf86Screens[i]->SetOverscan = NULL;
935
xf86Screens[i]->DriverFunc = NULL;
936
xf86Screens[i]->pScreen = NULL;
937
scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
938
if (scr_index == i) {
940
* Hook in our ScrnInfoRec, and initialise some other pScreen
943
screenInfo.screens[scr_index]->devPrivates[xf86ScreenIndex].ptr
944
= (pointer)xf86Screens[i];
945
xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
946
/* The driver should set this, but make sure it is set anyway */
947
xf86Screens[i]->vtSema = TRUE;
949
/* This shouldn't normally happen */
950
FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
954
ErrorF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
955
i, xf86Screens[i]->pScreen );
956
ErrorF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
957
i, xf86Screens[i]->pScreen->CreateWindow );
960
screenInfo.screens[scr_index]->devPrivates[xf86CreateRootWindowIndex].ptr
961
= (void*)(xf86Screens[i]->pScreen->CreateWindow);
962
xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
965
if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown)
967
xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC);
968
PictureSetSubpixelOrder (xf86Screens[i]->pScreen,
970
(DDC->features.input_type ?
971
SubPixelHorizontalRGB : SubPixelNone) :
976
if (!xf86Info.disableRandR)
977
xf86RandRInit (screenInfo.screens[scr_index]);
978
xf86Msg(xf86Info.randRFrom, "RandR %s\n",
979
xf86Info.disableRandR ? "disabled" : "enabled");
983
* Here we have to let the driver getting access of the VT. Note that
984
* this doesn't mean that the graphics board may access automatically
985
* the monitor. If the monitor is shared this is done in xf86CrossScreen!
987
if (!xf86Info.sharedMonitor) (xf86Screens[i]->EnterLeaveMonitor)(ENTER);
992
if ((serverGeneration == 1) && LoaderCheckUnresolved(LD_RESOLV_IFDONE)) {
993
/* For now, just a warning */
994
xf86Msg(X_WARNING, "Some symbols could not be resolved!\n");
998
xf86PostScreenInit();
1002
xf86Resetting = FALSE;
1003
xf86Initialising = FALSE;
1005
RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup,
1010
static InputDriverPtr
1011
MatchInput(IDevPtr pDev)
1015
for (i = 0; i < xf86NumInputDrivers; i++) {
1016
if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
1017
xf86NameCmp(pDev->driver, xf86InputDriverList[i]->driverName) == 0)
1018
return xf86InputDriverList[i];
1026
* Initialize all supported input devices.
1030
InitInput(argc, argv)
1035
InputDriverPtr pDrv;
1037
static InputInfoPtr coreKeyboard = NULL, corePointer = NULL;
1039
xf86Info.vtRequestsPending = FALSE;
1040
xf86Info.inputPending = FALSE;
1042
xtest_command_key = KEY_Begin + MIN_KEYCODE;
1043
#endif /* XTESTEXT1 */
1045
if (serverGeneration == 1) {
1046
/* Call the PreInit function for each input device instance. */
1047
for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
1048
#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
1049
/* XXX The keyboard driver is a special case for now. */
1050
if (!xf86NameCmp(pDev->driver, "keyboard")) {
1051
xf86MsgVerb(X_WARNING, 0, "*** WARNING the legacy keyboard driver \"keyboard\" is deprecated\n");
1052
xf86MsgVerb(X_WARNING, 0, "*** and will be removed in the next release of the Xorg server.\n");
1053
xf86MsgVerb(X_WARNING, 0, "*** Please consider using the the new \"kbd\" driver for \"%s\".\n",
1060
if ((pDrv = MatchInput(pDev)) == NULL) {
1061
xf86Msg(X_ERROR, "No Input driver matching `%s'\n", pDev->driver);
1062
/* XXX For now, just continue. */
1065
if (!pDrv->PreInit) {
1066
xf86MsgVerb(X_WARNING, 0,
1067
"Input driver `%s' has no PreInit function (ignoring)\n",
1071
pInfo = pDrv->PreInit(pDrv, pDev, 0);
1073
xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n",
1076
} else if (!(pInfo->flags & XI86_CONFIGURED)) {
1077
xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
1079
xf86DeleteInput(pInfo, 0);
1082
if (pInfo->flags & XI86_CORE_KEYBOARD) {
1085
"Attempt to register more than one core keyboard (%s)\n",
1087
pInfo->flags &= ~XI86_CORE_KEYBOARD;
1089
if (!(pInfo->flags & XI86_KEYBOARD_CAPABLE)) {
1090
/* XXX just a warning for now */
1092
"%s: does not have core keyboard capabilities\n",
1095
coreKeyboard = pInfo;
1098
if (pInfo->flags & XI86_CORE_POINTER) {
1101
"Attempt to register more than one core pointer (%s)\n",
1103
pInfo->flags &= ~XI86_CORE_POINTER;
1105
if (!(pInfo->flags & XI86_POINTER_CAPABLE)) {
1106
/* XXX just a warning for now */
1108
"%s: does not have core pointer capabilities\n",
1111
corePointer = pInfo;
1116
xf86Msg(X_WARNING, "No core pointer registered\n");
1117
/* XXX register a dummy core pointer */
1120
if (!coreKeyboard) {
1121
xf86Msg(X_WARNING, "No core keyboard registered\n");
1122
/* XXX register a dummy core keyboard */
1127
/* Initialise all input devices. */
1128
pInfo = xf86InputDevs;
1130
xf86ActivateDevice(pInfo);
1131
pInfo = pInfo->next;
1135
xf86Info.pKeyboard = coreKeyboard->dev;
1136
xf86Info.kbdEvents = NULL; /* to prevent the internal keybord driver usage*/
1139
#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
1140
/* Only set this if we're allowing the old driver. */
1141
if (xf86Info.kbdProc != NULL)
1142
xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE);
1146
xf86Info.pMouse = corePointer->dev;
1147
if (xf86Info.pKeyboard)
1148
RegisterKeyboardDevice(xf86Info.pKeyboard);
1150
miRegisterPointerDevice(screenInfo.screens[0], xf86Info.pMouse);
1152
xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
1154
mieqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
1158
#ifndef SET_STDERR_NONBLOCKING
1159
#define SET_STDERR_NONBLOCKING 1
1164
* OS/Vendor-specific initialisations. Called from OsInit(), which
1165
* is called by dix before establishing the well known sockets.
1171
static Bool beenHere = FALSE;
1173
/* xf86WrapperInit() is called directly from OsInit() */
1175
signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
1177
OsDelayInitColors = TRUE;
1178
#ifdef XFree86LOADER
1179
loadableFonts = TRUE;
1185
#if SET_STDERR_NONBLOCKING
1186
/* Set stderr to non-blocking. */
1188
#if defined(FNDELAY)
1189
#define O_NONBLOCK FNDELAY
1190
#elif defined(O_NDELAY)
1191
#define O_NONBLOCK O_NDELAY
1197
#if !defined(__EMX__)
1198
if (geteuid() == 0 && getuid() != geteuid())
1203
status = fcntl(fileno(stderr), F_GETFL, 0);
1205
fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
1217
* Device dependent cleanup. Called by by dix before normal server death.
1218
* For SYSV386 we must switch the terminal back to normal mode. No error-
1219
* checking here, since there should be restored as much as possible.
1230
xf86OSPMClose = NULL;
1233
xf86AccessLeaveState();
1235
for (i = 0; i < xf86NumScreens; i++) {
1237
* zero all access functions to
1238
* trap calls when switched away.
1240
xf86Screens[i]->vtSema = FALSE;
1241
xf86Screens[i]->access = NULL;
1242
xf86Screens[i]->busAccess = NULL;
1245
#ifdef USE_XF86_SERVERLOCK
1256
/* If an unexpected signal was caught, dump a core for debugging */
1257
if (xf86Info.caughtSignal)
1265
* DDX - specific abort routine. Called by AbortServer(). The attempt is
1266
* made to restore all original setting of the displays. Also all devices
1276
* try to deinitialize all input devices
1278
if (xf86Info.kbdProc && xf86Info.pKeyboard)
1279
(xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE);
1282
* try to restore the original video state
1285
/* Need the sleep when starting X from within another X session */
1288
#ifdef DPMSExtension /* Turn screens back on */
1289
if (DPMSPowerLevel != DPMSModeOn)
1290
DPMSSet(DPMSModeOn);
1293
if (xf86Screens[0]->vtSema)
1294
xf86EnterServerState(SETUP);
1295
for (i = 0; i < xf86NumScreens; i++)
1296
if (xf86Screens[i]->vtSema) {
1298
* if we are aborting before ScreenInit() has finished
1299
* we might not have been wrapped yet. Therefore enable
1300
* screen explicitely.
1302
xf86EnableAccess(xf86Screens[i]);
1303
(xf86Screens[i]->LeaveVT)(i, 0);
1310
* This is needed for an abnormal server exit, since the normal exit stuff
1311
* MUST also be performed (i.e. the vt must be left in a defined state)
1317
OsVendorFatalError()
1319
#ifdef VENDORSUPPORT
1320
ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
1321
"at %s for support on this crash.\n",VENDORSUPPORT);
1323
ErrorF("\nPlease consult the "XVENDORNAME" support \n"
1324
"\t at "__VENDORDWEBSUPPORT__"\n for help. \n");
1326
if (xf86LogFile && xf86LogFileWasOpened)
1327
ErrorF("Please also check the log file at \"%s\" for additional "
1328
"information.\n", xf86LogFile);
1333
xf86SetVerbosity(int verb)
1335
int save = xf86Verbose;
1338
LogSetParameter(XLOG_VERBOSITY, verb);
1343
xf86SetLogVerbosity(int verb)
1345
int save = xf86LogVerbose;
1347
xf86LogVerbose = verb;
1348
LogSetParameter(XLOG_FILE_VERBOSITY, verb);
1353
* ddxProcessArgument --
1354
* Process device-dependent command line args. Returns 0 if argument is
1355
* not device dependent, otherwise Count of number of elements of argv
1356
* that are part of a device dependent commandline option.
1364
ddxProcessArgument(int argc, char **argv, int i)
1367
* Note: can't use xalloc/xfree here because OsInit() hasn't been called
1368
* yet. Use malloc/free instead.
1371
#define CHECK_FOR_REQUIRED_ARGUMENT() \
1372
if (((i + 1) >= argc) || (!argv[i + 1])) { \
1373
ErrorF("Required argument to %s not specified\n", argv[i]); \
1375
FatalError("Required argument to %s not specified\n", argv[i]); \
1378
/* First the options that are only allowed for root */
1379
if (getuid() == 0 || geteuid != 0)
1381
if (!strcmp(argv[i], "-modulepath"))
1384
CHECK_FOR_REQUIRED_ARGUMENT();
1385
mp = malloc(strlen(argv[i + 1]) + 1);
1387
FatalError("Can't allocate memory for ModulePath\n");
1388
strcpy(mp, argv[i + 1]);
1389
xf86ModulePath = mp;
1390
xf86ModPathFrom = X_CMDLINE;
1393
else if (!strcmp(argv[i], "-logfile"))
1396
CHECK_FOR_REQUIRED_ARGUMENT();
1397
lf = malloc(strlen(argv[i + 1]) + 1);
1399
FatalError("Can't allocate memory for LogFile\n");
1400
strcpy(lf, argv[i + 1]);
1402
xf86LogFileFrom = X_CMDLINE;
1405
} else if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
1406
FatalError("The '%s' option can only be used by root.\n", argv[i]);
1408
if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config"))
1410
CHECK_FOR_REQUIRED_ARGUMENT();
1411
if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) {
1412
FatalError("\nInvalid argument for %s\n"
1413
"\tFor non-root users, the file specified with %s must be\n"
1414
"\ta relative path and must not contain any \"..\" elements.\n"
1415
"\tUsing default "__XCONFIGFILE__" search path.\n\n",
1418
xf86ConfigFile = argv[i + 1];
1421
if (!strcmp(argv[i],"-showunresolved"))
1423
xf86ShowUnresolved = TRUE;
1426
if (!strcmp(argv[i],"-probeonly"))
1428
xf86ProbeOnly = TRUE;
1431
if (!strcmp(argv[i],"-flipPixels"))
1433
xf86FlipPixels = TRUE;
1437
if (!strcmp(argv[i],"-disableVidMode"))
1439
xf86VidModeDisabled = TRUE;
1442
if (!strcmp(argv[i],"-allowNonLocalXvidtune"))
1444
xf86VidModeAllowNonLocal = TRUE;
1449
if (!strcmp(argv[i],"-disableModInDev"))
1451
xf86MiscModInDevDisabled = TRUE;
1454
if (!strcmp(argv[i],"-allowNonLocalModInDev"))
1456
xf86MiscModInDevAllowNonLocal = TRUE;
1460
if (!strcmp(argv[i],"-allowMouseOpenFail"))
1462
xf86AllowMouseOpenFail = TRUE;
1465
if (!strcmp(argv[i],"-bestRefresh"))
1467
xf86BestRefresh = TRUE;
1470
if (!strcmp(argv[i],"-ignoreABI"))
1472
#ifdef XFree86LOADER
1473
LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
1477
if (!strcmp(argv[i],"-verbose"))
1479
if (++i < argc && argv[i])
1483
val = strtol(argv[i], &end, 0);
1486
xf86SetVerbosity(val);
1490
xf86SetVerbosity(++xf86Verbose);
1493
if (!strcmp(argv[i],"-logverbose"))
1495
if (++i < argc && argv[i])
1499
val = strtol(argv[i], &end, 0);
1502
xf86SetLogVerbosity(val);
1506
xf86SetLogVerbosity(++xf86LogVerbose);
1509
if (!strcmp(argv[i],"-quiet"))
1511
xf86SetVerbosity(0);
1514
if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version"))
1519
/* Notice the -fp flag, but allow it to pass to the dix layer */
1520
if (!strcmp(argv[i], "-fp"))
1525
/* Notice the -co flag, but allow it to pass to the dix layer */
1526
if (!strcmp(argv[i], "-co"))
1531
/* Notice the -bs flag, but allow it to pass to the dix layer */
1532
if (!strcmp(argv[i], "-bs"))
1534
xf86bsDisableFlag = TRUE;
1537
/* Notice the +bs flag, but allow it to pass to the dix layer */
1538
if (!strcmp(argv[i], "+bs"))
1540
xf86bsEnableFlag = TRUE;
1543
/* Notice the -s flag, but allow it to pass to the dix layer */
1544
if (!strcmp(argv[i], "-s"))
1549
if (!strcmp(argv[i], "-bpp"))
1551
ErrorF("The -bpp option is no longer supported.\n"
1552
"\tUse -depth to set the color depth, and use -fbbpp if you really\n"
1553
"\tneed to force a non-default framebuffer (hardware) pixel format.\n");
1558
if (!strcmp(argv[i], "-pixmap24"))
1560
xf86Pix24 = Pix24Use24;
1563
if (!strcmp(argv[i], "-pixmap32"))
1565
xf86Pix24 = Pix24Use32;
1568
if (!strcmp(argv[i], "-fbbpp"))
1571
CHECK_FOR_REQUIRED_ARGUMENT();
1572
if (sscanf(argv[++i], "%d", &bpp) == 1)
1579
ErrorF("Invalid fbbpp\n");
1583
if (!strcmp(argv[i], "-depth"))
1586
CHECK_FOR_REQUIRED_ARGUMENT();
1587
if (sscanf(argv[++i], "%d", &depth) == 1)
1594
ErrorF("Invalid depth\n");
1598
if (!strcmp(argv[i], "-weight"))
1600
int red, green, blue;
1601
CHECK_FOR_REQUIRED_ARGUMENT();
1602
if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3)
1604
xf86Weight.red = red;
1605
xf86Weight.green = green;
1606
xf86Weight.blue = blue;
1611
ErrorF("Invalid weighting\n");
1615
if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
1616
!strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma"))
1619
CHECK_FOR_REQUIRED_ARGUMENT();
1620
if (sscanf(argv[++i], "%lf", &gamma) == 1) {
1621
if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
1622
ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
1623
" is valid\n", GAMMA_MIN, GAMMA_MAX);
1626
if (!strcmp(argv[i-1], "-gamma"))
1627
xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
1628
else if (!strcmp(argv[i-1], "-rgamma")) xf86Gamma.red = gamma;
1629
else if (!strcmp(argv[i-1], "-ggamma")) xf86Gamma.green = gamma;
1630
else if (!strcmp(argv[i-1], "-bgamma")) xf86Gamma.blue = gamma;
1634
if (!strcmp(argv[i], "-layout"))
1636
CHECK_FOR_REQUIRED_ARGUMENT();
1637
xf86LayoutName = argv[++i];
1640
if (!strcmp(argv[i], "-screen"))
1642
CHECK_FOR_REQUIRED_ARGUMENT();
1643
xf86ScreenName = argv[++i];
1646
if (!strcmp(argv[i], "-pointer"))
1648
CHECK_FOR_REQUIRED_ARGUMENT();
1649
xf86PointerName = argv[++i];
1652
if (!strcmp(argv[i], "-keyboard"))
1654
CHECK_FOR_REQUIRED_ARGUMENT();
1655
xf86KeyboardName = argv[++i];
1658
if (!strcmp(argv[i], "-nosilk"))
1660
xf86silkenMouseDisableFlag = TRUE;
1663
if (!strcmp(argv[i], "-noacpi"))
1665
xf86acpiDisableFlag = TRUE;
1668
if (!strcmp(argv[i], "-scanpci"))
1670
DoScanPci(argc, argv, i);
1672
if (!strcmp(argv[i], "-probe"))
1676
DoProbe(argc, argv, i);
1680
if (!strcmp(argv[i], "-configure"))
1682
if (getuid() != 0 && geteuid == 0) {
1683
ErrorF("The '-configure' option can only be used by root.\n");
1686
xf86DoConfigure = TRUE;
1687
xf86AllowMouseOpenFail = TRUE;
1690
if (!strcmp(argv[i], "-isolateDevice"))
1692
int bus, device, func;
1693
CHECK_FOR_REQUIRED_ARGUMENT();
1694
if (strncmp(argv[++i], "PCI:", 4)) {
1695
FatalError("Bus types other than PCI not yet isolable\n");
1697
if (sscanf(argv[i], "PCI:%d:%d:%d", &bus, &device, &func) == 3) {
1698
xf86IsolateDevice.bus = bus;
1699
xf86IsolateDevice.device = device;
1700
xf86IsolateDevice.func = func;
1703
FatalError("Invalid isolated device specification\n");
1706
/* OS-specific processing */
1707
return xf86ProcessArgument(argc, argv, i);
1710
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
1711
void ddxInitGlobals(void)
1717
* Print out correct use of device dependent commandline options.
1718
* Maybe the user now knows what really to do ...
1726
ErrorF("Device Dependent Usage\n");
1727
if (getuid() == 0 || geteuid() != 0)
1729
ErrorF("-modulepath paths specify the module search path\n");
1730
ErrorF("-logfile file specify a log file name\n");
1731
ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n");
1733
ErrorF("-config file specify a configuration file, relative to the\n");
1734
ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
1735
ErrorF("-probeonly probe for devices, then exit\n");
1736
ErrorF("-scanpci execute the scanpci module and exit\n");
1737
ErrorF("-verbose [n] verbose startup messages\n");
1738
ErrorF("-logverbose [n] verbose log messages\n");
1739
ErrorF("-quiet minimal startup messages\n");
1740
ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n");
1741
ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n");
1742
ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
1743
ErrorF("-depth n set colour depth. Default: 8\n");
1744
ErrorF("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n");
1745
ErrorF("-rgamma f set gamma value for red phase\n");
1746
ErrorF("-ggamma f set gamma value for green phase\n");
1747
ErrorF("-bgamma f set gamma value for blue phase\n");
1748
ErrorF("-weight nnn set RGB weighting at 16 bpp. Default: 565\n");
1749
ErrorF("-layout name specify the ServerLayout section name\n");
1750
ErrorF("-screen name specify the Screen section name\n");
1751
ErrorF("-keyboard name specify the core keyboard InputDevice name\n");
1752
ErrorF("-pointer name specify the core pointer InputDevice name\n");
1753
ErrorF("-nosilk disable Silken Mouse\n");
1754
ErrorF("-flipPixels swap default black/white Pixel values\n");
1756
ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
1757
ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");
1760
ErrorF("-disableModInDev disable dynamic modification of input device settings\n");
1761
ErrorF("-allowNonLocalModInDev allow changes to keyboard and mouse settings\n");
1762
ErrorF(" from non-local clients\n");
1763
ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
1765
ErrorF("-bestRefresh choose modes with the best refresh rate\n");
1766
ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
1767
ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
1768
ErrorF("-version show the server version\n");
1769
/* OS-specific usage */
1776
#define OSNAME " unknown"
1782
#define PRE_RELEASE XORG_VERSION_SNAP
1790
"This is a pre-release version of the X server from " XVENDORNAME ".\n"
1791
"It is not supported in any way.\n"
1792
"Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
1793
"Select the \"xorg\" product for bugs you find in this release.\n"
1794
"Before reporting bugs in pre-release versions please check the\n"
1795
"latest version in the X.Org Foundation CVS repository.\n"
1796
"See http://wiki.x.org/wiki/CvsPage for CVS access instructions.\n");
1798
ErrorF("\nX Window System Version %d.%d.%d",
1801
XORG_VERSION_PATCH);
1802
#if XORG_VERSION_SNAP > 0
1803
ErrorF(".%d", XORG_VERSION_SNAP);
1806
#if XORG_VERSION_SNAP >= 900
1807
/* When the minor number is 99, that signifies that the we are making
1808
* a release candidate for a major version. (X.0.0)
1809
* When the patch number is 99, that signifies that the we are making
1810
* a release candidate for a minor version. (X.Y.0)
1811
* When the patch number is < 99, then we are making a release
1812
* candidate for the next point release. (X.Y.Z)
1814
#if XORG_VERSION_MINOR >= 99
1815
ErrorF(" (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, XORG_VERSION_SNAP - 900);
1816
#elif XORG_VERSION_PATCH == 99
1817
ErrorF(" (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1,
1818
XORG_VERSION_SNAP - 900);
1820
ErrorF(" (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR,
1821
XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900);
1825
#ifdef XORG_CUSTOM_VERSION
1826
ErrorF(" (%s)", XORG_CUSTOM_VERSION);
1829
#define XORG_DATE XF86_DATE
1831
ErrorF("\nRelease Date: %s\n", XORG_DATE);
1832
ErrorF("X Protocol Version %d, Revision %d, %s\n",
1833
X_PROTOCOL, X_PROTOCOL_REVISION, XORG_RELEASE );
1834
ErrorF("Build Operating System:%s%s\n", OSNAME, OSVENDOR);
1837
struct utsname name;
1839
/* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
1840
and Irix) and Single Unix Spec 3 just say that non-negative is success.
1841
All agree that failure is represented by a negative number.
1843
if (uname(&name) >= 0) {
1844
ErrorF("Current Operating System: %s %s %s %s %s\n",
1845
name.sysname, name.nodename, name.release, name.version, name.machine);
1849
#if defined(BUILD_DATE) && (BUILD_DATE > 19000000)
1854
bzero(&t, sizeof(t));
1855
bzero(buf, sizeof(buf));
1856
t.tm_mday = BUILD_DATE % 100;
1857
t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
1858
t.tm_year = BUILD_DATE / 10000 - 1900;
1859
if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
1860
ErrorF("Build Date: %s\n", buf);
1863
#if defined(CLOG_DATE) && (CLOG_DATE > 19000000)
1868
bzero(&t, sizeof(t));
1869
bzero(buf, sizeof(buf));
1870
t.tm_mday = CLOG_DATE % 100;
1871
t.tm_mon = (CLOG_DATE / 100) % 100 - 1;
1872
t.tm_year = CLOG_DATE / 10000 - 1900;
1873
if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
1874
ErrorF("Changelog Date: %s\n", buf);
1877
#if defined(BUILDERSTRING)
1878
ErrorF("%s \n",BUILDERSTRING);
1880
ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n"
1881
"\tto make sure that you have the latest version.\n");
1882
#ifdef XFree86LOADER
1883
ErrorF("Module Loader present\n");
1899
* If VTInit was set, run that program with consoleFd as stdin and stdout
1902
if (xf86Info.vtinit) {
1905
FatalError("xf86RunVtInit: fork failed (%s)\n", strerror(errno));
1909
/* set stdin, stdout to the consoleFd */
1910
for (i = 0; i < 2; i++) {
1911
if (xf86Info.consoleFd != i) {
1913
dup(xf86Info.consoleFd);
1916
execl("/bin/sh", "sh", "-c", xf86Info.vtinit, (void *)NULL);
1917
xf86Msg(X_WARNING, "exec of /bin/sh failed for VTInit (%s)\n",
1921
default: /* parent */
1927
#ifdef XFree86LOADER
1929
* xf86LoadModules iterates over a list that is being passed in.
1932
xf86LoadModules(char **list, pointer *optlist)
1938
Bool failed = FALSE;
1943
for (i = 0; list[i] != NULL; i++) {
1945
#ifndef NORMALISE_MODULE_NAME
1946
name = xstrdup(list[i]);
1948
/* Normalise the module name */
1949
name = xf86NormalizeName(list[i]);
1952
/* Skip empty names */
1953
if (name == NULL || *name == '\0')
1961
if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) {
1962
LoaderErrorMsg(NULL, name, errmaj, errmin);
1972
/* Pixmap format stuff */
1975
xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
1978
static PixmapFormatRec format; /* XXX not reentrant */
1981
* When the formats[] list initialisation isn't complete, check the
1982
* depth 24 pixmap config/cmdline options and screen-specified formats.
1987
Pix24Flags pix24 = Pix24DontCare;
1990
format.scanlinePad = BITMAP_SCANLINE_PAD;
1991
if (xf86Info.pixmap24 != Pix24DontCare)
1992
pix24 = xf86Info.pixmap24;
1993
else if (pScrn->pixmap24 != Pix24DontCare)
1994
pix24 = pScrn->pixmap24;
1995
if (pix24 == Pix24Use24)
1996
format.bitsPerPixel = 24;
1998
format.bitsPerPixel = 32;
2003
for (i = 0; i < numFormats; i++)
2004
if (formats[i].depth == depth)
2006
if (i != numFormats)
2008
else if (!formatsDone) {
2009
/* Check for screen-specified formats */
2010
for (i = 0; i < pScrn->numFormats; i++)
2011
if (pScrn->formats[i].depth == depth)
2013
if (i != pScrn->numFormats)
2014
return &pScrn->formats[i];
2020
xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
2022
PixmapFormatPtr format;
2025
format = xf86GetPixFormat(pScrn, depth);
2027
return format->bitsPerPixel;