From e172c89783326e2378e4793ff31a0f44210c5534 Mon Sep 17 00:00:00 2001 From: marha Date: Sat, 11 Sep 2010 08:41:00 +0000 Subject: xserver git update 11/9/2010 --- xorg-server/hw/kdrive/src/kxv.c | 9 +- xorg-server/hw/xfree86/common/xf86DGA.c | 2 +- xorg-server/hw/xfree86/common/xf86Helper.c | 4 +- xorg-server/hw/xfree86/common/xf86Init.c | 21 +- xorg-server/hw/xfree86/common/xf86VGAarbiter.c | 169 +-- xorg-server/hw/xfree86/common/xf86VGAarbiter.h | 96 +- xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h | 513 ++++---- xorg-server/hw/xfree86/common/xf86Xinput.c | 1 + xorg-server/hw/xfree86/common/xf86xv.c | 9 +- xorg-server/hw/xfree86/doc/man/Xorg.man.pre | 1368 ++++++++++---------- xorg-server/hw/xfree86/fbdevhw/fbdevhw.c | 43 - xorg-server/hw/xfree86/loader/loader.c | 640 +++++---- xorg-server/hw/xfree86/loader/loader.h | 200 ++- xorg-server/hw/xfree86/loader/sdksyms.sh | 843 ++++++------ xorg-server/hw/xfree86/os-support/linux/lnx_init.c | 5 +- xorg-server/hw/xfree86/parser/Configint.h | 9 - xorg-server/hw/xfree86/parser/Flags.c | 10 +- xorg-server/hw/xfree86/parser/scan.c | 5 +- xorg-server/hw/xfree86/parser/write.c | 436 ++++--- xorg-server/hw/xquartz/mach-startup/bundle-main.c | 3 +- xorg-server/hw/xwin/glx/indirect.c | 5 +- 21 files changed, 2162 insertions(+), 2229 deletions(-) (limited to 'xorg-server/hw') diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c index cf960e62b..e76a2c419 100644 --- a/xorg-server/hw/kdrive/src/kxv.c +++ b/xorg-server/hw/kdrive/src/kxv.c @@ -377,8 +377,7 @@ KdXVInitAdaptors( pa->ddGetPortAttribute = KdXVGetPortAttribute; pa->ddQueryBestSize = KdXVQueryBestSize; pa->ddQueryImageAttributes = KdXVQueryImageAttributes; - if((pa->name = malloc(strlen(adaptorPtr->name) + 1))) - strcpy(pa->name, adaptorPtr->name); + pa->name = strdup(adaptorPtr->name); if(adaptorPtr->nEncodings && (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { @@ -388,8 +387,7 @@ KdXVInitAdaptors( { pe->id = encodingPtr->id; pe->pScreen = pScreen; - if((pe->name = malloc(strlen(encodingPtr->name) + 1))) - strcpy(pe->name, encodingPtr->name); + pe->name = strdup(encodingPtr->name); pe->width = encodingPtr->width; pe->height = encodingPtr->height; pe->rate.numerator = encodingPtr->rate.numerator; @@ -441,8 +439,7 @@ KdXVInitAdaptors( pat->flags = attributePtr->flags; pat->min_value = attributePtr->min_value; pat->max_value = attributePtr->max_value; - if((pat->name = malloc(strlen(attributePtr->name) + 1))) - strcpy(pat->name, attributePtr->name); + pat->name = strdup(attributePtr->name); } pa->nAttributes = adaptorPtr->nAttributes; pa->pAttributes = pAttribute; diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c index bc2aa3ba6..1d46a67d3 100644 --- a/xorg-server/hw/xfree86/common/xf86DGA.c +++ b/xorg-server/hw/xfree86/common/xf86DGA.c @@ -1095,7 +1095,7 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse) ev.header = ET_Internal; ev.length = sizeof(ev); ev.type = event->subtype; - ev.corestate = butc->state; + ev.corestate = butc ? butc->state : 0; if (master && master->key) ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state); diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c index c84f4a0ab..51a503eb9 100644 --- a/xorg-server/hw/xfree86/common/xf86Helper.c +++ b/xorg-server/hw/xfree86/common/xf86Helper.c @@ -1267,7 +1267,7 @@ xf86MsgVerb(MessageType type, int verb, const char *format, ...) va_list ap; va_start(ap, format); - xf86VDrvMsgVerb(-1, type, verb, format, ap); + LogVMessageVerb(type, verb, format, ap); va_end(ap); } @@ -1278,7 +1278,7 @@ xf86Msg(MessageType type, const char *format, ...) va_list ap; va_start(ap, format); - xf86VDrvMsgVerb(-1, type, 1, format, ap); + LogVMessageVerb(type, 1, format, ap); va_end(ap); } diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index fd3281b83..ab5b5a34d 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -314,18 +314,10 @@ InstallSignalHandlers(void) signal(SIGEMT, SIG_DFL); #endif signal(SIGFPE, SIG_DFL); -#ifdef SIGBUS signal(SIGBUS, SIG_DFL); -#endif -#ifdef SIGSYS signal(SIGSYS, SIG_DFL); -#endif -#ifdef SIGXCPU signal(SIGXCPU, SIG_DFL); -#endif -#ifdef SIGXFSZ signal(SIGXFSZ, SIG_DFL); -#endif } } @@ -863,9 +855,7 @@ OsVendorInit(void) { static Bool beenHere = FALSE; -#ifdef SIGCHLD signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */ -#endif if (!beenHere) { umask(022); @@ -1046,11 +1036,6 @@ xf86PrintDefaultLibraryPath(void) int ddxProcessArgument(int argc, char **argv, int i) { - /* - * Note: can't use xalloc/xfree here because OsInit() hasn't been called - * yet. Use malloc/free instead. - */ - #define CHECK_FOR_REQUIRED_ARGUMENT() \ if (((i + 1) >= argc) || (!argv[i + 1])) { \ ErrorF("Required argument to %s not specified\n", argv[i]); \ @@ -1067,10 +1052,9 @@ ddxProcessArgument(int argc, char **argv, int i) { char *mp; CHECK_FOR_REQUIRED_ARGUMENT(); - mp = malloc(strlen(argv[i + 1]) + 1); + mp = strdup(argv[i + 1]); if (!mp) FatalError("Can't allocate memory for ModulePath\n"); - strcpy(mp, argv[i + 1]); xf86ModulePath = mp; xf86ModPathFrom = X_CMDLINE; return 2; @@ -1079,10 +1063,9 @@ ddxProcessArgument(int argc, char **argv, int i) { char *lf; CHECK_FOR_REQUIRED_ARGUMENT(); - lf = malloc(strlen(argv[i + 1]) + 1); + lf = strdup(argv[i + 1]); if (!lf) FatalError("Can't allocate memory for LogFile\n"); - strcpy(lf, argv[i + 1]); xf86LogFile = lf; xf86LogFileFrom = X_CMDLINE; return 2; diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c index d75b86502..1af525e49 100644 --- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c +++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c @@ -138,11 +138,12 @@ xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn) } void -xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn) +xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc) { if (vga_no_arb) return; - pci_device_vgaarb_decodes(VGA_ARB_RSRC_LEGACY_MEM | VGA_ARB_RSRC_LEGACY_IO); + pci_device_vgaarb_set_target(pScrn->vgaDev); + pci_device_vgaarb_decodes(rsrc); } Bool @@ -266,7 +267,7 @@ VGAarbiterBlockHandler(int i, { ScreenPtr pScreen = screenInfo.screens[i]; SCREEN_PROLOG(BlockHandler); - VGAGet(); + VGAGet(pScreen); pScreen->BlockHandler(i, blockData, pTimeout, pReadmask); VGAPut(); SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler); @@ -277,7 +278,7 @@ VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer { ScreenPtr pScreen = screenInfo.screens[i]; SCREEN_PROLOG(WakeupHandler); - VGAGet(); + VGAGet(pScreen); pScreen->WakeupHandler(i, blockData, result, pReadmask); VGAPut(); SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler); @@ -295,7 +296,7 @@ VGAarbiterGetImage ( ScreenPtr pScreen = pDrawable->pScreen; SCREEN_PROLOG(GetImage); // if (xf86Screens[pScreen->myNum]->vtSema) { - VGAGet(); + VGAGet(pScreen); // } (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); @@ -316,7 +317,7 @@ VGAarbiterGetSpans ( ScreenPtr pScreen = pDrawable->pScreen; SCREEN_PROLOG (GetSpans); - VGAGet(); + VGAGet(pScreen); (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); VGAPut(); SCREEN_EPILOG (GetSpans, VGAarbiterGetSpans); @@ -329,7 +330,7 @@ VGAarbiterSourceValidate ( { ScreenPtr pScreen = pDrawable->pScreen; SCREEN_PROLOG (SourceValidate); - VGAGet(); + VGAGet(pScreen); if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height); VGAPut(); @@ -345,7 +346,7 @@ VGAarbiterCopyWindow( ScreenPtr pScreen = pWin->drawable.pScreen; SCREEN_PROLOG (CopyWindow); - VGAGet(); + VGAGet(pScreen); (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); VGAPut(); SCREEN_EPILOG (CopyWindow, VGAarbiterCopyWindow); @@ -361,7 +362,7 @@ VGAarbiterClearToBackground ( ScreenPtr pScreen = pWin->drawable.pScreen; SCREEN_PROLOG ( ClearToBackground); - VGAGet(); + VGAGet(pScreen); (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures); VGAPut(); SCREEN_EPILOG (ClearToBackground, VGAarbiterClearToBackground); @@ -373,7 +374,7 @@ VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usag PixmapPtr pPix; SCREEN_PROLOG ( CreatePixmap); - VGAGet(); + VGAGet(pScreen); pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint); VGAPut(); SCREEN_EPILOG (CreatePixmap, VGAarbiterCreatePixmap); @@ -387,7 +388,7 @@ VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank) Bool val; SCREEN_PROLOG (SaveScreen); - VGAGet(); + VGAGet(pScreen); val = (*pScreen->SaveScreen) (pScreen, unblank); VGAPut(); SCREEN_EPILOG (SaveScreen, VGAarbiterSaveScreen); @@ -404,7 +405,7 @@ VGAarbiterStoreColors ( ScreenPtr pScreen = pmap->pScreen; SCREEN_PROLOG (StoreColors); - VGAGet(); + VGAGet(pScreen); (*pScreen->StoreColors) (pmap,ndef,pdefs); VGAPut(); SCREEN_EPILOG ( StoreColors, VGAarbiterStoreColors); @@ -419,7 +420,7 @@ VGAarbiterRecolorCursor ( ) { SCREEN_PROLOG (RecolorCursor); - VGAGet(); + VGAGet(pScreen); (*pScreen->RecolorCursor) (pDev, pScreen, pCurs, displayed); VGAPut(); SCREEN_EPILOG ( RecolorCursor, VGAarbiterRecolorCursor); @@ -435,7 +436,7 @@ VGAarbiterRealizeCursor ( Bool val; SCREEN_PROLOG (RealizeCursor); - VGAGet(); + VGAGet(pScreen); val = (*pScreen->RealizeCursor) (pDev, pScreen,pCursor); VGAPut(); SCREEN_EPILOG ( RealizeCursor, VGAarbiterRealizeCursor); @@ -452,7 +453,7 @@ VGAarbiterUnrealizeCursor ( Bool val; SCREEN_PROLOG (UnrealizeCursor); - VGAGet(); + VGAGet(pScreen); val = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor); VGAPut(); SCREEN_EPILOG ( UnrealizeCursor, VGAarbiterUnrealizeCursor); @@ -469,7 +470,7 @@ VGAarbiterDisplayCursor ( Bool val; SCREEN_PROLOG (DisplayCursor); - VGAGet(); + VGAGet(pScreen); val = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor); VGAPut(); SCREEN_EPILOG ( DisplayCursor, VGAarbiterDisplayCursor); @@ -486,7 +487,7 @@ VGAarbiterSetCursorPosition ( Bool val; SCREEN_PROLOG (SetCursorPosition); - VGAGet(); + VGAGet(pScreen); val = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent); VGAPut(); SCREEN_EPILOG ( SetCursorPosition, VGAarbiterSetCursorPosition); @@ -500,7 +501,7 @@ VGAarbiterAdjustFrame(int index, int x, int y, int flags) VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate( &pScreen->devPrivates, VGAarbiterScreenKey); - VGAGet(); + VGAGet(pScreen); (*pScreenPriv->AdjustFrame)(index, x, y, flags); VGAPut(); } @@ -513,7 +514,7 @@ VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags) VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate( &pScreen->devPrivates, VGAarbiterScreenKey); - VGAGet(); + VGAGet(pScreen); val = (*pScreenPriv->SwitchMode)(index, mode, flags); VGAPut(); return val; @@ -528,7 +529,7 @@ VGAarbiterEnterVT(int index, int flags) VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate( &pScreen->devPrivates, VGAarbiterScreenKey); - VGAGet(); + VGAGet(pScreen); pScrn->EnterVT = pScreenPriv->EnterVT; val = (*pScrn->EnterVT)(index, flags); pScreenPriv->EnterVT = pScrn->EnterVT; @@ -545,7 +546,7 @@ VGAarbiterLeaveVT(int index, int flags) VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate( &pScreen->devPrivates, VGAarbiterScreenKey); - VGAGet(); + VGAGet(pScreen); pScrn->LeaveVT = pScreenPriv->LeaveVT; (*pScreenPriv->LeaveVT)(index, flags); pScreenPriv->LeaveVT = pScrn->LeaveVT; @@ -560,7 +561,7 @@ VGAarbiterFreeScreen(int index, int flags) VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate( &pScreen->devPrivates, VGAarbiterScreenKey); - VGAGet(); + VGAGet(pScreen); (*pScreenPriv->FreeScreen)(index, flags); VGAPut(); } @@ -573,7 +574,7 @@ VGAarbiterCreateGC(GCPtr pGC) Bool ret; SCREEN_PROLOG(CreateGC); - VGAGet(); + VGAGet(pScreen); ret = (*pScreen->CreateGC)(pGC); VGAPut(); GC_WRAP(pGC); @@ -662,10 +663,11 @@ VGAarbiterFillSpans( int *pwidthInit, int fSorted ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -679,10 +681,11 @@ VGAarbiterSetSpans( int nspans, int fSorted ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -696,11 +699,12 @@ VGAarbiterPutImage( int format, char *pImage ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -714,12 +718,12 @@ VGAarbiterCopyArea( int dstx, int dsty ) { RegionPtr ret; - + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); ret = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); return ret; } @@ -735,12 +739,12 @@ VGAarbiterCopyPlane( unsigned long bitPlane ) { RegionPtr ret; - + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); return ret; } @@ -753,10 +757,11 @@ VGAarbiterPolyPoint( int npt, xPoint *pptInit ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -769,10 +774,11 @@ VGAarbiterPolylines( int npt, DDXPointPtr pptInit ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -783,10 +789,11 @@ VGAarbiterPolySegment( int nseg, xSegment *pSeg ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -797,10 +804,11 @@ VGAarbiterPolyRectangle( int nRectsInit, xRectangle *pRectsInit ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -811,10 +819,11 @@ VGAarbiterPolyArc( int narcs, xArc *parcs ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -827,10 +836,11 @@ VGAarbiterFillPolygon( int count, DDXPointPtr ptsIn ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -841,10 +851,11 @@ VGAarbiterPolyFillRect( int nrectFill, xRectangle *prectInit) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -855,10 +866,11 @@ VGAarbiterPolyFillArc( int narcs, xArc *parcs ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -872,11 +884,11 @@ VGAarbiterPolyText8( char *chars ) { int ret; - + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); return ret; } @@ -891,11 +903,11 @@ VGAarbiterPolyText16( unsigned short *chars ) { int ret; - + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); return ret; } @@ -909,10 +921,11 @@ VGAarbiterImageText8( int count, char *chars ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -925,10 +938,11 @@ VGAarbiterImageText16( int count, unsigned short *chars ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -942,11 +956,12 @@ VGAarbiterImageGlyphBlt( CharInfoPtr *ppci, pointer pglyphBase ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -959,11 +974,12 @@ VGAarbiterPolyGlyphBlt( CharInfoPtr *ppci, pointer pglyphBase ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -974,10 +990,11 @@ VGAarbiterPushPixels( DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg ) { + ScreenPtr pScreen = pGC->pScreen; GC_UNWRAP(pGC); - VGAGet_GC(); + VGAGet(pScreen); (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); - VGAPut_GC(); + VGAPut(); GC_WRAP(pGC); } @@ -988,7 +1005,7 @@ VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pC { Bool val; SPRITE_PROLOG; - VGAGet(); + VGAGet(pScreen); val = PointPriv->spriteFuncs->RealizeCursor(pDev, pScreen, pCur); VGAPut(); SPRITE_EPILOG; @@ -1000,7 +1017,7 @@ VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr { Bool val; SPRITE_PROLOG; - VGAGet(); + VGAGet(pScreen); val = PointPriv->spriteFuncs->UnrealizeCursor(pDev, pScreen, pCur); VGAPut(); SPRITE_EPILOG; @@ -1011,7 +1028,7 @@ static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur, int x, int y) { SPRITE_PROLOG; - VGAGet(); + VGAGet(pScreen); PointPriv->spriteFuncs->SetCursor(pDev, pScreen, pCur, x, y); VGAPut(); SPRITE_EPILOG; @@ -1021,7 +1038,7 @@ static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { SPRITE_PROLOG; - VGAGet(); + VGAGet(pScreen); PointPriv->spriteFuncs->MoveCursor(pDev, pScreen, x, y); VGAPut(); SPRITE_EPILOG; @@ -1032,7 +1049,7 @@ VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { Bool val; SPRITE_PROLOG; - VGAGet(); + VGAGet(pScreen); val = PointPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen); VGAPut(); SPRITE_EPILOG; @@ -1043,7 +1060,7 @@ static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { SPRITE_PROLOG; - VGAGet(); + VGAGet(pScreen); PointPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen); VGAPut(); SPRITE_EPILOG; @@ -1060,7 +1077,7 @@ VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PICTURE_PROLOGUE(Composite); - VGAGet(); + VGAGet(pScreen); (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); VGAPut(); @@ -1077,7 +1094,7 @@ VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PICTURE_PROLOGUE(Glyphs); - VGAGet(); + VGAGet(pScreen); (*ps->Glyphs)(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); VGAPut(); PICTURE_EPILOGUE (Glyphs, VGAarbiterGlyphs); @@ -1092,7 +1109,7 @@ VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRe PICTURE_PROLOGUE(CompositeRects); - VGAGet(); + VGAGet(pScreen); (*ps->CompositeRects)(op, pDst, color, nRect, rects); VGAPut(); PICTURE_EPILOGUE (CompositeRects, VGAarbiterCompositeRects); diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.h b/xorg-server/hw/xfree86/common/xf86VGAarbiter.h index 904b6b079..ae9c51dd2 100644 --- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.h +++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.h @@ -1,48 +1,48 @@ -/* - * Copyright (c) 2009 Tiago Vignatti - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef __XF86VGAARBITER_H -#define __XF86VGAARBITER_H - -#include "screenint.h" -#include "misc.h" -#include "xf86.h" - -/* Functions */ -extern void xf86VGAarbiterInit(void); -extern void xf86VGAarbiterFini(void); -void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn); -extern Bool xf86VGAarbiterWrapFunctions(void); -extern void xf86VGAarbiterLock(ScrnInfoPtr pScrn); -extern void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn); - -/* allow a driver to remove itself from arbiter - really should be - * done in the kernel though */ -extern _X_EXPORT void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn); -/* DRI and arbiter are really not possible together, - * you really want to remove the card from arbitration if you can */ -extern _X_EXPORT Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen); - -#endif /* __XF86VGAARBITER_H */ +/* + * Copyright (c) 2009 Tiago Vignatti + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __XF86VGAARBITER_H +#define __XF86VGAARBITER_H + +#include "screenint.h" +#include "misc.h" +#include "xf86.h" + +/* Functions */ +extern void xf86VGAarbiterInit(void); +extern void xf86VGAarbiterFini(void); +void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn); +extern Bool xf86VGAarbiterWrapFunctions(void); +extern void xf86VGAarbiterLock(ScrnInfoPtr pScrn); +extern void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn); + +/* allow a driver to remove itself from arbiter - really should be + * done in the kernel though */ +extern _X_EXPORT void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc); +/* DRI and arbiter are really not possible together, + * you really want to remove the card from arbitration if you can */ +extern _X_EXPORT Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen); + +#endif /* __XF86VGAARBITER_H */ diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h index 9b4a59731..0107a4952 100644 --- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h +++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h @@ -1,260 +1,253 @@ -/* - * Copyright (c) 2009 Tiago Vignatti - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" -#include -#include "colormapst.h" -#include "scrnintstr.h" -#include "screenint.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "pixmap.h" -#include "windowstr.h" -#include "window.h" -#include "xf86str.h" -#include "mipointer.h" -#include "mipointrst.h" -# include "picturestr.h" - - -#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;} - -#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x - -#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \ - dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x - -#define SCREEN_EPILOG(x,y) pScreen->x = y; - -#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\ - ps->x = y;} - -#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;} - -#define PICTURE_PROLOGUE(field) ps->field = \ - ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \ - VGAarbiterScreenKey))->field - -#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap - -#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0) - -#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x - -#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \ - (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \ - miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \ - ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \ - VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite; - -#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\ - PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; - -#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\ - PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \ - } while (0) - -#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite - -#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\ - pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\ - (x)->funcs = &VGAarbiterGCFuncs; - -#define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \ - (VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\ - (x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs; - -#define GC_SCREEN register ScrnInfoPtr pScrn = \ - xf86Screens[pGC->pScreen->myNum] - -#define VGAGet(x)\ - pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev); \ - pci_device_vgaarb_lock(); - -#define VGAGet_GC(x)\ - pci_device_vgaarb_set_target(xf86Screens[pGC->pScreen->myNum]->vgaDev); \ - pci_device_vgaarb_lock(); - -#define VGAPut(x)\ - pci_device_vgaarb_unlock(); - -#define VGAPut_GC(x)\ - pci_device_vgaarb_unlock(); - - -typedef struct _VGAarbiterScreen { - CreateGCProcPtr CreateGC; - CloseScreenProcPtr CloseScreen; - ScreenBlockHandlerProcPtr BlockHandler; - ScreenWakeupHandlerProcPtr WakeupHandler; - GetImageProcPtr GetImage; - GetSpansProcPtr GetSpans; - SourceValidateProcPtr SourceValidate; - CopyWindowProcPtr CopyWindow; - ClearToBackgroundProcPtr ClearToBackground; - CreatePixmapProcPtr CreatePixmap; - SaveScreenProcPtr SaveScreen; - /* Colormap */ - StoreColorsProcPtr StoreColors; - /* Cursor */ - DisplayCursorProcPtr DisplayCursor; - RealizeCursorProcPtr RealizeCursor; - UnrealizeCursorProcPtr UnrealizeCursor; - RecolorCursorProcPtr RecolorCursor; - SetCursorPositionProcPtr SetCursorPosition; - void (*AdjustFrame)(int,int,int,int); - Bool (*SwitchMode)(int, DisplayModePtr,int); - Bool (*EnterVT)(int, int); - void (*LeaveVT)(int, int); - void (*FreeScreen)(int, int); - miPointerSpriteFuncPtr miSprite; - CompositeProcPtr Composite; - GlyphsProcPtr Glyphs; - CompositeRectsProcPtr CompositeRects; -} VGAarbiterScreenRec, *VGAarbiterScreenPtr; - -typedef struct _VGAarbiterGC { - GCOps *wrapOps; - GCFuncs *wrapFuncs; -} VGAarbiterGCRec, *VGAarbiterGCPtr; - -/* Screen funcs */ -static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask); -static void VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask); -static Bool VGAarbiterCloseScreen (int i, ScreenPtr pScreen); -static void VGAarbiterGetImage (DrawablePtr pDrawable, int sx, int sy, int w, - int h, unsigned int format, unsigned long planemask, char *pdstLine); -static void VGAarbiterGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr - ppt, int *pwidth, int nspans, char *pdstStart); -static void VGAarbiterSourceValidate (DrawablePtr pDrawable, int x, int y, - int width, int height); -static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, - RegionPtr prgnSrc); -static void VGAarbiterClearToBackground (WindowPtr pWin, int x, int y, int w, - int h, Bool generateExposures); -static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, - int depth, unsigned int usage_hint); -static Bool VGAarbiterCreateGC(GCPtr pGC); -static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank); -static void VGAarbiterStoreColors (ColormapPtr pmap, int ndef, xColorItem - *pdefs); -static void VGAarbiterRecolorCursor (DeviceIntPtr pDev, ScreenPtr pScreen, - CursorPtr pCurs, Bool displayed); -static Bool VGAarbiterRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, - CursorPtr pCursor); -static Bool VGAarbiterUnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, - CursorPtr pCursor); -static Bool VGAarbiterDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, - CursorPtr pCursor); -static Bool VGAarbiterSetCursorPosition (DeviceIntPtr pDev, ScreenPtr - pScreen, int x, int y, Bool generateEvent); -static void VGAarbiterAdjustFrame(int index, int x, int y, int flags); -static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags); -static Bool VGAarbiterEnterVT(int index, int flags); -static void VGAarbiterLeaveVT(int index, int flags); -static void VGAarbiterFreeScreen(int index, int flags); - -/* GC funcs */ -static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes, - DrawablePtr pDraw); -static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask); -static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); -static void VGAarbiterDestroyGC(GCPtr pGC); -static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue, - int nrects); -static void VGAarbiterDestroyClip(GCPtr pGC); -static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc); - -/* GC ops */ -static void VGAarbiterFillSpans( DrawablePtr pDraw, GC *pGC, int nInit, - DDXPointPtr pptInit, int *pwidthInit, int fSorted); -static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc, - register DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); -static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, - int x, int y, int w, int h, int leftPad, int format, char *pImage); -static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst, - GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty); -static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, - GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, - unsigned long bitPlane); -static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode, - int npt, xPoint *pptInit); -static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode, - int npt, DDXPointPtr pptInit); -static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, - xSegment *pSeg); -static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC, - int nRectsInit, xRectangle *pRectsInit); -static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, - xArc *parcs); -static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr ptsIn); -static void VGAarbiterPolyFillRect( DrawablePtr pDraw, GCPtr pGC, - int nrectFill, xRectangle *prectInit); -static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, - xArc *parcs); -static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, char *chars); -static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars); -static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, char *chars); -static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, - int count, unsigned short *chars); -static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase); -static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, - int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase); -static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr - pDraw, int dx, int dy, int xOrg, int yOrg); - -/* miSpriteFuncs */ -static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr - pScreen, CursorPtr pCur); -static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr - pScreen, CursorPtr pCur); -static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, - CursorPtr pCur, int x, int y); -static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, - int x, int y); -static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); -static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); - - -static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, - PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); -static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr - list, GlyphPtr *glyphs); -static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor - *color, int nRect, xRectangle *rects); +/* + * Copyright (c) 2009 Tiago Vignatti + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#include "misc.h" +#include "xf86.h" +#include "xf86_OSproc.h" +#include +#include "colormapst.h" +#include "scrnintstr.h" +#include "screenint.h" +#include "gcstruct.h" +#include "pixmapstr.h" +#include "pixmap.h" +#include "windowstr.h" +#include "window.h" +#include "xf86str.h" +#include "mipointer.h" +#include "mipointrst.h" +# include "picturestr.h" + + +#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;} + +#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x + +#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x + +#define SCREEN_EPILOG(x,y) pScreen->x = y; + +#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\ + ps->x = y;} + +#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;} + +#define PICTURE_PROLOGUE(field) ps->field = \ + ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \ + VGAarbiterScreenKey))->field + +#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap + +#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0) + +#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x + +#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \ + (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \ + miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \ + ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \ + VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite; + +#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\ + PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; + +#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\ + PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \ + } while (0) + +#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite + +#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\ + pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\ + (x)->funcs = &VGAarbiterGCFuncs; + +#define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \ + (VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\ + (x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs; + +static inline void +VGAGet(ScreenPtr pScreen) { + pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev); + pci_device_vgaarb_lock(); +} + +static inline void +VGAPut(void) { + pci_device_vgaarb_unlock(); +} + +typedef struct _VGAarbiterScreen { + CreateGCProcPtr CreateGC; + CloseScreenProcPtr CloseScreen; + ScreenBlockHandlerProcPtr BlockHandler; + ScreenWakeupHandlerProcPtr WakeupHandler; + GetImageProcPtr GetImage; + GetSpansProcPtr GetSpans; + SourceValidateProcPtr SourceValidate; + CopyWindowProcPtr CopyWindow; + ClearToBackgroundProcPtr ClearToBackground; + CreatePixmapProcPtr CreatePixmap; + SaveScreenProcPtr SaveScreen; + /* Colormap */ + StoreColorsProcPtr StoreColors; + /* Cursor */ + DisplayCursorProcPtr DisplayCursor; + RealizeCursorProcPtr RealizeCursor; + UnrealizeCursorProcPtr UnrealizeCursor; + RecolorCursorProcPtr RecolorCursor; + SetCursorPositionProcPtr SetCursorPosition; + void (*AdjustFrame)(int,int,int,int); + Bool (*SwitchMode)(int, DisplayModePtr,int); + Bool (*EnterVT)(int, int); + void (*LeaveVT)(int, int); + void (*FreeScreen)(int, int); + miPointerSpriteFuncPtr miSprite; + CompositeProcPtr Composite; + GlyphsProcPtr Glyphs; + CompositeRectsProcPtr CompositeRects; +} VGAarbiterScreenRec, *VGAarbiterScreenPtr; + +typedef struct _VGAarbiterGC { + GCOps *wrapOps; + GCFuncs *wrapFuncs; +} VGAarbiterGCRec, *VGAarbiterGCPtr; + +/* Screen funcs */ +static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask); +static void VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask); +static Bool VGAarbiterCloseScreen (int i, ScreenPtr pScreen); +static void VGAarbiterGetImage (DrawablePtr pDrawable, int sx, int sy, int w, + int h, unsigned int format, unsigned long planemask, char *pdstLine); +static void VGAarbiterGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr + ppt, int *pwidth, int nspans, char *pdstStart); +static void VGAarbiterSourceValidate (DrawablePtr pDrawable, int x, int y, + int width, int height); +static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, + RegionPtr prgnSrc); +static void VGAarbiterClearToBackground (WindowPtr pWin, int x, int y, int w, + int h, Bool generateExposures); +static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, + int depth, unsigned int usage_hint); +static Bool VGAarbiterCreateGC(GCPtr pGC); +static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank); +static void VGAarbiterStoreColors (ColormapPtr pmap, int ndef, xColorItem + *pdefs); +static void VGAarbiterRecolorCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCurs, Bool displayed); +static Bool VGAarbiterRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool VGAarbiterUnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool VGAarbiterDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool VGAarbiterSetCursorPosition (DeviceIntPtr pDev, ScreenPtr + pScreen, int x, int y, Bool generateEvent); +static void VGAarbiterAdjustFrame(int index, int x, int y, int flags); +static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags); +static Bool VGAarbiterEnterVT(int index, int flags); +static void VGAarbiterLeaveVT(int index, int flags); +static void VGAarbiterFreeScreen(int index, int flags); + +/* GC funcs */ +static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes, + DrawablePtr pDraw); +static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask); +static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); +static void VGAarbiterDestroyGC(GCPtr pGC); +static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue, + int nrects); +static void VGAarbiterDestroyClip(GCPtr pGC); +static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc); + +/* GC ops */ +static void VGAarbiterFillSpans( DrawablePtr pDraw, GC *pGC, int nInit, + DDXPointPtr pptInit, int *pwidthInit, int fSorted); +static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc, + register DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); +static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, + int x, int y, int w, int h, int leftPad, int format, char *pImage); +static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst, + GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty); +static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, + unsigned long bitPlane); +static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode, + int npt, xPoint *pptInit); +static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode, + int npt, DDXPointPtr pptInit); +static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, + xSegment *pSeg); +static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC, + int nRectsInit, xRectangle *pRectsInit); +static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, + xArc *parcs); +static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape, + int mode, int count, DDXPointPtr ptsIn); +static void VGAarbiterPolyFillRect( DrawablePtr pDraw, GCPtr pGC, + int nrectFill, xRectangle *prectInit); +static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, + xArc *parcs); +static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, + int count, char *chars); +static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, + int count, unsigned short *chars); +static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, + int count, char *chars); +static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, + int count, unsigned short *chars); +static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, + int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase); +static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, + int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase); +static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr + pDraw, int dx, int dy, int xOrg, int yOrg); + +/* miSpriteFuncs */ +static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr + pScreen, CursorPtr pCur); +static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr + pScreen, CursorPtr pCur); +static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCur, int x, int y); +static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + int x, int y); +static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); +static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); + + +static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, + PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, + INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); +static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr + list, GlyphPtr *glyphs); +static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor + *color, int nRect, xRectangle *rects); diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index 8ea50aa94..585be69a5 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -66,6 +66,7 @@ #include "xf86InPriv.h" #include "compiler.h" #include "extinit.h" +#include "loaderProcs.h" #ifdef DPMSExtension #include diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c index 29c74f66e..74e76f923 100644 --- a/xorg-server/hw/xfree86/common/xf86xv.c +++ b/xorg-server/hw/xfree86/common/xf86xv.c @@ -429,8 +429,7 @@ xf86XVInitAdaptors( pa->ddGetPortAttribute = xf86XVGetPortAttribute; pa->ddQueryBestSize = xf86XVQueryBestSize; pa->ddQueryImageAttributes = xf86XVQueryImageAttributes; - if((pa->name = malloc(strlen(adaptorPtr->name) + 1))) - strcpy(pa->name, adaptorPtr->name); + pa->name = strdup(adaptorPtr->name); if(adaptorPtr->nEncodings && (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { @@ -440,8 +439,7 @@ xf86XVInitAdaptors( { pe->id = encodingPtr->id; pe->pScreen = pScreen; - if((pe->name = malloc(strlen(encodingPtr->name) + 1))) - strcpy(pe->name, encodingPtr->name); + pe->name = strdup(encodingPtr->name); pe->width = encodingPtr->width; pe->height = encodingPtr->height; pe->rate.numerator = encodingPtr->rate.numerator; @@ -493,8 +491,7 @@ xf86XVInitAdaptors( pat->flags = attributePtr->flags; pat->min_value = attributePtr->min_value; pat->max_value = attributePtr->max_value; - if((pat->name = malloc(strlen(attributePtr->name) + 1))) - strcpy(pat->name, attributePtr->name); + pat->name = strdup(attributePtr->name); } pa->nAttributes = adaptorPtr->nAttributes; pa->pAttributes = pAttribute; diff --git a/xorg-server/hw/xfree86/doc/man/Xorg.man.pre b/xorg-server/hw/xfree86/doc/man/Xorg.man.pre index 46d0e4468..297eda1fb 100644 --- a/xorg-server/hw/xfree86/doc/man/Xorg.man.pre +++ b/xorg-server/hw/xfree86/doc/man/Xorg.man.pre @@ -1,679 +1,689 @@ -.\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $ -.TH __xservername__ __appmansuffix__ __vendorversion__ -.SH NAME -__xservername__ - X11R7 X server -.SH SYNOPSIS -.B __xservername__ -.RI [\fB:\fP display ] -.RI [ option -.IR ... ] -.SH DESCRIPTION -.B __xservername__ -is a full featured X server that was originally designed for UNIX and -UNIX-like operating systems running on Intel x86 hardware. It now runs -on a wider range of hardware and OS platforms. -.PP -This work was derived by the X.Org Foundation from the XFree86 Project's -.I "XFree86\ 4.4rc2" -release. -The XFree86 release was originally derived from -.I "X386\ 1.2" -by Thomas Roell which was contributed to X11R5 by Snitily Graphics -Consulting Service. -.SH PLATFORMS -.PP -.B __xservername__ -operates under a wide range of operating systems and hardware platforms. -The Intel x86 (IA32) architecture is the most widely supported hardware -platform. Other hardware platforms include Compaq Alpha, Intel IA64, AMD64, -SPARC and PowerPC. The most widely supported operating systems are the -free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD, -OpenBSD, and Solaris. Commercial UNIX operating systems such as -UnixWare are also supported. Other supported operating systems include -GNU Hurd. Darwin and Mac OS X are supported with the -XDarwin(__appmansuffix__) X server. Win32/Cygwin is supported with the -XWin(__appmansuffix__) X server. -.PP -.SH "NETWORK CONNECTIONS" -.B __xservername__ -supports connections made using the following reliable -byte-streams: -.TP 4 -.I "Local" -On most platforms, the "Local" connection type is a UNIX-domain socket. -On some System V platforms, the "local" connection types also include -STREAMS pipes, named pipes, and some other mechanisms. -.TP 4 -.I TCP\/IP -.B __xservername__ -listens on port -.RI 6000+ n , -where -.I n -is the display number. This connection type can be disabled with the -.B \-nolisten -option (see the Xserver(1) man page for details). -.SH "ENVIRONMENT VARIABLES" -For operating systems that support local connections other than Unix -Domain sockets (SVR3 and SVR4), there is a compiled-in list specifying -the order in which local connections should be attempted. This list -can be overridden by the -.I XLOCAL -environment variable described below. If the display name indicates a -best-choice connection should be made (e.g. -.BR :0.0 ), -each connection mechanism is tried until a connection succeeds or no -more mechanisms are available. Note: for these OSs, the Unix Domain -socket connection is treated differently from the other local connection -types. To use it the connection must be made to -.BR unix:0.0 . -.PP -The -.I XLOCAL -environment variable should contain a list of one more -more of the following: -.PP -.RS 8 -.nf -NAMED -PTS -SCO -ISC -.fi -.RE -.PP -which represent SVR4 Named Streams pipe, Old-style USL Streams pipe, -SCO XSight Streams pipe, and ISC Streams pipe, respectively. You can -select a single mechanism (e.g. -.IR XLOCAL=NAMED ), -or an ordered list (e.g. \fIXLOCAL="NAMED:PTS:SCO"\fP). -his variable overrides the compiled-in defaults. For SVR4 it is -recommended that -.I NAMED -be the first preference connection. The default setting is -.IR PTS:NAMED:ISC:SCO . -.PP -To globally override the compiled-in defaults, you should define (and -export if using -.B sh -or -.BR ksh ) -.I XLOCAL -globally. If you use startx(1) or xinit(1), the definition should be -at the top of your -.I .xinitrc -file. If you use xdm(1), the definitions should be early on in the -.I __projectroot__/lib/X11/xdm/Xsession -script. -.SH OPTIONS -.B __xservername__ -supports several mechanisms for supplying/obtaining configuration and -run-time parameters: command line options, environment variables, the -__xconfigfile__(__filemansuffix__) configuration files, auto-detection, and -fallback defaults. When the same information is supplied in more than -one way, the highest precedence mechanism is used. The list of mechanisms -is ordered from highest precedence to lowest. Note that not all parameters -can be supplied via all methods. The available command line options -and environment variables (and some defaults) are described here and in -the Xserver(__appmansuffix__) manual page. Most configuration file -parameters, with their defaults, are described in the -__xconfigfile__(__filemansuffix__) manual page. Driver and module specific -configuration parameters are described in the relevant driver or module -manual page. -.PP -In addition to the normal server options described in the -Xserver(__appmansuffix__) manual page, -.B __xservername__ -accepts the following command line switches: -.TP 8 -.BI vt XX -.I XX -specifies the Virtual Terminal device number which -.B __xservername__ -will use. Without this option, -.B __xservername__ -will pick the first available Virtual Terminal that it can locate. This -option applies only to platforms that have virtual terminal support, such -as Linux, BSD, OpenSolaris, SVR3, and SVR4. -.TP -.B \-allowMouseOpenFail -Allow the server to start up even if the mouse device can't be opened -or initialised. This is equivalent to the -.B AllowMouseOpenFail -__xconfigfile__(__filemansuffix__) file option. -.TP 8 -.B \-allowNonLocalXvidtune -Make the VidMode extension available to remote clients. This allows -the xvidtune client to connect from another host. This is equivalent -to the -.B AllowNonLocalXvidtune -__xconfigfile__(__filemansuffix__) file option. By default non-local -connections are not allowed. -.TP 8 -.BI \-bgamma " value" -Set the blue gamma correction. -.I value -must be between 0.1 and 10. -The default is 1.0. Not all drivers support this. See also the -.BR \-gamma , -.BR \-rgamma , -and -.B \-ggamma -options. -.TP 8 -.BI \-bpp " n" -No longer supported. Use -.B \-depth -to set the color depth, and use -.B \-fbbpp -if you really need to force a non-default framebuffer (hardware) pixel -format. -.TP 8 -.BI \-config " file" -Read the server configuration from -.IR file . -This option will work for any file when the server is run as root (i.e, -with real-uid 0), or for files relative to a directory in the config -search path for all other users. -.TP 8 -.BI \-configdir " directory" -Read the server configuration files from -.IR directory . -This option will work for any directory when the server is run as root -(i.e, with real-uid 0), or for directories relative to a directory in the -config directory search path for all other users. -.TP 8 -.B \-configure -When this option is specified, the -.B __xservername__ -server loads all video driver modules, probes for available hardware, -and writes out an initial __xconfigfile__(__filemansuffix__) file based on -what was detected. This option currently has some problems on some -platforms, but in most cases it is a good way to bootstrap the -configuration process. This option is only available when the server -is run as root (i.e, with real-uid 0). -.TP 8 -.BI "\-crt /dev/tty" XX -SCO only. This is the same as the -.B vt -option, and is provided for compatibility with the native SCO X server. -.TP 8 -.BI \-depth " n" -Sets the default color depth. Legal values are 1, 4, 8, 15, 16, and -24. Not all drivers support all values. -.TP 8 -.B \-disableVidMode -Disable the parts of the VidMode extension (used by the xvidtune -client) that can be used to change the video modes. This is equivalent -to the -.B DisableVidModeExtension -__xconfigfile__(__filemansuffix__) file option. -.TP 8 -.B \-fbbpp \fIn\fP -Sets the number of framebuffer bits per pixel. You should only set this -if you're sure it's necessary; normally the server can deduce the correct -value from -.B \-depth -above. Useful if you want to run a depth 24 configuration with a 24 -bpp framebuffer rather than the (possibly default) 32 bpp framebuffer -(or vice versa). Legal values are 1, 8, 16, 24, 32. Not all drivers -support all values. -.TP 8 -.B \-flipPixels -Swap the default values for the black and white pixels. -.TP 8 -.BI \-gamma " value" -Set the gamma correction. -.I value -must be between 0.1 and 10. The default is 1.0. This value is applied -equally to the R, G and B values. Those values can be set independently -with the -.BR \-rgamma , -.BR \-bgamma , -and -.B \-ggamma -options. Not all drivers support this. -.TP 8 -.BI \-ggamma " value" -Set the green gamma correction. -.I value -must be between 0.1 and 10. The default is 1.0. Not all drivers support -this. See also the -.BR \-gamma , -.BR \-rgamma , -and -.B \-bgamma -options. -.TP 8 -.B \-ignoreABI -The -.B __xservername__ -server checks the ABI revision levels of each module that it loads. It -will normally refuse to load modules with ABI revisions that are newer -than the server's. This is because such modules might use interfaces -that the server does not have. When this option is specified, mismatches -like this are downgraded from fatal errors to warnings. This option -should be used with care. -.TP 8 -.B \-isolateDevice \fIbus\-id\fP -Restrict device resets to the device at -.IR bus\-id . -The -.I bus\-id -string has the form -.IB bustype : bus : device : function -(e.g., \(oqPCI:1:0:0\(cq). -At present, only isolation of PCI devices is supported; i.e., this option -is ignored if -.I bustype -is anything other than \(oqPCI\(cq. -.TP 8 -.B \-keeptty -Prevent the server from detaching its initial controlling terminal. -This option is only useful when debugging the server. Not all platforms -support (or can use) this option. -.TP 8 -.BI \-keyboard " keyboard-name" -Use the __xconfigfile__(__filemansuffix__) file -.B InputDevice -section called -.I keyboard-name -as the core keyboard. This option is ignored when the -.B Layout -section specifies a core keyboard. In the absence of both a Layout -section and this option, the first relevant -.B InputDevice -section is used for the core keyboard. -.TP 8 -.BI \-layout " layout-name" -Use the __xconfigfile__(__filemansuffix__) file -.B Layout -section called -.IR layout-name . -By default the first -.B Layout -section is used. -.TP 8 -.BI \-logfile " filename" -Use the file called -.I filename -as the -.B __xservername__ -server log file. The default log file is -.BI __logdir__/__xservername__. n .log -on most platforms, where -.I n -is the display number of the -.B __xservername__ -server. The default may be in a different directory on some platforms. -This option is only available when the server is run as root (i.e, with -real-uid 0). -.TP 8 -.BR \-logverbose " [\fIn\fP]" -Sets the verbosity level for information printed to the -.B __xservername__ -server log file. If the -.I n -value isn't supplied, each occurrence of this option increments the log -file verbosity level. When the -.I n -value is supplied, the log file verbosity level is set to that value. -The default log file verbosity level is 3. -.TP 8 -.BI \-modulepath " searchpath" -Set the module search path to -.IR searchpath . -.I searchpath -is a comma separated list of directories to search for -.B __xservername__ -server modules. This option is only available when the server is run -as root (i.e, with real-uid 0). -.TP 8 -.B \-nosilk -Disable Silken Mouse support. -.TP 8 -.B \-pixmap24 -Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel. -The default is usually 32 bits per pixel. There is normally little -reason to use this option. Some client applications don't like this -pixmap format, even though it is a perfectly legal format. This is -equivalent to the -.B Pixmap -__xconfigfile__(__filemansuffix__) file option. -.TP 8 -.B \-pixmap32 -Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel. -This is usually the default. This is equivalent to the -.B Pixmap -__xconfigfile__(__filemansuffix__) file option. -.TP 8 -.BI \-pointer " pointer-name" -Use the __xconfigfile__(__filemansuffix__) file -.B InputDevice -section called -.I pointer-name -as the core pointer. This option is ignored when the -.B Layout -section specifies a core pointer. In the absence of both a Layout -section and this option, the first relevant -.B InputDevice -section is used for the core pointer. -.TP 8 -.B \-quiet -Suppress most informational messages at startup. The verbosity level -is set to zero. -.TP 8 -.BI \-rgamma " value" -Set the red gamma correction. -.I value -must be between 0.1 and 10. The default is 1.0. Not all drivers support -this. See also the -.BR \-gamma , -.BR \-bgamma , -and -.B \-ggamma -options. -.TP 8 -.BI \-screen " screen-name" -Use the __xconfigfile__(__filemansuffix__) file -.B Screen -section called -.IR screen-name . -By default the screens referenced by the default -.B Layout -section are used, or the first -.B Screen -section when there are no -.B Layout -sections. -.TP 8 -.B \-showconfig -This is the same as the -.B \-version -option, and is included for compatibility reasons. It may be removed -in a future release, so the -.B \-version -option should be used instead. -.TP 8 -.B \-showDefaultModulePath -Print out the default module path the server was compiled with. -.TP 8 -.B \-showDefaultLibPath -Print out the path libraries should be installed to. -.TP 8 -.B \-showopts -For each driver module installed, print out the list of options and their -argument types. -.TP 8 -.BI \-weight " nnn" -Set RGB weighting at 16 bpp. The default is 565. This applies only to -those drivers which support 16 bpp. -.TP 8 -.BR \-verbose " [\fIn\fP]" -Sets the verbosity level for information printed on stderr. If the -.I n -value isn't supplied, each occurrence of this option increments the -verbosity level. When the -.I n -value is supplied, the verbosity level is set to that value. The default -verbosity level is 0. -.TP 8 -.B \-version -Print out the server version, patchlevel, release date, the operating -system/platform it was built on, and whether it includes module loader -support. -.SH "KEYBOARD" -.PP -The -.B __xservername__ -server is normally configured to recognize various special combinations -of key presses that instruct the server to perform some action, rather -than just sending the key press event to a client application. These actions -depend on the XKB keymap loaded by a particular keyboard device and may or -may not be available on a given configuration. -.PP -The following key combinations are commonly part of the default XKEYBOARD -keymap. -.TP 8 -.B Ctrl+Alt+Backspace -Immediately kills the server -- no questions asked. It can be disabled by -setting the -.B DontZap -__xconfigfile__(__filemansuffix__) file option to a TRUE value. -.TP 8 -.B Ctrl+Alt+Keypad-Plus -Change video mode to next one specified in the configuration file. -This can be disabled with the -.B DontZoom -__xconfigfile__(__filemansuffix__) file option. -.TP 8 -.B Ctrl+Alt+Keypad-Minus -Change video mode to previous one specified in the configuration file. -This can be disabled with the -.B DontZoom -__xconfigfile__(__filemansuffix__) file option. -.TP 8 -.B Ctrl+Alt+F1...F12 -For systems with virtual terminal support, these keystroke -combinations are used to switch to virtual terminals 1 through 12, -respectively. This can be disabled with the -.B DontVTSwitch -__xconfigfile__(__filemansuffix__) file option. -.SH CONFIGURATION -.B __xservername__ -typically uses a configuration file called -.B __xconfigfile__ -and configuration files with the suffix -.I .conf -in a directory called -.B __xconfigdir__ -for its initial setup. -Refer to the __xconfigfile__(__filemansuffix__) manual page for information -about the format of this file. -.PP -.B __xservername__ -has a mechanism for automatically generating a built-in configuration -at run-time when no -.B __xconfigfile__ -file or -.B __xconfigdir__ -files are present. The current version of this automatic configuration -mechanism works in two ways. -.PP -The first is via enhancements that have made many components of the -.B __xconfigfile__ -file optional. This means that information that can be probed or -reasonably deduced doesn't need to be specified explicitly, greatly -reducing the amount of built-in configuration information that needs to -be generated at run-time. -.PP -The second is to have "safe" fallbacks for most configuration information. -This maximises the likelihood that the -.B __xservername__ -server will start up in some usable configuration even when information -about the specific hardware is not available. -.PP -The automatic configuration support for __xservername__ is work in progress. -It is currently aimed at the most popular hardware and software platforms -supported by __xservername__. Enhancements are planned for future releases. -.SH FILES -The -.B __xservername__ -server config files can be found in a range of locations. These are -documented fully in the __xconfigfile__(__filemansuffix__) manual page. The -most commonly used locations are shown here. -.TP 30 -.B /etc/X11/__xconfigfile__ -Server configuration file. -.TP 30 -.B /etc/X11/__xconfigfile__-4 -Server configuration file. -.TP 30 -.B /etc/__xconfigfile__ -Server configuration file. -.TP 30 -.B __projectroot__/etc/__xconfigfile__ -Server configuration file. -.TP 30 -.B __projectroot__/lib/X11/__xconfigfile__ -Server configuration file. -.TP 30 -.B /etc/X11/__xconfigdir__ -Server configuration directory. -.TP 30 -.B /etc/X11/__xconfigdir__-4 -Server configuration directory. -.TP 30 -.B /etc/__xconfigdir__ -Server configuration directory. -.TP 30 -.B __projectroot__/etc/__xconfigdir__ -Server configuration directory. -.TP 30 -.B __projectroot__/lib/X11/__xconfigdir__ -Server configuration directory. -.TP 30 -.BI __logdir__/__xservername__. n .log -Server log file for display -.IR n . -.TP 30 -.B __projectroot__/bin/\(** -Client binaries. -.TP 30 -.B __projectroot__/include/\(** -Header files. -.TP 30 -.B __projectroot__/lib/\(** -Libraries. -.TP 30 -.B __datadir__/fonts/X11/\(** -Fonts. -.TP 30 -.B __projectroot__/share/X11/XErrorDB -Client error message database. -.TP 30 -.B __projectroot__/lib/X11/app-defaults/\(** -Client resource specifications. -.TP 30 -.B __mandir__/man?/\(** -Manual pages. -.TP 30 -.BI /etc/X n .hosts -Initial access control list for display -.IR n . -.SH "SEE ALSO" -X(__miscmansuffix__), Xserver(__appmansuffix__), xdm(__appmansuffix__), xinit(__appmansuffix__), -__xconfigfile__(__filemansuffix__), xvidtune(__appmansuffix__), -apm(__drivermansuffix__), -ati(__drivermansuffix__), -chips(__drivermansuffix__), -cirrus(__drivermansuffix__), -cyrix(__drivermansuffix__), -fbdev(__drivermansuffix__), -glide(__drivermansuffix__), -glint(__drivermansuffix__), -i128(__drivermansuffix__), -i740(__drivermansuffix__), -imstt(__drivermansuffix__), -intel(__drivermansuffix__), -mga(__drivermansuffix__), -neomagic(__drivermansuffix__), -nsc(__drivermansuffix__), -nv(__drivermansuffix__), -openchrome (__drivermansuffix__), -r128(__drivermansuffix__), -rendition(__drivermansuffix__), -s3virge(__drivermansuffix__), -siliconmotion(__drivermansuffix__), -sis(__drivermansuffix__), -sunbw2(__drivermansuffix__), -suncg14(__drivermansuffix__), -suncg3(__drivermansuffix__), -suncg6(__drivermansuffix__), -sunffb(__drivermansuffix__), -sunleo(__drivermansuffix__), -suntcx(__drivermansuffix__), -tdfx(__drivermansuffix__), -tga(__drivermansuffix__), -trident(__drivermansuffix__), -tseng(__drivermansuffix__), -v4l(__drivermansuffix__), -vesa(__drivermansuffix__), -vmware(__drivermansuffix__), -.br -Web site -.IR . - -.SH AUTHORS -__xservername__ has many contributors world wide. The names of most of them -can be found in the documentation, ChangeLog files in the source tree, -and in the actual source code. -.PP -__xservername__ was originally based on XFree86 4.4rc2. -That was originally based on \fIX386 1.2\fP by Thomas Roell, which -was contributed to the then X Consortium's X11R5 distribution by SGCS. -.PP -__xservername__ is released by the X.Org Foundation. -.PP -The project that became XFree86 was originally founded in 1992 by -David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat. -.PP -XFree86 was later integrated in the then X Consortium's X11R6 release -by a group of dedicated XFree86 developers, including the following: -.PP -.RS 4 -.nf -Stuart Anderson \fIanderson@metrolink.com\fP -Doug Anson \fIdanson@lgc.com\fP -Gertjan Akkerman \fIakkerman@dutiba.twi.tudelft.nl\fP -Mike Bernson \fImike@mbsun.mlb.org\fP -Robin Cutshaw \fIrobin@XFree86.org\fP -David Dawes \fIdawes@XFree86.org\fP -Marc Evans \fImarc@XFree86.org\fP -Pascal Haible \fIhaible@izfm.uni-stuttgart.de\fP -Matthieu Herrb \fIMatthieu.Herrb@laas.fr\fP -Dirk Hohndel \fIhohndel@XFree86.org\fP -David Holland \fIdavidh@use.com\fP -Alan Hourihane \fIalanh@fairlite.demon.co.uk\fP -Jeffrey Hsu \fIhsu@soda.berkeley.edu\fP -Glenn Lai \fIglenn@cs.utexas.edu\fP -Ted Lemon \fImellon@ncd.com\fP -Rich Murphey \fIrich@XFree86.org\fP -Hans Nasten \fInasten@everyware.se\fP -Mark Snitily \fImark@sgcs.com\fP -Randy Terbush \fIrandyt@cse.unl.edu\fP -Jon Tombs \fItombs@XFree86.org\fP -Kees Verstoep \fIversto@cs.vu.nl\fP -Paul Vixie \fIpaul@vix.com\fP -Mark Weaver \fIMark_Weaver@brown.edu\fP -David Wexelblat \fIdwex@XFree86.org\fP -Philip Wheatley \fIPhilip.Wheatley@ColumbiaSC.NCR.COM\fP -Thomas Wolfram \fIwolf@prz.tu-berlin.de\fP -Orest Zborowski \fIorestz@eskimo.com\fP -.fi -.RE -.PP -__xservername__ source is available from the FTP server -\fI\fP, and from the X.Org -server \fI\fP. Documentation and other -information can be found from the X.Org web site -\fI\fP. - -.SH LEGAL -.PP -.B __xservername__ -is copyright software, provided under licenses that permit modification -and redistribution in source and binary form without fee. -.B __xservername__ is copyright by numerous authors and -contributors from around the world. Licensing information can be found -at -.IR . -Refer to the source code for specific copyright notices. -.PP -.B XFree86(TM) -is a trademark of The XFree86 Project, Inc. -.PP -.B X11(TM) -and -.B X Window System(TM) -are trademarks of The Open Group. +.\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH __xservername__ __appmansuffix__ __vendorversion__ +.SH NAME +__xservername__ - X11R7 X server +.SH SYNOPSIS +.B __xservername__ +.RI [\fB:\fP display ] +.RI [ option +.IR ... ] +.SH DESCRIPTION +.B __xservername__ +is a full featured X server that was originally designed for UNIX and +UNIX-like operating systems running on Intel x86 hardware. It now runs +on a wider range of hardware and OS platforms. +.PP +This work was derived by the X.Org Foundation from the XFree86 Project's +.I "XFree86\ 4.4rc2" +release. +The XFree86 release was originally derived from +.I "X386\ 1.2" +by Thomas Roell which was contributed to X11R5 by Snitily Graphics +Consulting Service. +.SH PLATFORMS +.PP +.B __xservername__ +operates under a wide range of operating systems and hardware platforms. +The Intel x86 (IA32) architecture is the most widely supported hardware +platform. Other hardware platforms include Compaq Alpha, Intel IA64, AMD64, +SPARC and PowerPC. The most widely supported operating systems are the +free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD, +OpenBSD, and Solaris. Commercial UNIX operating systems such as +UnixWare are also supported. Other supported operating systems include +GNU Hurd. Darwin and Mac OS X are supported with the +XDarwin(__appmansuffix__) X server. Win32/Cygwin is supported with the +XWin(__appmansuffix__) X server. +.PP +.SH "NETWORK CONNECTIONS" +.B __xservername__ +supports connections made using the following reliable +byte-streams: +.TP 4 +.I "Local" +On most platforms, the "Local" connection type is a UNIX-domain socket. +On some System V platforms, the "local" connection types also include +STREAMS pipes, named pipes, and some other mechanisms. +.TP 4 +.I TCP\/IP +.B __xservername__ +listens on port +.RI 6000+ n , +where +.I n +is the display number. This connection type can be disabled with the +.B \-nolisten +option (see the Xserver(1) man page for details). +.SH "ENVIRONMENT VARIABLES" +For operating systems that support local connections other than Unix +Domain sockets (SVR3 and SVR4), there is a compiled-in list specifying +the order in which local connections should be attempted. This list +can be overridden by the +.I XLOCAL +environment variable described below. If the display name indicates a +best-choice connection should be made (e.g. +.BR :0.0 ), +each connection mechanism is tried until a connection succeeds or no +more mechanisms are available. Note: for these OSs, the Unix Domain +socket connection is treated differently from the other local connection +types. To use it the connection must be made to +.BR unix:0.0 . +.PP +The +.I XLOCAL +environment variable should contain a list of one more +more of the following: +.PP +.RS 8 +.nf +NAMED +PTS +SCO +ISC +.fi +.RE +.PP +which represent SVR4 Named Streams pipe, Old-style USL Streams pipe, +SCO XSight Streams pipe, and ISC Streams pipe, respectively. You can +select a single mechanism (e.g. +.IR XLOCAL=NAMED ), +or an ordered list (e.g. \fIXLOCAL="NAMED:PTS:SCO"\fP). +his variable overrides the compiled-in defaults. For SVR4 it is +recommended that +.I NAMED +be the first preference connection. The default setting is +.IR PTS:NAMED:ISC:SCO . +.PP +To globally override the compiled-in defaults, you should define (and +export if using +.B sh +or +.BR ksh ) +.I XLOCAL +globally. If you use startx(1) or xinit(1), the definition should be +at the top of your +.I .xinitrc +file. If you use xdm(1), the definitions should be early on in the +.I __projectroot__/lib/X11/xdm/Xsession +script. +.SH OPTIONS +.B __xservername__ +supports several mechanisms for supplying/obtaining configuration and +run-time parameters: command line options, environment variables, the +__xconfigfile__(__filemansuffix__) configuration files, auto-detection, and +fallback defaults. When the same information is supplied in more than +one way, the highest precedence mechanism is used. The list of mechanisms +is ordered from highest precedence to lowest. Note that not all parameters +can be supplied via all methods. The available command line options +and environment variables (and some defaults) are described here and in +the Xserver(__appmansuffix__) manual page. Most configuration file +parameters, with their defaults, are described in the +__xconfigfile__(__filemansuffix__) manual page. Driver and module specific +configuration parameters are described in the relevant driver or module +manual page. +.PP +In addition to the normal server options described in the +Xserver(__appmansuffix__) manual page, +.B __xservername__ +accepts the following command line switches: +.TP 8 +.BI vt XX +.I XX +specifies the Virtual Terminal device number which +.B __xservername__ +will use. Without this option, +.B __xservername__ +will pick the first available Virtual Terminal that it can locate. This +option applies only to platforms that have virtual terminal support, such +as Linux, BSD, OpenSolaris, SVR3, and SVR4. +.TP +.B \-allowMouseOpenFail +Allow the server to start up even if the mouse device can't be opened +or initialised. This is equivalent to the +.B AllowMouseOpenFail +__xconfigfile__(__filemansuffix__) file option. +.TP 8 +.B \-allowNonLocalXvidtune +Make the VidMode extension available to remote clients. This allows +the xvidtune client to connect from another host. This is equivalent +to the +.B AllowNonLocalXvidtune +__xconfigfile__(__filemansuffix__) file option. By default non-local +connections are not allowed. +.TP 8 +.BI \-bgamma " value" +Set the blue gamma correction. +.I value +must be between 0.1 and 10. +The default is 1.0. Not all drivers support this. See also the +.BR \-gamma , +.BR \-rgamma , +and +.B \-ggamma +options. +.TP 8 +.BI \-bpp " n" +No longer supported. Use +.B \-depth +to set the color depth, and use +.B \-fbbpp +if you really need to force a non-default framebuffer (hardware) pixel +format. +.TP 8 +.BI \-config " file" +Read the server configuration from +.IR file . +This option will work for any file when the server is run as root (i.e, +with real-uid 0), or for files relative to a directory in the config +search path for all other users. +.TP 8 +.BI \-configdir " directory" +Read the server configuration files from +.IR directory . +This option will work for any directory when the server is run as root +(i.e, with real-uid 0), or for directories relative to a directory in the +config directory search path for all other users. +.TP 8 +.B \-configure +When this option is specified, the +.B __xservername__ +server loads all video driver modules, probes for available hardware, +and writes out an initial __xconfigfile__(__filemansuffix__) file based on +what was detected. This option currently has some problems on some +platforms, but in most cases it is a good way to bootstrap the +configuration process. This option is only available when the server +is run as root (i.e, with real-uid 0). +.TP 8 +.BI "\-crt /dev/tty" XX +SCO only. This is the same as the +.B vt +option, and is provided for compatibility with the native SCO X server. +.TP 8 +.BI \-depth " n" +Sets the default color depth. Legal values are 1, 4, 8, 15, 16, and +24. Not all drivers support all values. +.TP 8 +.B \-disableVidMode +Disable the parts of the VidMode extension (used by the xvidtune +client) that can be used to change the video modes. This is equivalent +to the +.B DisableVidModeExtension +__xconfigfile__(__filemansuffix__) file option. +.TP 8 +.B \-fbbpp \fIn\fP +Sets the number of framebuffer bits per pixel. You should only set this +if you're sure it's necessary; normally the server can deduce the correct +value from +.B \-depth +above. Useful if you want to run a depth 24 configuration with a 24 +bpp framebuffer rather than the (possibly default) 32 bpp framebuffer +(or vice versa). Legal values are 1, 8, 16, 24, 32. Not all drivers +support all values. +.TP 8 +.B \-flipPixels +Swap the default values for the black and white pixels. +.TP 8 +.BI \-gamma " value" +Set the gamma correction. +.I value +must be between 0.1 and 10. The default is 1.0. This value is applied +equally to the R, G and B values. Those values can be set independently +with the +.BR \-rgamma , +.BR \-bgamma , +and +.B \-ggamma +options. Not all drivers support this. +.TP 8 +.BI \-ggamma " value" +Set the green gamma correction. +.I value +must be between 0.1 and 10. The default is 1.0. Not all drivers support +this. See also the +.BR \-gamma , +.BR \-rgamma , +and +.B \-bgamma +options. +.TP 8 +.B \-ignoreABI +The +.B __xservername__ +server checks the ABI revision levels of each module that it loads. It +will normally refuse to load modules with ABI revisions that are newer +than the server's. This is because such modules might use interfaces +that the server does not have. When this option is specified, mismatches +like this are downgraded from fatal errors to warnings. This option +should be used with care. +.TP 8 +.B \-isolateDevice \fIbus\-id\fP +Restrict device resets to the device at +.IR bus\-id . +The +.I bus\-id +string has the form +.IB bustype : bus : device : function +(e.g., \(oqPCI:1:0:0\(cq). +At present, only isolation of PCI devices is supported; i.e., this option +is ignored if +.I bustype +is anything other than \(oqPCI\(cq. +.TP 8 +.B \-keeptty +Prevent the server from detaching its initial controlling terminal. +This option is only useful when debugging the server. Not all platforms +support (or can use) this option. +.TP 8 +.BI \-keyboard " keyboard-name" +Use the __xconfigfile__(__filemansuffix__) file +.B InputDevice +section called +.I keyboard-name +as the core keyboard. This option is ignored when the +.B Layout +section specifies a core keyboard. In the absence of both a Layout +section and this option, the first relevant +.B InputDevice +section is used for the core keyboard. +.TP 8 +.BI \-layout " layout-name" +Use the __xconfigfile__(__filemansuffix__) file +.B Layout +section called +.IR layout-name . +By default the first +.B Layout +section is used. +.TP 8 +.BI \-logfile " filename" +Use the file called +.I filename +as the +.B __xservername__ +server log file. The default log file is +.BI __logdir__/__xservername__. n .log +on most platforms, where +.I n +is the display number of the +.B __xservername__ +server. The default may be in a different directory on some platforms. +This option is only available when the server is run as root (i.e, with +real-uid 0). +.TP 8 +.BR \-logverbose " [\fIn\fP]" +Sets the verbosity level for information printed to the +.B __xservername__ +server log file. If the +.I n +value isn't supplied, each occurrence of this option increments the log +file verbosity level. When the +.I n +value is supplied, the log file verbosity level is set to that value. +The default log file verbosity level is 3. +.TP 8 +.BI \-modulepath " searchpath" +Set the module search path to +.IR searchpath . +.I searchpath +is a comma separated list of directories to search for +.B __xservername__ +server modules. This option is only available when the server is run +as root (i.e, with real-uid 0). +.TP 8 +.B \-nosilk +Disable Silken Mouse support. +.TP 8 +.B \-pixmap24 +Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel. +The default is usually 32 bits per pixel. There is normally little +reason to use this option. Some client applications don't like this +pixmap format, even though it is a perfectly legal format. This is +equivalent to the +.B Pixmap +__xconfigfile__(__filemansuffix__) file option. +.TP 8 +.B \-pixmap32 +Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel. +This is usually the default. This is equivalent to the +.B Pixmap +__xconfigfile__(__filemansuffix__) file option. +.TP 8 +.BI \-pointer " pointer-name" +Use the __xconfigfile__(__filemansuffix__) file +.B InputDevice +section called +.I pointer-name +as the core pointer. This option is ignored when the +.B Layout +section specifies a core pointer. In the absence of both a Layout +section and this option, the first relevant +.B InputDevice +section is used for the core pointer. +.TP 8 +.B \-quiet +Suppress most informational messages at startup. The verbosity level +is set to zero. +.TP 8 +.BI \-rgamma " value" +Set the red gamma correction. +.I value +must be between 0.1 and 10. The default is 1.0. Not all drivers support +this. See also the +.BR \-gamma , +.BR \-bgamma , +and +.B \-ggamma +options. +.TP 8 +.BI \-screen " screen-name" +Use the __xconfigfile__(__filemansuffix__) file +.B Screen +section called +.IR screen-name . +By default the screens referenced by the default +.B Layout +section are used, or the first +.B Screen +section when there are no +.B Layout +sections. +.TP 8 +.B \-showconfig +This is the same as the +.B \-version +option, and is included for compatibility reasons. It may be removed +in a future release, so the +.B \-version +option should be used instead. +.TP 8 +.B \-showDefaultModulePath +Print out the default module path the server was compiled with. +.TP 8 +.B \-showDefaultLibPath +Print out the path libraries should be installed to. +.TP 8 +.B \-showopts +For each driver module installed, print out the list of options and their +argument types. +.TP 8 +.BI \-weight " nnn" +Set RGB weighting at 16 bpp. The default is 565. This applies only to +those drivers which support 16 bpp. +.TP 8 +.BR \-verbose " [\fIn\fP]" +Sets the verbosity level for information printed on stderr. If the +.I n +value isn't supplied, each occurrence of this option increments the +verbosity level. When the +.I n +value is supplied, the verbosity level is set to that value. The default +verbosity level is 0. +.TP 8 +.B \-version +Print out the server version, patchlevel, release date, the operating +system/platform it was built on, and whether it includes module loader +support. +.SH "KEYBOARD" +.PP +The +.B __xservername__ +server is normally configured to recognize various special combinations +of key presses that instruct the server to perform some action, rather +than just sending the key press event to a client application. These actions +depend on the XKB keymap loaded by a particular keyboard device and may or +may not be available on a given configuration. +.PP +The following key combinations are commonly part of the default XKEYBOARD +keymap. +.TP 8 +.B Ctrl+Alt+Backspace +Immediately kills the server -- no questions asked. It can be disabled by +setting the +.B DontZap +__xconfigfile__(__filemansuffix__) file option to a TRUE value. +.PP +.RS 8 +It should be noted that zapping is triggered by the +.B Terminate_Server +action in the keyboard map. This action is not part of the default keymaps +but can be enabled with the XKB option +.B \*qterminate:ctrl_alt_bksp\*q. +.RE +.TP 8 +.B Ctrl+Alt+Keypad-Plus +Change video mode to next one specified in the configuration file. +This can be disabled with the +.B DontZoom +__xconfigfile__(__filemansuffix__) file option. +.TP 8 +.B Ctrl+Alt+Keypad-Minus +Change video mode to previous one specified in the configuration file. +This can be disabled with the +.B DontZoom +__xconfigfile__(__filemansuffix__) file option. +.TP 8 +.B Ctrl+Alt+F1...F12 +For systems with virtual terminal support, these keystroke +combinations are used to switch to virtual terminals 1 through 12, +respectively. This can be disabled with the +.B DontVTSwitch +__xconfigfile__(__filemansuffix__) file option. +.SH CONFIGURATION +.B __xservername__ +typically uses a configuration file called +.B __xconfigfile__ +and configuration files with the suffix +.I .conf +in a directory called +.B __xconfigdir__ +for its initial setup. +Refer to the __xconfigfile__(__filemansuffix__) manual page for information +about the format of this file. +.PP +.B __xservername__ +has a mechanism for automatically generating a built-in configuration +at run-time when no +.B __xconfigfile__ +file or +.B __xconfigdir__ +files are present. The current version of this automatic configuration +mechanism works in two ways. +.PP +The first is via enhancements that have made many components of the +.B __xconfigfile__ +file optional. This means that information that can be probed or +reasonably deduced doesn't need to be specified explicitly, greatly +reducing the amount of built-in configuration information that needs to +be generated at run-time. +.PP +The second is to have "safe" fallbacks for most configuration information. +This maximises the likelihood that the +.B __xservername__ +server will start up in some usable configuration even when information +about the specific hardware is not available. +.PP +The automatic configuration support for __xservername__ is work in progress. +It is currently aimed at the most popular hardware and software platforms +supported by __xservername__. Enhancements are planned for future releases. +.SH FILES +The +.B __xservername__ +server config files can be found in a range of locations. These are +documented fully in the __xconfigfile__(__filemansuffix__) manual page. The +most commonly used locations are shown here. +.TP 30 +.B /etc/X11/__xconfigfile__ +Server configuration file. +.TP 30 +.B /etc/X11/__xconfigfile__-4 +Server configuration file. +.TP 30 +.B /etc/__xconfigfile__ +Server configuration file. +.TP 30 +.B __projectroot__/etc/__xconfigfile__ +Server configuration file. +.TP 30 +.B __projectroot__/lib/X11/__xconfigfile__ +Server configuration file. +.TP 30 +.B /etc/X11/__xconfigdir__ +Server configuration directory. +.TP 30 +.B /etc/X11/__xconfigdir__-4 +Server configuration directory. +.TP 30 +.B /etc/__xconfigdir__ +Server configuration directory. +.TP 30 +.B __projectroot__/etc/__xconfigdir__ +Server configuration directory. +.TP 30 +.B __projectroot__/lib/X11/__xconfigdir__ +Server configuration directory. +.TP 30 +.BI __logdir__/__xservername__. n .log +Server log file for display +.IR n . +.TP 30 +.B __projectroot__/bin/\(** +Client binaries. +.TP 30 +.B __projectroot__/include/\(** +Header files. +.TP 30 +.B __projectroot__/lib/\(** +Libraries. +.TP 30 +.B __datadir__/fonts/X11/\(** +Fonts. +.TP 30 +.B __projectroot__/share/X11/XErrorDB +Client error message database. +.TP 30 +.B __projectroot__/lib/X11/app-defaults/\(** +Client resource specifications. +.TP 30 +.B __mandir__/man?/\(** +Manual pages. +.TP 30 +.BI /etc/X n .hosts +Initial access control list for display +.IR n . +.SH "SEE ALSO" +X(__miscmansuffix__), Xserver(__appmansuffix__), xdm(__appmansuffix__), xinit(__appmansuffix__), +__xconfigfile__(__filemansuffix__), xvidtune(__appmansuffix__), +apm(__drivermansuffix__), +ati(__drivermansuffix__), +chips(__drivermansuffix__), +cirrus(__drivermansuffix__), +cyrix(__drivermansuffix__), +fbdev(__drivermansuffix__), +glide(__drivermansuffix__), +glint(__drivermansuffix__), +i128(__drivermansuffix__), +i740(__drivermansuffix__), +imstt(__drivermansuffix__), +intel(__drivermansuffix__), +mga(__drivermansuffix__), +neomagic(__drivermansuffix__), +nsc(__drivermansuffix__), +nv(__drivermansuffix__), +openchrome (__drivermansuffix__), +r128(__drivermansuffix__), +rendition(__drivermansuffix__), +s3virge(__drivermansuffix__), +siliconmotion(__drivermansuffix__), +sis(__drivermansuffix__), +sunbw2(__drivermansuffix__), +suncg14(__drivermansuffix__), +suncg3(__drivermansuffix__), +suncg6(__drivermansuffix__), +sunffb(__drivermansuffix__), +sunleo(__drivermansuffix__), +suntcx(__drivermansuffix__), +tdfx(__drivermansuffix__), +tga(__drivermansuffix__), +trident(__drivermansuffix__), +tseng(__drivermansuffix__), +v4l(__drivermansuffix__), +vesa(__drivermansuffix__), +vmware(__drivermansuffix__), +.br +Web site +.IR . + +.SH AUTHORS +__xservername__ has many contributors world wide. The names of most of them +can be found in the documentation, ChangeLog files in the source tree, +and in the actual source code. +.PP +__xservername__ was originally based on XFree86 4.4rc2. +That was originally based on \fIX386 1.2\fP by Thomas Roell, which +was contributed to the then X Consortium's X11R5 distribution by SGCS. +.PP +__xservername__ is released by the X.Org Foundation. +.PP +The project that became XFree86 was originally founded in 1992 by +David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat. +.PP +XFree86 was later integrated in the then X Consortium's X11R6 release +by a group of dedicated XFree86 developers, including the following: +.PP +.RS 4 +.nf +Stuart Anderson \fIanderson@metrolink.com\fP +Doug Anson \fIdanson@lgc.com\fP +Gertjan Akkerman \fIakkerman@dutiba.twi.tudelft.nl\fP +Mike Bernson \fImike@mbsun.mlb.org\fP +Robin Cutshaw \fIrobin@XFree86.org\fP +David Dawes \fIdawes@XFree86.org\fP +Marc Evans \fImarc@XFree86.org\fP +Pascal Haible \fIhaible@izfm.uni-stuttgart.de\fP +Matthieu Herrb \fIMatthieu.Herrb@laas.fr\fP +Dirk Hohndel \fIhohndel@XFree86.org\fP +David Holland \fIdavidh@use.com\fP +Alan Hourihane \fIalanh@fairlite.demon.co.uk\fP +Jeffrey Hsu \fIhsu@soda.berkeley.edu\fP +Glenn Lai \fIglenn@cs.utexas.edu\fP +Ted Lemon \fImellon@ncd.com\fP +Rich Murphey \fIrich@XFree86.org\fP +Hans Nasten \fInasten@everyware.se\fP +Mark Snitily \fImark@sgcs.com\fP +Randy Terbush \fIrandyt@cse.unl.edu\fP +Jon Tombs \fItombs@XFree86.org\fP +Kees Verstoep \fIversto@cs.vu.nl\fP +Paul Vixie \fIpaul@vix.com\fP +Mark Weaver \fIMark_Weaver@brown.edu\fP +David Wexelblat \fIdwex@XFree86.org\fP +Philip Wheatley \fIPhilip.Wheatley@ColumbiaSC.NCR.COM\fP +Thomas Wolfram \fIwolf@prz.tu-berlin.de\fP +Orest Zborowski \fIorestz@eskimo.com\fP +.fi +.RE +.PP +__xservername__ source is available from the FTP server +\fI\fP, and from the X.Org +server \fI\fP. Documentation and other +information can be found from the X.Org web site +\fI\fP. + +.SH LEGAL +.PP +.B __xservername__ +is copyright software, provided under licenses that permit modification +and redistribution in source and binary form without fee. +.B __xservername__ is copyright by numerous authors and +contributors from around the world. Licensing information can be found +at +.IR . +Refer to the source code for specific copyright notices. +.PP +.B XFree86(TM) +is a trademark of The XFree86 Project, Inc. +.PP +.B X11(TM) +and +.B X Window System(TM) +are trademarks of The Open Group. diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c index 3f7391d50..1b0702644 100644 --- a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c +++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c @@ -16,24 +16,11 @@ #include "fbdevhw.h" #include "fbpriv.h" - -#define PAGE_MASK (~(getpagesize() - 1)) - #include "globals.h" #include -#define DEBUG 0 - #define PAGE_MASK (~(getpagesize() - 1)) -#if DEBUG -# define TRACE_ENTER(str) ErrorF("fbdevHW: " str " %d\n",pScrn->scrnIndex) -#else -# define TRACE_ENTER(str) -#endif - -/* -------------------------------------------------------------------- */ - static MODULESETUPPROTO(fbdevhwSetup); static XF86ModuleVersionInfo fbdevHWVersRec = @@ -96,12 +83,6 @@ typedef struct { /* saved video mode */ struct fb_var_screeninfo saved_var; - /* FIXME: unused??? [geert] */ - struct fb_cmap saved_cmap; - unsigned short *saved_red; - unsigned short *saved_green; - unsigned short *saved_blue; - /* buildin video mode */ DisplayModeRec buildin; @@ -445,8 +426,6 @@ fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device * pPci, char *device) { fbdevHWPtr fPtr; - TRACE_ENTER("Init"); - fbdevHWGetRec(pScrn); fPtr = FBDEVHWPTR(pScrn); @@ -541,8 +520,6 @@ fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); struct fb_var_screeninfo req_var = fPtr->var, set_var; - - TRACE_ENTER("SetMode"); xfree2fbdev_fblayout(pScrn, &req_var); xfree2fbdev_timing(mode, &req_var); @@ -586,7 +563,6 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn) char **modename; DisplayModePtr mode,this,last = pScrn->modes; - TRACE_ENTER("VerifyModes"); if (NULL == pScrn->display->modes) return; @@ -643,7 +619,6 @@ fbdevHWUseBuildinMode(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("UseBuildinMode"); pScrn->modes = &fPtr->buildin; pScrn->virtualX = pScrn->display->virtualX; pScrn->virtualY = pScrn->display->virtualY; @@ -669,7 +644,6 @@ fbdevHWMapVidmem(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("MapVidmem"); if (NULL == fPtr->fbmem) { calculateFbmem_len(fPtr); fPtr->fbmem = mmap(NULL, fPtr->fbmem_len, PROT_READ | PROT_WRITE, @@ -695,7 +669,6 @@ fbdevHWLinearOffset(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("LinearOffset"); return fPtr->fboff; } @@ -704,7 +677,6 @@ fbdevHWUnmapVidmem(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("UnmapVidmem"); if (NULL != fPtr->fbmem) { if (-1 == munmap(fPtr->fbmem, fPtr->fbmem_len)) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -721,7 +693,6 @@ fbdevHWMapMMIO(ScrnInfoPtr pScrn) fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("MapMMIO"); if (NULL == fPtr->mmio) { /* tell the kernel not to use accels to speed up console scrolling */ fPtr->var.accel_flags = 0; @@ -752,7 +723,6 @@ fbdevHWUnmapMMIO(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("UnmapMMIO"); if (NULL != fPtr->mmio) { if (-1 == munmap((void *)((unsigned long)fPtr->mmio & PAGE_MASK), fPtr->mmio_len)) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -806,14 +776,11 @@ fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* -------------------------------------------------------------------- */ /* video mode save/restore */ - -/* TODO: colormap */ void fbdevHWSave(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("Save"); if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->saved_var))) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOGET_VSCREENINFO: %s\n", strerror(errno)); @@ -824,7 +791,6 @@ fbdevHWRestore(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("Restore"); if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->saved_var))) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); @@ -842,7 +808,6 @@ fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, unsigned short red,green,blue; int i; - TRACE_ENTER("LoadPalette"); cmap.len = 1; cmap.red = &red; cmap.green = &green; @@ -870,8 +835,6 @@ fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - TRACE_ENTER("ValidMode"); - if (!fbdevHWSetMode(pScrn, mode, TRUE)) return MODE_BAD; @@ -883,7 +846,6 @@ fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - TRACE_ENTER("SwitchMode"); if (!fbdevHWSetMode(pScrn, mode, FALSE)) return FALSE; @@ -897,7 +859,6 @@ fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); - TRACE_ENTER("AdjustFrame"); if ( x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual || y < 0 || y + fPtr->var.yres > fPtr->var.yres_virtual ) return; @@ -914,7 +875,6 @@ fbdevHWEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - TRACE_ENTER("EnterVT"); if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; fbdevHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -926,7 +886,6 @@ fbdevHWLeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - TRACE_ENTER("LeaveVT"); fbdevHWRestore(pScrn); } @@ -936,7 +895,6 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); unsigned long fbmode; - TRACE_ENTER("DPMSSet"); if (!pScrn->vtSema) return; @@ -969,7 +927,6 @@ fbdevHWSaveScreen(ScreenPtr pScreen, int mode) fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); unsigned long unblank; - TRACE_ENTER("HWSaveScreen"); if (!pScrn->vtSema) return TRUE; diff --git a/xorg-server/hw/xfree86/loader/loader.c b/xorg-server/hw/xfree86/loader/loader.c index 6a4c08916..7ea934a89 100644 --- a/xorg-server/hw/xfree86/loader/loader.c +++ b/xorg-server/hw/xfree86/loader/loader.c @@ -1,321 +1,319 @@ -/* - * Copyright 1995-1998 by Metro Link, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Metro Link, Inc. not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Metro Link, Inc. makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#if defined(UseMMAP) || (defined(linux) && defined(__ia64__)) -#include -#endif -#include -#include -#include -#include -#if defined(linux) && \ - (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \ - || defined(__amd64__)) -#include -#endif -#include - -#include "os.h" -#include "loader.h" -#include "loaderProcs.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "compiler.h" - -extern void *xorg_symbols[]; - -#define MAX_HANDLE 256 -static int refCount[MAX_HANDLE]; - -static int moduleseq = 0; - -/* Prototypes for static functions. */ -static loaderPtr listHead = NULL; - -static loaderPtr -_LoaderListPush(void) -{ - loaderPtr item = calloc(1, sizeof(struct _loader)); - - item->next = listHead; - listHead = item; - - return item; -} - -static loaderPtr -_LoaderListPop(int handle) -{ - loaderPtr item = listHead; - loaderPtr *bptr = &listHead; /* pointer to previous node */ - - while (item) { - if (item->handle == handle) { - *bptr = item->next; /* remove this from the list */ - return item; - } - bptr = &(item->next); - item = item->next; - } - - return 0; -} - -void -LoaderInit(void) -{ - xf86MsgVerb(X_INFO, 2, "Loader magic: %p\n", (void *)xorg_symbols); - xf86MsgVerb(X_INFO, 2, "Module ABI versions:\n"); - xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC, - GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion), - GET_ABI_MINOR(LoaderVersionInfo.ansicVersion)); - xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV, - GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion), - GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion)); - xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT, - GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion), - GET_ABI_MINOR(LoaderVersionInfo.xinputVersion)); - xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION, - GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion), - GET_ABI_MINOR(LoaderVersionInfo.extensionVersion)); - -#if defined(__UNIXWARE__) && !defined(__GNUC__) - /* For UnixWare we need to load the C Runtime libraries which are - * normally auto-linked by the compiler. Otherwise we are bound to - * see unresolved symbols when trying to use the type "long long". - * Obviously, this does not apply if the GNU C compiler is used. - */ - { - int errmaj, errmin, wasLoaded; /* place holders */ - char *xcrtpath = DEFAULT_MODULE_PATH "/libcrt.a"; - char *uwcrtpath = "/usr/ccs/lib/libcrt.a"; - char *path; - struct stat st; - - if(stat(xcrtpath, &st) < 0) - path = uwcrtpath; /* fallback: try to get libcrt.a from the uccs */ - else - path = xcrtpath; /* get the libcrt.a we compiled with */ - LoaderOpen (path, "libcrt", 0, &errmaj, &errmin, &wasLoaded); - } -#endif -} - -/* Public Interface to the loader. */ - -int -LoaderOpen(const char *module, const char *cname, int handle, - int *errmaj, int *errmin, int *wasLoaded, int flags) -{ - loaderPtr tmp; - int new_handle; - -#if defined(DEBUG) - ErrorF("LoaderOpen(%s)\n", module); -#endif - - /* Is the module already loaded? */ - if (handle >= 0) { - tmp = listHead; - while (tmp) { -#ifdef DEBUGLIST - ErrorF("strcmp(%x(%s),{%x} %x(%s))\n", module, module, - &(tmp->name), tmp->name, tmp->name); -#endif - if (!strcmp(module, tmp->name)) { - refCount[tmp->handle]++; - if (wasLoaded) - *wasLoaded = 1; - xf86MsgVerb(X_INFO, 2, "Reloading %s\n", module); - return tmp->handle; - } - tmp = tmp->next; - } - } - - /* - * OK, it's a new one. Add it. - */ - xf86Msg(X_INFO, "Loading %s\n", module); - if (wasLoaded) - *wasLoaded = 0; - - /* - * Find a free handle. - */ - new_handle = 1; - while (new_handle < MAX_HANDLE && refCount[new_handle]) - new_handle++; - - if (new_handle == MAX_HANDLE) { - xf86Msg(X_ERROR, "Out of loader space\n"); /* XXX */ - if (errmaj) - *errmaj = LDR_NOSPACE; - if (errmin) - *errmin = LDR_NOSPACE; - return -1; - } - - refCount[new_handle] = 1; - - tmp = _LoaderListPush(); - tmp->name = malloc(strlen(module) + 1); - strcpy(tmp->name, module); - tmp->cname = malloc(strlen(cname) + 1); - strcpy(tmp->cname, cname); - tmp->handle = new_handle; - tmp->module = moduleseq++; - - if ((tmp->private = DLLoadModule(tmp, flags)) == NULL) { - xf86Msg(X_ERROR, "Failed to load %s\n", module); - _LoaderListPop(new_handle); - refCount[new_handle] = 0; - if (errmaj) - *errmaj = LDR_NOLOAD; - if (errmin) - *errmin = LDR_NOLOAD; - return -1; - } - - return new_handle; -} - -int -LoaderHandleOpen(int handle) -{ - if (handle < 0 || handle >= MAX_HANDLE) - return -1; - - if (!refCount[handle]) - return -1; - - refCount[handle]++; - return handle; -} - -void * -LoaderSymbol(const char *sym) -{ - return (DLFindSymbol(sym)); -} - -int -LoaderUnload(int handle) -{ - loaderRec fakeHead; - loaderPtr tmp = &fakeHead; - - if (handle < 0 || handle >= MAX_HANDLE) - return -1; - - /* - * check the reference count, only free it if it goes to zero - */ - if (--refCount[handle]) - return 0; - /* - * find the loaderRecs associated with this handle. - */ - - while ((tmp = _LoaderListPop(handle)) != NULL) { - xf86Msg(X_INFO, "Unloading %s\n", tmp->name); - DLUnloadModule(tmp->private); - free(tmp->name); - free(tmp->cname); - free(tmp); - } - - return 0; -} - -unsigned long LoaderOptions = 0; - -void -LoaderSetOptions(unsigned long opts) -{ - LoaderOptions |= opts; -} - -Bool -LoaderShouldIgnoreABI(void) -{ - return (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) != 0; -} - -int -LoaderGetABIVersion(const char *abiclass) -{ - struct { - const char *name; - int version; - } classes[] = { - { ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion }, - { ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion }, - { ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion }, - { ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion }, - { ABI_CLASS_FONT, LoaderVersionInfo.fontVersion }, - { NULL, 0 } - }; - int i; - - for(i = 0; classes[i].name; i++) { - if(!strcmp(classes[i].name, abiclass)) { - return classes[i].version; - } - } - - return 0; -} +/* + * Copyright 1995-1998 by Metro Link, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Metro Link, Inc. not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Metro Link, Inc. makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* + * Copyright (c) 1997-2003 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#if defined(UseMMAP) || (defined(linux) && defined(__ia64__)) +#include +#endif +#include +#include +#include +#include +#if defined(linux) && \ + (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \ + || defined(__amd64__)) +#include +#endif +#include + +#include "os.h" +#include "loader.h" +#include "loaderProcs.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "compiler.h" + +extern void *xorg_symbols[]; + +#define MAX_HANDLE 256 +static int refCount[MAX_HANDLE]; + +static int moduleseq = 0; + +/* Prototypes for static functions. */ +static loaderPtr listHead = NULL; + +static loaderPtr +_LoaderListPush(void) +{ + loaderPtr item = calloc(1, sizeof(struct _loader)); + + item->next = listHead; + listHead = item; + + return item; +} + +static loaderPtr +_LoaderListPop(int handle) +{ + loaderPtr item = listHead; + loaderPtr *bptr = &listHead; /* pointer to previous node */ + + while (item) { + if (item->handle == handle) { + *bptr = item->next; /* remove this from the list */ + return item; + } + bptr = &(item->next); + item = item->next; + } + + return 0; +} + +void +LoaderInit(void) +{ + xf86MsgVerb(X_INFO, 2, "Loader magic: %p\n", (void *)xorg_symbols); + xf86MsgVerb(X_INFO, 2, "Module ABI versions:\n"); + xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC, + GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion), + GET_ABI_MINOR(LoaderVersionInfo.ansicVersion)); + xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV, + GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion), + GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion)); + xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT, + GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion), + GET_ABI_MINOR(LoaderVersionInfo.xinputVersion)); + xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION, + GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion), + GET_ABI_MINOR(LoaderVersionInfo.extensionVersion)); + +#if defined(__UNIXWARE__) && !defined(__GNUC__) + /* For UnixWare we need to load the C Runtime libraries which are + * normally auto-linked by the compiler. Otherwise we are bound to + * see unresolved symbols when trying to use the type "long long". + * Obviously, this does not apply if the GNU C compiler is used. + */ + { + int errmaj, errmin, wasLoaded; /* place holders */ + char *xcrtpath = DEFAULT_MODULE_PATH "/libcrt.a"; + char *uwcrtpath = "/usr/ccs/lib/libcrt.a"; + char *path; + struct stat st; + + if(stat(xcrtpath, &st) < 0) + path = uwcrtpath; /* fallback: try to get libcrt.a from the uccs */ + else + path = xcrtpath; /* get the libcrt.a we compiled with */ + LoaderOpen (path, "libcrt", 0, &errmaj, &errmin, &wasLoaded); + } +#endif +} + +/* Public Interface to the loader. */ + +int +LoaderOpen(const char *module, const char *cname, int handle, + int *errmaj, int *errmin, int *wasLoaded, int flags) +{ + loaderPtr tmp; + int new_handle; + +#if defined(DEBUG) + ErrorF("LoaderOpen(%s)\n", module); +#endif + + /* Is the module already loaded? */ + if (handle >= 0) { + tmp = listHead; + while (tmp) { +#ifdef DEBUGLIST + ErrorF("strcmp(%x(%s),{%x} %x(%s))\n", module, module, + &(tmp->name), tmp->name, tmp->name); +#endif + if (!strcmp(module, tmp->name)) { + refCount[tmp->handle]++; + if (wasLoaded) + *wasLoaded = 1; + xf86MsgVerb(X_INFO, 2, "Reloading %s\n", module); + return tmp->handle; + } + tmp = tmp->next; + } + } + + /* + * OK, it's a new one. Add it. + */ + xf86Msg(X_INFO, "Loading %s\n", module); + if (wasLoaded) + *wasLoaded = 0; + + /* + * Find a free handle. + */ + new_handle = 1; + while (new_handle < MAX_HANDLE && refCount[new_handle]) + new_handle++; + + if (new_handle == MAX_HANDLE) { + xf86Msg(X_ERROR, "Out of loader space\n"); /* XXX */ + if (errmaj) + *errmaj = LDR_NOSPACE; + if (errmin) + *errmin = LDR_NOSPACE; + return -1; + } + + refCount[new_handle] = 1; + + tmp = _LoaderListPush(); + tmp->name = strdup(module); + tmp->cname = strdup(cname); + tmp->handle = new_handle; + tmp->module = moduleseq++; + + if ((tmp->private = DLLoadModule(tmp, flags)) == NULL) { + xf86Msg(X_ERROR, "Failed to load %s\n", module); + _LoaderListPop(new_handle); + refCount[new_handle] = 0; + if (errmaj) + *errmaj = LDR_NOLOAD; + if (errmin) + *errmin = LDR_NOLOAD; + return -1; + } + + return new_handle; +} + +int +LoaderHandleOpen(int handle) +{ + if (handle < 0 || handle >= MAX_HANDLE) + return -1; + + if (!refCount[handle]) + return -1; + + refCount[handle]++; + return handle; +} + +void * +LoaderSymbol(const char *sym) +{ + return (DLFindSymbol(sym)); +} + +int +LoaderUnload(int handle) +{ + loaderRec fakeHead; + loaderPtr tmp = &fakeHead; + + if (handle < 0 || handle >= MAX_HANDLE) + return -1; + + /* + * check the reference count, only free it if it goes to zero + */ + if (--refCount[handle]) + return 0; + /* + * find the loaderRecs associated with this handle. + */ + + while ((tmp = _LoaderListPop(handle)) != NULL) { + xf86Msg(X_INFO, "Unloading %s\n", tmp->name); + DLUnloadModule(tmp->private); + free(tmp->name); + free(tmp->cname); + free(tmp); + } + + return 0; +} + +unsigned long LoaderOptions = 0; + +void +LoaderSetOptions(unsigned long opts) +{ + LoaderOptions |= opts; +} + +Bool +LoaderShouldIgnoreABI(void) +{ + return (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) != 0; +} + +int +LoaderGetABIVersion(const char *abiclass) +{ + struct { + const char *name; + int version; + } classes[] = { + { ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion }, + { ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion }, + { ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion }, + { ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion }, + { ABI_CLASS_FONT, LoaderVersionInfo.fontVersion }, + { NULL, 0 } + }; + int i; + + for(i = 0; classes[i].name; i++) { + if(!strcmp(classes[i].name, abiclass)) { + return classes[i].version; + } + } + + return 0; +} diff --git a/xorg-server/hw/xfree86/loader/loader.h b/xorg-server/hw/xfree86/loader/loader.h index ac5f99cf5..77267f847 100644 --- a/xorg-server/hw/xfree86/loader/loader.h +++ b/xorg-server/hw/xfree86/loader/loader.h @@ -1,103 +1,97 @@ -/* - * Copyright 1995-1998 by Metro Link, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Metro Link, Inc. not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Metro Link, Inc. makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Copyright (c) 1997-2001 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _LOADER_H -#define _LOADER_H - -#include -#include -#include - -/* LoadModule proc flags; LD_FLAG_GLOBAL adds symbols to global - * namespace, default is to keep symbols local to module. */ -#define LD_FLAG_GLOBAL 1 - -typedef struct _loader *loaderPtr; - -/* Each module loaded has a loaderRec */ -typedef struct _loader { - int handle; /* Unique id used to remove symbols from - * this module when it is unloaded */ - int module; /* Unique id to identify compilation units */ - char *name; - char *cname; - void *private; /* format specific data */ - loaderPtr next; -} loaderRec; - -/* Compiled-in version information */ -typedef struct { - int xf86Version; - int ansicVersion; - int videodrvVersion; - int xinputVersion; - int extensionVersion; - int fontVersion; -} ModuleVersions; -extern const ModuleVersions LoaderVersionInfo; - -extern unsigned long LoaderOptions; - -/* Internal Functions */ -void LoaderDuplicateSymbol(const char *, const int); -char *_LoaderModuleToName(int); -int LoaderOpen(const char *, const char *, int, int *, int *, int *, int); -int LoaderHandleOpen(int); - -/* object to name lookup routines */ -char *_LoaderHandleToName(int handle); -char *_LoaderHandleToCanonicalName(int handle); - -/* Loader backends. */ -#include "dlloader.h" - -#endif /* _LOADER_H */ +/* + * Copyright 1995-1998 by Metro Link, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Metro Link, Inc. not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Metro Link, Inc. makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* + * Copyright (c) 1997-2001 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#ifndef _LOADER_H +#define _LOADER_H + +#include +#include +#include + +/* LoadModule proc flags; LD_FLAG_GLOBAL adds symbols to global + * namespace, default is to keep symbols local to module. */ +#define LD_FLAG_GLOBAL 1 + +typedef struct _loader *loaderPtr; + +/* Each module loaded has a loaderRec */ +typedef struct _loader { + int handle; /* Unique id used to remove symbols from + * this module when it is unloaded */ + int module; /* Unique id to identify compilation units */ + char *name; + char *cname; + void *private; /* format specific data */ + loaderPtr next; +} loaderRec; + +/* Compiled-in version information */ +typedef struct { + int xf86Version; + int ansicVersion; + int videodrvVersion; + int xinputVersion; + int extensionVersion; + int fontVersion; +} ModuleVersions; +extern const ModuleVersions LoaderVersionInfo; + +extern unsigned long LoaderOptions; + +/* Internal Functions */ +int LoaderOpen(const char *, const char *, int, int *, int *, int *, int); +int LoaderHandleOpen(int); + +/* Loader backends. */ +#include "dlloader.h" + +#endif /* _LOADER_H */ diff --git a/xorg-server/hw/xfree86/loader/sdksyms.sh b/xorg-server/hw/xfree86/loader/sdksyms.sh index 13c5ae5f8..6fce0ec2e 100644 --- a/xorg-server/hw/xfree86/loader/sdksyms.sh +++ b/xorg-server/hw/xfree86/loader/sdksyms.sh @@ -1,418 +1,425 @@ -#!/bin/sh - -cat > sdksyms.c << EOF -/* This file is automatically generated by sdksyms.sh. */ -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - - -/* These must be included first */ -#include "misc.h" -#include "miscstruct.h" - - -/* render/Makefile.am */ -#include "picture.h" -#include "mipict.h" -#include "glyphstr.h" -#include "picturestr.h" -#include "renderedge.h" - - -/* fb/Makefile.am -- module */ -/* -#include "fb.h" -#include "fbrop.h" -#include "fboverlay.h" -#include "wfbrename.h" -#include "fbpict.h" - */ - - -/* miext/shadow/Makefile.am -- module */ -/* -#include "shadow.h" - */ - - -/* miext/damage/Makefile.am */ -#include "damage.h" -#include "damagestr.h" - - -/* Xext/Makefile.am -- half is module, half is builtin */ -/* -#include "xvdix.h" -#include "xvmcext.h" - */ -#include "geext.h" -#include "geint.h" -#include "shmint.h" -#if XINERAMA -# include "panoramiXsrv.h" -# include "panoramiX.h" -#endif - - -/* hw/xfree86/int10/Makefile.am -- module */ -/* -#include "xf86int10.h" - */ - - -/* hw/xfree86/i2c/Makefile.am -- "mostly" modules */ -#include "xf86i2c.h" -/* -#include "bt829.h" -#include "fi1236.h" -#include "msp3430.h" -#include "tda8425.h" -#include "tda9850.h" -#include "tda9885.h" -#include "uda1380.h" -#include "i2c_def.h" - */ - - -/* hw/xfree86/modes/Makefile.am */ -#include "xf86Crtc.h" -#include "xf86Modes.h" -#include "xf86RandR12.h" -/* #include "xf86Rename.h" */ - - -/* hw/xfree86/ddc/Makefile.am */ -#include "edid.h" -#include "xf86DDC.h" - - -/* hw/xfree86/dri2/Makefile.am -- module */ -/* -#if DRI2 -# include "dri2.h" -#endif - */ - - -/* hw/xfree86/vgahw/Makefile.am -- module */ -/* -#include "vgaHW.h" - */ - - -/* hw/xfree86/fbdevhw/Makefile.am -- module */ -/* -#include "fbdevhw.h" - */ - - -/* hw/xfree86/common/Makefile.am */ -#include "compiler.h" -#include "fourcc.h" -#include "xf86.h" -#include "xf86Module.h" -#include "xf86Opt.h" -#include "xf86PciInfo.h" -#include "xf86Priv.h" -#include "xf86Privstr.h" -#include "xf86cmap.h" -#include "xf86fbman.h" -#include "xf86str.h" -#include "xf86Xinput.h" -#include "xf86VGAarbiter.h" -#include "xisb.h" -#if XV -# include "xf86xv.h" -# include "xf86xvmc.h" -# include "xf86xvpriv.h" -#endif -/* XF86VidMode code is in libextmod module */ -/* -#if XF86VIDMODE -# include "vidmodeproc.h" -#endif - */ -#include "xorgVersion.h" -#if defined(__sparc__) || defined(__sparc) -# include "xf86sbusBus.h" -#endif - - -/* hw/xfree86/ramdac/Makefile.am */ -#include "BT.h" -#include "IBM.h" -#include "TI.h" -#include "xf86Cursor.h" -#include "xf86RamDac.h" - - -/* hw/xfree86/shadowfb/Makefile.am -- module */ -/* -#include "shadowfb.h" - */ - - -/* hw/xfree86/os-support/solaris/Makefile.am */ -#if defined(sun386) -# include "agpgart.h" -#endif - - -/* hw/xfree86/os-support/Makefile.am */ -#include "xf86_OSproc.h" -#include "xf86_OSlib.h" - - -/* hw/xfree86/os-support/bus/Makefile.am */ -#include "xf86Pci.h" -#if defined(__sparc__) || defined(__sparc) -# include "xf86Sbus.h" -#endif - - -/* hw/xfree86/xaa/Makefile.am -- module */ -/* -#include "xaa.h" -#include "xaalocal.h" -#include "xaarop.h" -#include "xaaWrapper.h" - */ - - -/* hw/xfree86/dixmods/extmod/Makefile.am -- module */ -/* -#include "dgaproc.h" - */ - - -/* hw/xfree86/parser/Makefile.am */ -#include "xf86Parser.h" -#include "xf86Optrec.h" - - -/* hw/xfree86/vbe/Makefile.am -- module */ -/* -#include "vbe.h" -#include "vbeModes.h" - */ - - -/* hw/xfree86/dri/Makefile.am -- module */ -/* -#if XF86DRI -# include "dri.h" -# include "sarea.h" -# include "dristruct.h" -#endif - */ - - -/* hw/xfree86/xf8_16bpp/Makefile.am -- module */ -/* -#include "cfb8_16.h" - */ - - -/* mi/Makefile.am */ -#include "micmap.h" -#include "miline.h" -#include "mipointer.h" -#include "mi.h" -#include "mibstore.h" -#include "migc.h" -#include "mipointrst.h" -#include "mizerarc.h" -#include "micoord.h" -#include "mifillarc.h" -#include "mispans.h" -#include "miwideline.h" -#include "mistruct.h" -#include "mifpoly.h" -#include "mioverlay.h" - - -/* randr/Makefile.am */ -#include "randrstr.h" -#include "rrtransform.h" - - -/* dbe/Makefile.am -- module */ -/* -#include "dbestruct.h" - */ - - -/* exa/Makefile.am -- module */ -/* -#include "exa.h" - */ - - -/* xfixes/Makefile.am */ -#include "xfixes.h" - - -/* include/Makefile.am */ -#include "XIstubs.h" -#include "bstore.h" -#include "bstorestr.h" -#include "closestr.h" -#include "closure.h" -#include "colormap.h" -#include "colormapst.h" -#include "hotplug.h" -#include "cursor.h" -#include "cursorstr.h" -#include "dix.h" -#include "dixaccess.h" -#include "dixevents.h" -#include "dixfont.h" -#include "dixfontstr.h" -#include "dixgrabs.h" -#include "dixstruct.h" -#include "exevents.h" -#include "extension.h" -#include "extinit.h" -#include "extnsionst.h" -#include "gc.h" -#include "gcstruct.h" -#include "globals.h" -#include "input.h" -#include "inputstr.h" -/* already included */ -/* -#include "misc.h" -#include "miscstruct.h" - */ -#include "opaque.h" -#include "os.h" -#include "pixmap.h" -#include "pixmapstr.h" -#include "privates.h" -#include "property.h" -#include "propertyst.h" -#include "ptrveloc.h" -#include "region.h" -#include "regionstr.h" -#include "registry.h" -#include "resource.h" -#include "rgb.h" -#include "screenint.h" -#include "scrnintstr.h" -#include "selection.h" -#include "servermd.h" -#include "site.h" -#include "swaprep.h" -#include "swapreq.h" -#include "validate.h" -#include "window.h" -#include "windowstr.h" -#include "xace.h" -#include "xkbfile.h" -#include "xkbsrv.h" -#include "xkbstr.h" -#include "xkbrules.h" -#include "xserver-properties.h" - -EOF - -topdir=$1 -shift -LC_ALL=C -export LC_ALL -${CPP:-cpp} "$@" -DXorgLoader sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' -BEGIN { - sdk = 0; - print("/*"); - print(" * These symbols are referenced to ensure they"); - print(" * will be available in the X Server binary."); - print(" */"); - printf("/* topdir=%s */\n", topdir); - print("_X_HIDDEN void *xorg_symbols[] = {"); - - printf("sdksyms.c:") > "sdksyms.dep"; -} -/^# [0-9]+ "/ { - # Process text after a include in a relative path or when the - # processed file has a basename matching $top_srcdir. - # Note that indexing starts at 1; 0 means no match, and there - # is a starting ". - sdk = $3 !~ /^"\// || index($3, topdir) == 2; - - if (sdk && $3 ~ /\.h"$/) { - # remove quotes - gsub(/"/, "", $3); - if (! headers[$3]) { - printf(" \\\n %s", $3) >> "sdksyms.dep"; - headers[$3] = 1; - } - } -} - -/^extern[ ]/ { - if (sdk) { - n = 3; - - # skip attribute, if any - while ($n ~ /^(__attribute__|__global)/ || - # skip modifiers, if any - $n ~ /^\*?(unsigned|const|volatile|struct)$/ || - # skip pointer - $n ~ /\*$/) - n++; - - # type specifier may not be set, as in - # extern _X_EXPORT unsigned name(...) - if ($n !~ /[^a-zA-Z0-9_]/) - n++; - - # match - # extern _X_EXPORT type (* name[])(...) - if ($n ~ /^[^a-zA-Z0-9_]+$/) - n++; - - # match - # extern _X_EXPORT const name *const ... - if ($n ~ /^([^a-zA-Z0-9_]+)?const$/) - n++; - - # actual name may be in the next line, as in - # extern _X_EXPORT type - # possibly ending with a * - # name(...) - if ($n == "" || $n ~ /^\*+$/) { - getline; - n = 1; - } - - # dont modify $0 or $n - symbol = $n; - - # remove starting non word chars - sub(/^[^a-zA-Z0-9_]+/, "",symbol); - - # remove from first non word to end of line - sub(/[^a-zA-Z0-9_].*/, "", symbol); - - #print; - printf(" (void *) &%s,\n", symbol); - } -} - -END { - print("};"); - - print("") >> "sdksyms.dep"; -}' > _sdksyms.c - -STATUS=$? - -cat _sdksyms.c >> sdksyms.c -rm _sdksyms.c - -[ $? != 0 ] && exit $? - -exit $STATUS +#!/bin/sh + +cat > sdksyms.c << EOF +/* This file is automatically generated by sdksyms.sh. */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + + +/* These must be included first */ +#include "misc.h" +#include "miscstruct.h" + + +/* render/Makefile.am */ +#include "picture.h" +#include "mipict.h" +#include "glyphstr.h" +#include "picturestr.h" +#include "renderedge.h" + + +/* fb/Makefile.am -- module */ +/* +#include "fb.h" +#include "fbrop.h" +#include "fboverlay.h" +#include "wfbrename.h" +#include "fbpict.h" + */ + + +/* miext/shadow/Makefile.am -- module */ +/* +#include "shadow.h" + */ + + +/* miext/damage/Makefile.am */ +#include "damage.h" +#include "damagestr.h" + + +/* Xext/Makefile.am -- half is module, half is builtin */ +/* +#include "xvdix.h" +#include "xvmcext.h" + */ +#include "geext.h" +#include "geint.h" +#include "shmint.h" +#if XINERAMA +# include "panoramiXsrv.h" +# include "panoramiX.h" +#endif + + +/* hw/xfree86/int10/Makefile.am -- module */ +/* +#include "xf86int10.h" + */ + + +/* hw/xfree86/i2c/Makefile.am -- "mostly" modules */ +#include "xf86i2c.h" +/* +#include "bt829.h" +#include "fi1236.h" +#include "msp3430.h" +#include "tda8425.h" +#include "tda9850.h" +#include "tda9885.h" +#include "uda1380.h" +#include "i2c_def.h" + */ + + +/* hw/xfree86/modes/Makefile.am */ +#include "xf86Crtc.h" +#include "xf86Modes.h" +#include "xf86RandR12.h" +/* #include "xf86Rename.h" */ + + +/* hw/xfree86/ddc/Makefile.am */ +#include "edid.h" +#include "xf86DDC.h" + + +/* hw/xfree86/dri2/Makefile.am -- module */ +/* +#if DRI2 +# include "dri2.h" +#endif + */ + + +/* hw/xfree86/vgahw/Makefile.am -- module */ +/* +#include "vgaHW.h" + */ + + +/* hw/xfree86/fbdevhw/Makefile.am -- module */ +/* +#include "fbdevhw.h" + */ + + +/* hw/xfree86/common/Makefile.am */ +#include "compiler.h" +#include "fourcc.h" +#include "xf86.h" +#include "xf86Module.h" +#include "xf86Opt.h" +#include "xf86PciInfo.h" +#include "xf86Priv.h" +#include "xf86Privstr.h" +#include "xf86cmap.h" +#include "xf86fbman.h" +#include "xf86str.h" +#include "xf86Xinput.h" +#include "xf86VGAarbiter.h" +#include "xisb.h" +#if XV +# include "xf86xv.h" +# include "xf86xvmc.h" +# include "xf86xvpriv.h" +#endif +/* XF86VidMode code is in libextmod module */ +/* +#if XF86VIDMODE +# include "vidmodeproc.h" +#endif + */ +#include "xorgVersion.h" +#if defined(__sparc__) || defined(__sparc) +# include "xf86sbusBus.h" +#endif + + +/* hw/xfree86/ramdac/Makefile.am */ +#include "BT.h" +#include "IBM.h" +#include "TI.h" +#include "xf86Cursor.h" +#include "xf86RamDac.h" + + +/* hw/xfree86/shadowfb/Makefile.am -- module */ +/* +#include "shadowfb.h" + */ + + +/* hw/xfree86/os-support/solaris/Makefile.am */ +#if defined(sun386) +# include "agpgart.h" +#endif + + +/* hw/xfree86/os-support/Makefile.am */ +#include "xf86_OSproc.h" +#include "xf86_OSlib.h" + + +/* hw/xfree86/os-support/bus/Makefile.am */ +#include "xf86Pci.h" +#if defined(__sparc__) || defined(__sparc) +# include "xf86Sbus.h" +#endif + + +/* hw/xfree86/xaa/Makefile.am -- module */ +/* +#include "xaa.h" +#include "xaalocal.h" +#include "xaarop.h" +#include "xaaWrapper.h" + */ + + +/* hw/xfree86/dixmods/extmod/Makefile.am -- module */ +/* +#include "dgaproc.h" + */ + + +/* hw/xfree86/parser/Makefile.am */ +#include "xf86Parser.h" +#include "xf86Optrec.h" + + +/* hw/xfree86/vbe/Makefile.am -- module */ +/* +#include "vbe.h" +#include "vbeModes.h" + */ + + +/* hw/xfree86/dri/Makefile.am -- module */ +/* +#if XF86DRI +# include "dri.h" +# include "sarea.h" +# include "dristruct.h" +#endif + */ + + +/* hw/xfree86/xf8_16bpp/Makefile.am -- module */ +/* +#include "cfb8_16.h" + */ + + +/* mi/Makefile.am */ +#include "micmap.h" +#include "miline.h" +#include "mipointer.h" +#include "mi.h" +#include "mibstore.h" +#include "migc.h" +#include "mipointrst.h" +#include "mizerarc.h" +#include "micoord.h" +#include "mifillarc.h" +#include "mispans.h" +#include "miwideline.h" +#include "mistruct.h" +#include "mifpoly.h" +#include "mioverlay.h" + + +/* randr/Makefile.am */ +#include "randrstr.h" +#include "rrtransform.h" + + +/* dbe/Makefile.am -- module */ +/* +#include "dbestruct.h" + */ + + +/* exa/Makefile.am -- module */ +/* +#include "exa.h" + */ + + +/* xfixes/Makefile.am */ +#include "xfixes.h" + + +/* include/Makefile.am */ +#include "XIstubs.h" +#include "bstore.h" +#include "bstorestr.h" +#include "closestr.h" +#include "closure.h" +#include "colormap.h" +#include "colormapst.h" +#include "hotplug.h" +#include "cursor.h" +#include "cursorstr.h" +#include "dix.h" +#include "dixaccess.h" +#include "dixevents.h" +#include "dixfont.h" +#include "dixfontstr.h" +#include "dixgrabs.h" +#include "dixstruct.h" +#include "exevents.h" +#include "extension.h" +#include "extinit.h" +#include "extnsionst.h" +#include "gc.h" +#include "gcstruct.h" +#include "globals.h" +#include "input.h" +#include "inputstr.h" +/* already included */ +/* +#include "misc.h" +#include "miscstruct.h" + */ +#include "opaque.h" +#include "os.h" +#include "pixmap.h" +#include "pixmapstr.h" +#include "privates.h" +#include "property.h" +#include "propertyst.h" +#include "ptrveloc.h" +#include "region.h" +#include "regionstr.h" +#include "registry.h" +#include "resource.h" +#include "rgb.h" +#include "screenint.h" +#include "scrnintstr.h" +#include "selection.h" +#include "servermd.h" +#include "site.h" +#include "swaprep.h" +#include "swapreq.h" +#include "validate.h" +#include "window.h" +#include "windowstr.h" +#include "xace.h" +#include "xkbfile.h" +#include "xkbsrv.h" +#include "xkbstr.h" +#include "xkbrules.h" +#include "xserver-properties.h" + +EOF + +topdir=$1 +shift +LC_ALL=C +export LC_ALL +${CPP:-cpp} "$@" -DXorgLoader sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' +BEGIN { + sdk = 0; + print("/*"); + print(" * These symbols are referenced to ensure they"); + print(" * will be available in the X Server binary."); + print(" */"); + printf("/* topdir=%s */\n", topdir); + print("_X_HIDDEN void *xorg_symbols[] = {"); + + printf("sdksyms.c:") > "sdksyms.dep"; +} +/^# [0-9]+ "/ { + # Process text after a include in a relative path or when the + # processed file has a basename matching $top_srcdir. + # Note that indexing starts at 1; 0 means no match, and there + # is a starting ". + sdk = $3 !~ /^"\// || index($3, topdir) == 2; + + if (sdk && $3 ~ /\.h"$/) { + # remove quotes + gsub(/"/, "", $3); + line = $2; + header = $3; + if (! headers[$3]) { + printf(" \\\n %s", $3) >> "sdksyms.dep"; + headers[$3] = 1; + } + } + next; +} + +/^extern[ ]/ { + if (sdk) { + n = 3; + + # skip attribute, if any + while ($n ~ /^(__attribute__|__global)/ || + # skip modifiers, if any + $n ~ /^\*?(unsigned|const|volatile|struct)$/ || + # skip pointer + $n ~ /\*$/) + n++; + + # type specifier may not be set, as in + # extern _X_EXPORT unsigned name(...) + if ($n !~ /[^a-zA-Z0-9_]/) + n++; + + # match + # extern _X_EXPORT type (* name[])(...) + if ($n ~ /^[^a-zA-Z0-9_]+$/) + n++; + + # match + # extern _X_EXPORT const name *const ... + if ($n ~ /^([^a-zA-Z0-9_]+)?const$/) + n++; + + # actual name may be in the next line, as in + # extern _X_EXPORT type + # possibly ending with a * + # name(...) + if ($n == "" || $n ~ /^\*+$/) { + getline; + n = 1; + } + + # dont modify $0 or $n + symbol = $n; + + # remove starting non word chars + sub(/^[^a-zA-Z0-9_]+/, "",symbol); + + # remove from first non word to end of line + sub(/[^a-zA-Z0-9_].*/, "", symbol); + + #print; + printf(" (void *) &%-50s /* %s:%s */\n", symbol ",", header, line); + } +} + +{ + line++; +} + +END { + print("};"); + + print("") >> "sdksyms.dep"; +}' > _sdksyms.c + +STATUS=$? + +cat _sdksyms.c >> sdksyms.c +rm _sdksyms.c + +[ $? != 0 ] && exit $? + +exit $STATUS diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c index 722fbb0c1..687483113 100644 --- a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c +++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c @@ -277,8 +277,9 @@ xf86OpenConsole(void) tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); /* need to keep the buffer clean, else the kernel gets angry */ - console_handler = xf86AddGeneralHandler(xf86Info.consoleFd, - drain_console, NULL); + if (xf86Info.allowEmptyInput) + console_handler = xf86AddGeneralHandler(xf86Info.consoleFd, + drain_console, NULL); /* we really should have a InitOSInputDevices() function instead * of Init?$#*&Device(). So I just place it here */ diff --git a/xorg-server/hw/xfree86/parser/Configint.h b/xorg-server/hw/xfree86/parser/Configint.h index 63e510d8f..670c24da5 100644 --- a/xorg-server/hw/xfree86/parser/Configint.h +++ b/xorg-server/hw/xfree86/parser/Configint.h @@ -98,9 +98,6 @@ LexRec, *LexPtr; #define parsePrologue(typeptr,typerec) typeptr ptr; \ if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return NULL; } -#define parsePrologueVoid(typeptr,typerec) int token; typeptr ptr; \ -if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return; } - #define HANDLE_RETURN(f,func)\ if ((ptr->f=func) == NULL)\ {\ @@ -152,10 +149,6 @@ else\ "The %s keyword requires a boolean to follow it." #define ZAXISMAPPING_MSG \ "The ZAxisMapping keyword requires 2 positive numbers or X or Y to follow it." -#define AUTOREPEAT_MSG \ -"The AutoRepeat keyword requires 2 numbers (delay and rate) to follow it." -#define XLEDS_MSG \ -"The XLeds keyword requries one or more numbers to follow it." #define DACSPEED_MSG \ "The DacSpeed keyword must be followed by a list of up to %d numbers." #define DISPLAYSIZE_MSG \ @@ -216,7 +209,5 @@ else\ /* Warning messages */ #define OBSOLETE_MSG \ "Ignoring obsolete keyword \"%s\"." -#define MOVED_TO_FLAGS_MSG \ -"Keyword \"%s\" is now an Option flag in the ServerFlags section." #endif /* _Configint_h_ */ diff --git a/xorg-server/hw/xfree86/parser/Flags.c b/xorg-server/hw/xfree86/parser/Flags.c index b6ffc1538..cdd023222 100644 --- a/xorg-server/hw/xfree86/parser/Flags.c +++ b/xorg-server/hw/xfree86/parser/Flags.c @@ -132,7 +132,6 @@ xf86parseFlagsSection (void) if (ServerFlagsTab[i].token == token) { char *valstr = NULL; - /* can't use strdup because it calls malloc */ tmp = strdup (ServerFlagsTab[i].name); if (hasvalue) { @@ -365,13 +364,8 @@ xf86optionListCreate( const char **options, int count, int used ) } for (i = 0; i < count; i += 2) { - /* can't use strdup because it calls malloc */ - t1 = malloc (sizeof (char) * - (strlen (options[i]) + 1)); - strcpy (t1, options[i]); - t2 = malloc (sizeof (char) * - (strlen (options[i + 1]) + 1)); - strcpy (t2, options[i + 1]); + t1 = strdup(options[i]); + t2 = strdup(options[i + 1]); p = addNewOption2 (p, t1, t2, used); } diff --git a/xorg-server/hw/xfree86/parser/scan.c b/xorg-server/hw/xfree86/parser/scan.c index 99e1288a5..783a42545 100644 --- a/xorg-server/hw/xfree86/parser/scan.c +++ b/xorg-server/hw/xfree86/parser/scan.c @@ -819,6 +819,7 @@ OpenConfigFile(const char *path, const char *cmdline, const char *projroot, } } + free(pathcopy); if (file) { configFiles[numFiles].file = file; configFiles[numFiles].path = strdup(filepath); @@ -927,6 +928,7 @@ OpenConfigDir(const char *path, const char *cmdline, const char *projroot, } } + free(pathcopy); return dirpath; } @@ -1088,8 +1090,7 @@ void xf86setSection (char *section) { free(configSection); - configSection = malloc(strlen (section) + 1); - strcpy (configSection, section); + configSection = strdup(section); } /* diff --git a/xorg-server/hw/xfree86/parser/write.c b/xorg-server/hw/xfree86/parser/write.c index 083203c05..fe51ee7f5 100644 --- a/xorg-server/hw/xfree86/parser/write.c +++ b/xorg-server/hw/xfree86/parser/write.c @@ -1,220 +1,216 @@ -/* - * Copyright (c) 1997 Metro Link Incorporated - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the Metro Link shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Metro Link. - * - */ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -/* View/edit this file with tab stops set to 4 */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Parser.h" -#include "xf86tokens.h" -#include "Configint.h" - -#include -#include -#include -#include -#include - -#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED) -#define HAS_SAVED_IDS_AND_SETEUID -#endif -#if defined(WIN32) -#define HAS_NO_UIDS -#endif - -#ifdef HAS_NO_UIDS -#define doWriteConfigFile xf86writeConfigFile -#define Local /**/ -#else -#define Local static -#endif - -Local int -doWriteConfigFile (const char *filename, XF86ConfigPtr cptr) -{ - FILE *cf; - - if ((cf = fopen (filename, "w")) == NULL) - { - return 0; - } - - if (cptr->conf_comment) - fprintf (cf, "%s\n", cptr->conf_comment); - - xf86printLayoutSection (cf, cptr->conf_layout_lst); - - if (cptr->conf_files != NULL) - { - fprintf (cf, "Section \"Files\"\n"); - xf86printFileSection (cf, cptr->conf_files); - fprintf (cf, "EndSection\n\n"); - } - - if (cptr->conf_modules != NULL) - { - fprintf (cf, "Section \"Module\"\n"); - xf86printModuleSection (cf, cptr->conf_modules); - fprintf (cf, "EndSection\n\n"); - } - - xf86printVendorSection (cf, cptr->conf_vendor_lst); - - xf86printServerFlagsSection (cf, cptr->conf_flags); - - xf86printInputSection (cf, cptr->conf_input_lst); - - xf86printInputClassSection (cf, cptr->conf_inputclass_lst); - - xf86printVideoAdaptorSection (cf, cptr->conf_videoadaptor_lst); - - xf86printModesSection (cf, cptr->conf_modes_lst); - - xf86printMonitorSection (cf, cptr->conf_monitor_lst); - - xf86printDeviceSection (cf, cptr->conf_device_lst); - - xf86printScreenSection (cf, cptr->conf_screen_lst); - - xf86printDRISection (cf, cptr->conf_dri); - - xf86printExtensionsSection (cf, cptr->conf_extensions); - - fclose(cf); - return 1; -} - -#ifndef HAS_NO_UIDS - -int -xf86writeConfigFile (const char *filename, XF86ConfigPtr cptr) -{ - int ret; - -#if !defined(HAS_SAVED_IDS_AND_SETEUID) - int pid, p; - int status; - void (*csig)(int); -#else - int ruid, euid; -#endif - - if (getuid() != geteuid()) - { - -#if !defined(HAS_SAVED_IDS_AND_SETEUID) - /* Need to fork to change ruid without loosing euid */ -#ifdef SIGCHLD - csig = signal(SIGCHLD, SIG_DFL); -#endif - switch ((pid = fork())) - { - case -1: - ErrorF("xf86writeConfigFile(): fork failed (%s)\n", - strerror(errno)); - return 0; - case 0: /* child */ - if (setuid(getuid()) == -1) - FatalError("xf86writeConfigFile(): " - "setuid failed(%s)\n", - strerror(errno)); - ret = doWriteConfigFile(filename, cptr); - exit(ret); - break; - default: /* parent */ - do - { - p = waitpid(pid, &status, 0); - } while (p == -1 && errno == EINTR); - } -#ifdef SIGCHLD - signal(SIGCHLD, csig); -#endif - if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0) - return 1; /* success */ - else - return 0; - -#else /* HAS_SAVED_IDS_AND_SETEUID */ - - ruid = getuid(); - euid = geteuid(); - - if (seteuid(ruid) == -1) - { - ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n", - ruid, strerror(errno)); - return 0; - } - ret = doWriteConfigFile(filename, cptr); - - if (seteuid(euid) == -1) - { - ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n", - euid, strerror(errno)); - } - return ret; - -#endif /* HAS_SAVED_IDS_AND_SETEUID */ - - } - else - { - return doWriteConfigFile(filename, cptr); - } -} - -#endif /* !HAS_NO_UIDS */ +/* + * Copyright (c) 1997 Metro Link Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the Metro Link shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Metro Link. + * + */ +/* + * Copyright (c) 1997-2003 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + + +/* View/edit this file with tab stops set to 4 */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#include "xf86Parser.h" +#include "xf86tokens.h" +#include "Configint.h" + +#include +#include +#include +#include +#include + +#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED) +#define HAS_SAVED_IDS_AND_SETEUID +#endif +#if defined(WIN32) +#define HAS_NO_UIDS +#endif + +#ifdef HAS_NO_UIDS +#define doWriteConfigFile xf86writeConfigFile +#define Local /**/ +#else +#define Local static +#endif + +Local int +doWriteConfigFile (const char *filename, XF86ConfigPtr cptr) +{ + FILE *cf; + + if ((cf = fopen (filename, "w")) == NULL) + { + return 0; + } + + if (cptr->conf_comment) + fprintf (cf, "%s\n", cptr->conf_comment); + + xf86printLayoutSection (cf, cptr->conf_layout_lst); + + if (cptr->conf_files != NULL) + { + fprintf (cf, "Section \"Files\"\n"); + xf86printFileSection (cf, cptr->conf_files); + fprintf (cf, "EndSection\n\n"); + } + + if (cptr->conf_modules != NULL) + { + fprintf (cf, "Section \"Module\"\n"); + xf86printModuleSection (cf, cptr->conf_modules); + fprintf (cf, "EndSection\n\n"); + } + + xf86printVendorSection (cf, cptr->conf_vendor_lst); + + xf86printServerFlagsSection (cf, cptr->conf_flags); + + xf86printInputSection (cf, cptr->conf_input_lst); + + xf86printInputClassSection (cf, cptr->conf_inputclass_lst); + + xf86printVideoAdaptorSection (cf, cptr->conf_videoadaptor_lst); + + xf86printModesSection (cf, cptr->conf_modes_lst); + + xf86printMonitorSection (cf, cptr->conf_monitor_lst); + + xf86printDeviceSection (cf, cptr->conf_device_lst); + + xf86printScreenSection (cf, cptr->conf_screen_lst); + + xf86printDRISection (cf, cptr->conf_dri); + + xf86printExtensionsSection (cf, cptr->conf_extensions); + + fclose(cf); + return 1; +} + +#ifndef HAS_NO_UIDS + +int +xf86writeConfigFile (const char *filename, XF86ConfigPtr cptr) +{ + int ret; + +#if !defined(HAS_SAVED_IDS_AND_SETEUID) + int pid, p; + int status; + void (*csig)(int); +#else + int ruid, euid; +#endif + + if (getuid() != geteuid()) + { + +#if !defined(HAS_SAVED_IDS_AND_SETEUID) + /* Need to fork to change ruid without loosing euid */ + csig = signal(SIGCHLD, SIG_DFL); + switch ((pid = fork())) + { + case -1: + ErrorF("xf86writeConfigFile(): fork failed (%s)\n", + strerror(errno)); + return 0; + case 0: /* child */ + if (setuid(getuid()) == -1) + FatalError("xf86writeConfigFile(): " + "setuid failed(%s)\n", + strerror(errno)); + ret = doWriteConfigFile(filename, cptr); + exit(ret); + break; + default: /* parent */ + do + { + p = waitpid(pid, &status, 0); + } while (p == -1 && errno == EINTR); + } + signal(SIGCHLD, csig); + if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0) + return 1; /* success */ + else + return 0; + +#else /* HAS_SAVED_IDS_AND_SETEUID */ + + ruid = getuid(); + euid = geteuid(); + + if (seteuid(ruid) == -1) + { + ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n", + ruid, strerror(errno)); + return 0; + } + ret = doWriteConfigFile(filename, cptr); + + if (seteuid(euid) == -1) + { + ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n", + euid, strerror(errno)); + } + return ret; + +#endif /* HAS_SAVED_IDS_AND_SETEUID */ + + } + else + { + return doWriteConfigFile(filename, cptr); + } +} + +#endif /* !HAS_NO_UIDS */ diff --git a/xorg-server/hw/xquartz/mach-startup/bundle-main.c b/xorg-server/hw/xquartz/mach-startup/bundle-main.c index 6dc7f9094..e6386dc3a 100644 --- a/xorg-server/hw/xquartz/mach-startup/bundle-main.c +++ b/xorg-server/hw/xquartz/mach-startup/bundle-main.c @@ -479,12 +479,11 @@ static void setup_env(void) { pds = LAUNCHD_ID_PREFIX".X11"; } - server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1)); + server_bootstrap_name = strdup(pds); if(!server_bootstrap_name) { fprintf(stderr, "X11.app: Memory allocation error.\n"); exit(1); } - strcpy(server_bootstrap_name, pds); setenv("X11_PREFS_DOMAIN", server_bootstrap_name, 1); len = strlen(server_bootstrap_name); diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c index d2ed16e7c..8b265c70b 100644 --- a/xorg-server/hw/xwin/glx/indirect.c +++ b/xorg-server/hw/xwin/glx/indirect.c @@ -444,7 +444,7 @@ glxLogExtensions(const char *prefix, const char *extensions) { int length = 0; char *strl; - char *str = malloc(strlen(extensions) + 1); + char *str = strdup(extensions); if (str == NULL) { @@ -452,9 +452,6 @@ glxLogExtensions(const char *prefix, const char *extensions) return; } - str[strlen(extensions)] = '\0'; - strncpy (str, extensions, strlen(extensions)); - strl = strtok(str, " "); ErrorF("%s%s", prefix, strl); length = strlen(prefix) + strlen(strl); -- cgit v1.2.3