From a915739887477b28d924ecc8417ee107d125bd6c Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 6 Sep 2009 18:48:27 +0000 Subject: Switched to xorg-server-1.6.99.900.tar.gz --- xorg-server/hw/xfree86/common/xf86Init.c | 350 ++++++------------------------- 1 file changed, 61 insertions(+), 289 deletions(-) (limited to 'xorg-server/hw/xfree86/common/xf86Init.c') diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index f029915c6..f9224b1a6 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -43,7 +43,6 @@ #include #endif -#define NEED_EVENTS #include #include #include @@ -68,7 +67,6 @@ #include "xf86Config.h" #include "xf86_OSlib.h" #include "xorgVersion.h" -#include "xf86Date.h" #include "xf86Build.h" #include "mipointer.h" #include @@ -80,11 +78,11 @@ #include "picturestr.h" #endif +#include "xf86VGAarbiter.h" #include "globals.h" #ifdef DPMSExtension -#define DPMS_SERVER -#include +#include #include "dpmsproc.h" #endif @@ -95,7 +93,6 @@ /* forward declarations */ static Bool probe_devices_from_device_sections(DriverPtr drvp); static Bool add_matching_devices_to_configure_list(DriverPtr drvp); -static Bool check_for_matching_devices(DriverPtr drvp); #ifdef XF86PM void (*xf86OSPMClose)(void) = NULL; @@ -175,7 +172,7 @@ xf86PrintBanner(void) ErrorF(" (%s)", XORG_CUSTOM_VERSION); #endif #ifndef XORG_DATE -#define XORG_DATE XF86_DATE +# define XORG_DATE "Unknown" #endif ErrorF("\nRelease Date: %s\n", XORG_DATE); ErrorF("X Protocol Version %d, Revision %d\n", @@ -192,6 +189,21 @@ xf86PrintBanner(void) if (uname(&name) >= 0) { ErrorF("Current Operating System: %s %s %s %s %s\n", name.sysname, name.nodename, name.release, name.version, name.machine); +#ifdef linux + do { + char buf[80]; + int fd = open("/proc/cmdline", O_RDONLY); + if (fd != -1) { + ErrorF("Kernel command line: "); + memset(buf, 0, 80); + while (read(fd, buf, 80) > 0) { + ErrorF("%.80s", buf); + memset(buf, 0, 80); + } + close(fd); + } + } while (0); +#endif } } #endif @@ -217,23 +229,10 @@ xf86PrintBanner(void) #endif } #endif -#if defined(CLOG_DATE) && (CLOG_DATE > 19000000) - { - struct tm t; - char buf[100]; - - bzero(&t, sizeof(t)); - bzero(buf, sizeof(buf)); - t.tm_mday = CLOG_DATE % 100; - t.tm_mon = (CLOG_DATE / 100) % 100 - 1; - t.tm_year = CLOG_DATE / 10000 - 1900; - if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) - ErrorF("Changelog Date: %s\n", buf); - } -#endif #if defined(BUILDERSTRING) ErrorF("%s \n",BUILDERSTRING); #endif + ErrorF("Current version of pixman: %s\n", pixman_version_string()); ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n" "\tto make sure that you have the latest version.\n"); } @@ -244,84 +243,6 @@ xf86PrintMarkers(void) LogPrintMarkers(); } -static void -DoModalias(void) -{ - int i = -1; - char **vlist; - - /* Get all the drivers */ - vlist = xf86DriverlistFromCompile(); - if (!vlist) { - ErrorF("Missing output drivers. PCI Access dump failed.\n"); - goto bail; - } - - /* Load all the drivers that were found. */ - xf86LoadModules(vlist, NULL); - - xfree(vlist); - - /* Iterate through each driver */ - for (i = 0; i < xf86NumDrivers; i++) { - struct pci_id_match *match; - - /* Iterate through each pci id match data, dumping it to the screen */ - for (match = (struct pci_id_match *) xf86DriverList[i]->supported_devices ; - match && !(!match->vendor_id && !match->device_id) ; match++) { - /* Prefix */ - ErrorF("alias pci:"); - - /* Vendor */ - if (match->vendor_id == ~0) - ErrorF("v*"); - else - ErrorF("v%08X", match->vendor_id); - - /* Device */ - if (match->device_id == ~0) - ErrorF("d*"); - else - ErrorF("d%08X", match->device_id); - - /* Subvendor */ - if (match->subvendor_id == ~0) - ErrorF("sv*"); - else - ErrorF("sv%08X", match->subvendor_id); - - /* Subdevice */ - if (match->subdevice_id == ~0) - ErrorF("sd*"); - else - ErrorF("sd%08X", match->subdevice_id); - - /* Class */ - if ((match->device_class_mask >> 16 & 0xFF) == 0xFF) - ErrorF("bc%02X", match->device_class >> 16 & 0xFF); - else - ErrorF("bc*"); - if ((match->device_class_mask >> 8 & 0xFF) == 0xFF) - ErrorF("sc%02X", match->device_class >> 8 & 0xFF); - else - ErrorF("sc*"); - if ((match->device_class_mask & 0xFF) == 0xFF) - ErrorF("i%02X*", match->device_class & 0xFF); - else - ErrorF("i*"); - - /* Suffix (driver) */ - ErrorF(" %s\n", xf86DriverList[i]->driverName); - } - } - -bail: - OsCleanup(TRUE); - AbortDDX(); - fflush(stderr); - exit(0); -} - static Bool xf86CreateRootWindow(WindowPtr pWin) { @@ -332,9 +253,7 @@ xf86CreateRootWindow(WindowPtr pWin) CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey); -#ifdef DEBUG - ErrorF("xf86CreateRootWindow(%p)\n", pWin); -#endif + DebugF("xf86CreateRootWindow(%p)\n", pWin); if ( pScreen->CreateWindow != xf86CreateRootWindow ) { /* Can't find hook we are hung on */ @@ -381,9 +300,7 @@ xf86CreateRootWindow(WindowPtr pWin) } } -#ifdef DEBUG - ErrorF("xf86CreateRootWindow() returns %d\n", ret); -#endif + DebugF("xf86CreateRootWindow() returns %d\n", ret); return (ret); } @@ -396,23 +313,25 @@ InstallSignalHandlers(void) */ xf86Info.caughtSignal=FALSE; if (!xf86Info.notrapSignals) { - signal(SIGSEGV,xf86SigHandler); - signal(SIGILL,xf86SigHandler); + OsRegisterSigWrapper(xf86SigWrapper); + } else { + signal(SIGSEGV, SIG_DFL); + signal(SIGILL, SIG_DFL); #ifdef SIGEMT - signal(SIGEMT,xf86SigHandler); + signal(SIGEMT, SIG_DFL); #endif - signal(SIGFPE,xf86SigHandler); + signal(SIGFPE, SIG_DFL); #ifdef SIGBUS - signal(SIGBUS,xf86SigHandler); + signal(SIGBUS, SIG_DFL); #endif #ifdef SIGSYS - signal(SIGSYS,xf86SigHandler); + signal(SIGSYS, SIG_DFL); #endif #ifdef SIGXCPU - signal(SIGXCPU,xf86SigHandler); + signal(SIGXCPU, SIG_DFL); #endif #ifdef SIGXFSZ - signal(SIGXFSZ,xf86SigHandler); + signal(SIGXFSZ, SIG_DFL); #endif } } @@ -485,10 +404,8 @@ probe_devices_from_device_sections(DriverPtr drvp) if ( (devList[i]->screen == 0) && !xf86CheckPciSlot( pPci ) ) continue; -#ifdef DEBUG - ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n", + DebugF("%s: card at %d:%d:%d is claimed by a Device section\n", drvp->driverName, pPci->bus, pPci->dev, pPci->func); -#endif /* Allocate an entry in the lists to be returned */ entry = xf86ClaimPciSlot(pPci, drvp, device_id, @@ -499,7 +416,7 @@ probe_devices_from_device_sections(DriverPtr drvp) for ( k = 0; k < xf86NumEntities; k++ ) { EntityPtr pEnt = xf86Entities[k]; - if (pEnt->busType != BUS_PCI) + if (pEnt->bus.type != BUS_PCI) continue; if (pEnt->bus.id.pci == pPci) { @@ -514,7 +431,8 @@ probe_devices_from_device_sections(DriverPtr drvp) if ((*drvp->PciProbe)(drvp, entry, pPci, devices[j].match_data)) { foundScreen = TRUE; - } + } else + xf86UnclaimPciSlot(pPci); } break; @@ -572,32 +490,6 @@ add_matching_devices_to_configure_list(DriverPtr drvp) return (numFound != 0); } - -Bool -check_for_matching_devices(DriverPtr drvp) -{ - const struct pci_id_match * const devices = drvp->supported_devices; - int j; - - - for (j = 0; ! END_OF_MATCHES(devices[j]); j++) { - struct pci_device_iterator *iter; - struct pci_device *dev; - - iter = pci_id_match_iterator_create(& devices[j]); - dev = pci_device_next(iter); - pci_iterator_destroy(iter); - - if (dev != NULL) { - return TRUE; - } - } - - - return FALSE; -} - - /** * Call the driver's correct probe function. * @@ -619,11 +511,7 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only ) Bool foundScreen = FALSE; if ( drv->PciProbe != NULL ) { - if ( xf86DoProbe ) { - assert( detect_only ); - foundScreen = check_for_matching_devices( drv ); - } - else if ( xf86DoConfigure && xf86DoConfigurePass1 ) { + if ( xf86DoConfigure && xf86DoConfigurePass1 ) { assert( detect_only ); foundScreen = add_matching_devices_to_configure_list( drv ); } @@ -643,76 +531,6 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only ) return foundScreen; } -static void -DoProbe(void) -{ - int i; - Bool probeResult; - Bool ioEnableFailed = FALSE; - - /* Find the list of video driver modules. */ - char **list = xf86DriverlistFromCompile(); - char **l; - - if (list) { - ErrorF("List of video driver modules:\n"); - for (l = list; *l; l++) - ErrorF("\t%s\n", *l); - } else { - ErrorF("No video driver modules found\n"); - } - - /* Load all the drivers that were found. */ - xf86LoadModules(list, NULL); - - /* Disable PCI devices */ - xf86AccessInit(); - - /* Call all of the probe functions, reporting the results. */ - for (i = 0; i < xf86NumDrivers; i++) { - DriverRec * const drv = xf86DriverList[i]; - - if (!xorgHWAccess) { - xorgHWFlags flags; - if (!drv->driverFunc - || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags ) - || NEED_IO_ENABLED(flags)) { - if (ioEnableFailed) - continue; - if (!xf86EnableIO()) { - ioEnableFailed = TRUE; - continue; - } - xorgHWAccess = TRUE; - } - } - - - xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName); - - probeResult = xf86CallDriverProbe( drv, TRUE ); - if (!probeResult) { - xf86ErrorF("Probe in driver `%s' returns FALSE\n", - drv->driverName); - } else { - xf86ErrorF("Probe in driver `%s' returns TRUE\n", - drv->driverName); - - /* If we have a result, then call driver's Identify function */ - if (drv->Identify != NULL) { - const int verbose = xf86SetVerbosity(1); - (*drv->Identify)(0); - xf86SetVerbosity(verbose); - } - } - } - - OsCleanup(TRUE); - AbortDDX(); - fflush(stderr); - exit(0); -} - /* * InitOutput -- * Initialize screenInfo for all actually accessible framebuffers. @@ -743,7 +561,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) else xf86ServerName = argv[0]; - if (!xf86DoModalias) { xf86PrintBanner(); xf86PrintMarkers(); if (xf86LogFile) { @@ -754,10 +571,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s", xf86LogFile, ct); } - } /* Read and parse the config file */ - if (!xf86DoProbe && !xf86DoConfigure && !xf86DoModalias && !xf86DoShowOptions) { + if (!xf86DoConfigure && !xf86DoShowOptions) { switch (xf86HandleConfigFile(FALSE)) { case CONFIG_OK: break; @@ -790,16 +606,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) /* Do a general bus probe. This will be a PCI probe for x86 platforms */ xf86BusProbe(); - if (xf86DoProbe) - DoProbe(); - if (xf86DoConfigure) DoConfigure(); - /* Do the PCI Access dump */ - if (xf86DoModalias) - DoModalias(); - if (autoconfig) { if (!xf86AutoConfig()) { xf86Msg(X_ERROR, "Auto configuration failed\n"); @@ -811,9 +620,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) xf86OSPMClose = xf86OSPMOpen(); #endif - /* Initialise the resource broker */ - xf86ResourceBrokerInit(); - /* Load all modules specified explicitly in the config file */ if ((modulelist = xf86ModulelistFromConfig(&optionlist))) { xf86LoadModules(modulelist, optionlist); @@ -924,6 +730,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) return; } + xf86VGAarbiterInit(); + /* * Match up the screens found by the probes against those specified * in the config file. Remove the ones that won't be used. Sort @@ -1004,10 +812,12 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) */ for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); + xf86VGAarbiterScrnInit(xf86Screens[i]); + xf86VGAarbiterLock(xf86Screens[i]); if (xf86Screens[i]->PreInit && xf86Screens[i]->PreInit(xf86Screens[i], 0)) xf86Screens[i]->configured = TRUE; + xf86VGAarbiterUnlock(xf86Screens[i]); } for (i = 0; i < xf86NumScreens; i++) if (!xf86Screens[i]->configured) @@ -1033,15 +843,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) } } - /* XXX Should this be before or after loading dependent modules? */ - if (xf86ProbeOnly) - { - OsCleanup(TRUE); - AbortDDX(); - fflush(stderr); - exit(0); - } - /* Remove (unload) drivers that are not required */ for (i = 0; i < xf86NumDrivers; i++) if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0) @@ -1057,7 +858,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) /* * Collect all pixmap formats and check for conflicts at the display * level. Should we die here? Or just delete the offending screens? - * Also, should this be done for -probeonly? */ screenpix24 = Pix24DontCare; for (i = 0; i < xf86NumScreens; i++) { @@ -1162,10 +962,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) break; } } - - /* set up the proper access funcs */ - xf86PostPreInit(); - } else { /* * serverGeneration != 1; some OSs have to do things here, too. @@ -1230,19 +1026,22 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) #endif /* SCO325 */ for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); + xf86VGAarbiterLock(xf86Screens[i]); /* * Almost everything uses these defaults, and many of those that * don't, will wrap them. */ xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; +#ifdef XFreeXDGA xf86Screens[i]->SetDGAMode = xf86SetDGAMode; +#endif xf86Screens[i]->DPMSSet = NULL; xf86Screens[i]->LoadPalette = NULL; xf86Screens[i]->SetOverscan = NULL; xf86Screens[i]->DriverFunc = NULL; xf86Screens[i]->pScreen = NULL; scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv); + xf86VGAarbiterUnlock(xf86Screens[i]); if (scr_index == i) { /* * Hook in our ScrnInfoRec, and initialise some other pScreen @@ -1258,12 +1057,10 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) FatalError("AddScreen/ScreenInit failed for driver %d\n", i); } -#ifdef DEBUG - ErrorF("InitOutput - xf86Screens[%d]->pScreen = %p\n", + DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n", i, xf86Screens[i]->pScreen ); - ErrorF("xf86Screens[%d]->pScreen->CreateWindow = %p\n", + DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n", i, xf86Screens[i]->pScreen->CreateWindow ); -#endif dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates, xf86CreateRootWindowKey, @@ -1306,9 +1103,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) */ void -InitInput(argc, argv) - int argc; - char **argv; +InitInput(int argc, char **argv) { IDevPtr* pDev; DeviceIntPtr dev; @@ -1337,7 +1132,7 @@ InitInput(argc, argv) */ void -OsVendorInit() +OsVendorInit(void) { static Bool beenHere = FALSE; @@ -1382,7 +1177,7 @@ OsVendorInit() */ void -ddxGiveUp() +ddxGiveUp(void) { int i; @@ -1392,16 +1187,12 @@ ddxGiveUp() xf86OSPMClose = NULL; #endif - xf86AccessLeaveState(); - for (i = 0; i < xf86NumScreens; i++) { /* * zero all access functions to * trap calls when switched away. */ xf86Screens[i]->vtSema = FALSE; - xf86Screens[i]->access = NULL; - xf86Screens[i]->busAccess = NULL; } #ifdef XFreeXDGA @@ -1427,7 +1218,7 @@ ddxGiveUp() */ void -AbortDDX() +AbortDDX(void) { int i; @@ -1448,7 +1239,6 @@ AbortDDX() * we might not have been wrapped yet. Therefore enable * screen explicitely. */ - xf86EnableAccess(xf86Screens[i]); (xf86Screens[i]->LeaveVT)(i, 0); } } @@ -1463,7 +1253,7 @@ AbortDDX() } void -OsVendorFatalError() +OsVendorFatalError(void) { #ifdef VENDORSUPPORT ErrorF("\nPlease refer to your Operating System Vendor support pages\n" @@ -1535,9 +1325,11 @@ ddxProcessArgument(int argc, char **argv, int i) } /* First the options that are only allowed for root */ - if (getuid() == 0 || geteuid() != 0) - { - if (!strcmp(argv[i], "-modulepath")) + if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) { + if ( (geteuid() == 0) && (getuid() != 0) ) { + FatalError("The '%s' option can only be used by root.\n", argv[i]); + } + else if (!strcmp(argv[i], "-modulepath")) { char *mp; CHECK_FOR_REQUIRED_ARGUMENT(); @@ -1561,8 +1353,6 @@ ddxProcessArgument(int argc, char **argv, int i) xf86LogFileFrom = X_CMDLINE; return 2; } - } else if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) { - FatalError("The '%s' option can only be used by root.\n", argv[i]); } if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) { @@ -1577,11 +1367,6 @@ ddxProcessArgument(int argc, char **argv, int i) xf86ConfigFile = argv[i + 1]; return 2; } - if (!strcmp(argv[i],"-probeonly")) - { - xf86ProbeOnly = TRUE; - return 1; - } if (!strcmp(argv[i],"-flipPixels")) { xf86FlipPixels = TRUE; @@ -1797,11 +1582,6 @@ ddxProcessArgument(int argc, char **argv, int i) return 1; } #endif - if (!strcmp(argv[i], "-probe")) - { - xf86DoProbe = TRUE; - return 1; - } if (!strcmp(argv[i], "-configure")) { if (getuid() != 0 && geteuid() == 0) { @@ -1812,12 +1592,6 @@ ddxProcessArgument(int argc, char **argv, int i) xf86AllowMouseOpenFail = TRUE; return 1; } - if (!strcmp(argv[i], "-modalias")) - { - xf86DoModalias = TRUE; - xf86AllowMouseOpenFail = TRUE; - return 1; - } if (!strcmp(argv[i], "-showopts")) { if (getuid() != 0 && geteuid() == 0) { @@ -1862,7 +1636,7 @@ ddxProcessArgument(int argc, char **argv, int i) */ void -ddxUseMsg() +ddxUseMsg(void) { ErrorF("\n"); ErrorF("\n"); @@ -1874,10 +1648,8 @@ ddxUseMsg() ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n"); ErrorF("-showopts print available options for all installed drivers\n"); } - ErrorF("-modalias output a modalias-style filter for each driver installed\n"); ErrorF("-config file specify a configuration file, relative to the\n"); ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n"); - ErrorF("-probeonly probe for devices, then exit\n"); ErrorF("-verbose [n] verbose startup messages\n"); ErrorF("-logverbose [n] verbose log messages\n"); ErrorF("-quiet minimal startup messages\n"); @@ -1957,7 +1729,7 @@ xf86LoadModules(char **list, pointer *optlist) /* Pixmap format stuff */ -_X_EXPORT PixmapFormatPtr +PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth) { int i; @@ -2002,7 +1774,7 @@ xf86GetPixFormat(ScrnInfoPtr pScrn, int depth) return NULL; } -_X_EXPORT int +int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth) { PixmapFormatPtr format; -- cgit v1.2.3