static Bool TegraShadowInit(ScreenPtr pScreen) { if (!shadowSetup(pScreen)) return FALSE; return TRUE; }
static Bool msShadowInit(ScreenPtr pScreen) { if (!shadowSetup(pScreen)) { return FALSE; } return TRUE; }
static Bool sdlFinishInitScreen(ScreenPtr pScreen) { if (!shadowSetup (pScreen)) return FALSE; #ifdef RANDR if (!sdlRandRInit (pScreen)) return FALSE; #endif return TRUE; }
Bool LayerStartInit (ScreenPtr pScreen) { LayerScreenPtr pScrPriv; if (layerGeneration != serverGeneration) { layerScrPrivateIndex = AllocateScreenPrivateIndex (); if (layerScrPrivateIndex == -1) return FALSE; layerGCPrivateIndex = AllocateGCPrivateIndex (); if (layerGCPrivateIndex == -1) return FALSE; layerWinPrivateIndex = AllocateWindowPrivateIndex (); if (layerWinPrivateIndex == -1) return FALSE; layerGeneration = serverGeneration; } if (!AllocateGCPrivate (pScreen, layerGCPrivateIndex, sizeof (LayerGCRec))) return FALSE; if (!AllocateWindowPrivate (pScreen, layerWinPrivateIndex, sizeof (LayerWinRec))) return FALSE; pScrPriv = (LayerScreenPtr) xalloc (sizeof (LayerScreenRec)); if (!pScrPriv) return FALSE; pScrPriv->nkinds = 0; pScrPriv->kinds = 0; pScrPriv->pLayers = 0; pScreen->devPrivates[layerScrPrivateIndex].ptr = (pointer) pScrPriv; /* * Add fb kind -- always 0 */ if (LayerNewKind (pScreen) < 0) { pScreen->devPrivates[layerScrPrivateIndex].ptr = 0; xfree (pScrPriv); return FALSE; } /* * Add shadow kind -- always 1 */ if (!shadowSetup (pScreen)) return FALSE; if (LayerNewKind (pScreen) < 0) { pScreen->devPrivates[layerScrPrivateIndex].ptr = 0; xfree (pScrPriv->kinds); xfree (pScrPriv); return FALSE; } return TRUE; }
Bool fakeFinishInitScreen (ScreenPtr pScreen) { if (!shadowSetup (pScreen)) return FALSE; #ifdef RANDR if (!fakeRandRInit (pScreen)) return FALSE; #endif return TRUE; }
Bool ephyrFinishInitScreen(ScreenPtr pScreen) { /* FIXME: Calling this even if not using shadow. * Seems harmless enough. But may be safer elsewhere. */ if (!shadowSetup(pScreen)) return FALSE; #ifdef RANDR if (!ephyrRandRInit(pScreen)) return FALSE; #endif return TRUE; }
Bool shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window) { PixmapPtr pPixmap; pPixmap = pScreen->CreatePixmap(pScreen, pScreen->width, pScreen->height, pScreen->rootDepth); if (!pPixmap) return FALSE; if (!shadowSetup(pScreen)) { pScreen->DestroyPixmap(pPixmap); return FALSE; } shadowAdd(pScreen, pPixmap, update, window, NULL, SHADOW_ROTATE_0, 0); return TRUE; }
Bool ephyrFinishInitScreen(ScreenPtr pScreen) { KdScreenPriv(pScreen); KdScreenInfo *screen = pScreenPriv->screen; EphyrScrPriv *scrpriv = screen->driver; /* FIXME: Calling this even if not using shadow. * Seems harmless enough. But may be safer elsewhere. */ if (!shadowSetup(pScreen)) return FALSE; #ifdef RANDR if (!ephyrRandRInit(pScreen)) return FALSE; #endif scrpriv->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = ephyrScreenBlockHandler; return TRUE; }
/* Called at each server generation */ static Bool NestedScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn; NestedPrivatePtr pNested; Pixel redMask, greenMask, blueMask; xf86DrvMsg(scrnIndex, X_INFO, "NestedScreenInit\n"); pScrn = xf86Screens[pScreen->myNum]; pNested = PNESTED(pScrn); /*NESTEDScrn = pScrn;*/ NestedPrintPscreen(pScrn); /* Save state: * NestedSave(pScrn); */ //Load_Nested_Mouse(); pNested->clientData = NestedClientCreateScreen(scrnIndex, pNested->displayName, pScrn->virtualX, pScrn->virtualY, pNested->originX, pNested->originY, pScrn->depth, pScrn->bitsPerPixel, &redMask, &greenMask, &blueMask); if (!pNested->clientData) { xf86DrvMsg(scrnIndex, X_ERROR, "Failed to create client screen\n"); return FALSE; } TimerSet(NULL, 0, 1, NestedMouseTimer, pNested->clientData); miClearVisualTypes(); if (!miSetVisualTypesAndMasks(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual, redMask, greenMask, blueMask)) return FALSE; if (!miSetPixmapDepths()) return FALSE; if (!fbScreenInit(pScreen, NestedClientGetFrameBuffer(PCLIENTDATA(pScrn)), pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; fbPictureInit(pScreen, 0, 0); xf86SetBlackWhitePixels(pScreen); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); if (!miCreateDefColormap(pScreen)) return FALSE; pNested->update = NestedShadowUpdate; /*pNested->window = NestedShadowWindow;*/ pScreen->SaveScreen = NestedSaveScreen; if (!shadowSetup(pScreen)) return FALSE; pNested->CreateScreenResources = pScreen->CreateScreenResources; pScreen->CreateScreenResources = NestedCreateScreenResources; pNested->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = NestedCloseScreen; // Schedule the NestedInputLoadDriver function to load once the // input core is initialized. pNested->timer = TimerSet(NULL, 0, TIMER_CALLBACK_INTERVAL, NestedTimerCallback, (pointer)pScrn); return TRUE; }
/* See Porting Layer Definition - p. 20 */ Bool winFinishScreenInitFB (int index, ScreenPtr pScreen, int argc, char **argv) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; VisualPtr pVisual = NULL; char *pbits = NULL; #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) int iReturn; #endif /* Create framebuffer */ if (!(*pScreenPriv->pwinAllocateFB) (pScreen)) { ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n"); return FALSE; } /* * Grab the number of bits that are used to represent color in each pixel. */ if (pScreenInfo->dwBPP == 8) pScreenInfo->dwDepth = 8; else pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask) + winCountBits (pScreenPriv->dwGreenMask) + winCountBits (pScreenPriv->dwBlueMask); winErrorFVerb (2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n", (unsigned int) pScreenPriv->dwRedMask, (unsigned int) pScreenPriv->dwGreenMask, (unsigned int) pScreenPriv->dwBlueMask); /* Init visuals */ if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) { ErrorF ("winFinishScreenInitFB - winInitVisuals failed\n"); return FALSE; } /* Setup a local variable to point to the framebuffer */ pbits = pScreenInfo->pfb; /* Apparently we need this for the render extension */ miSetPixmapDepths (); /* Start fb initialization */ if (!fbSetupScreen (pScreen, pScreenInfo->pfb, pScreenInfo->dwWidth, pScreenInfo->dwHeight, monitorResolution, monitorResolution, pScreenInfo->dwStride, pScreenInfo->dwBPP)) { ErrorF ("winFinishScreenInitFB - fbSetupScreen failed\n"); return FALSE; } /* Override default colormap routines if visual class is dynamic */ if (pScreenInfo->dwDepth == 8 && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL && pScreenInfo->fFullScreen) || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD && pScreenInfo->fFullScreen))) { winSetColormapFunctions (pScreen); /* * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its * own colormap, as it cannot allocate 7 planes in the default * colormap. Setting whitePixel to 1 allows Magic to get 7 * planes in the default colormap, so it doesn't create its * own colormap. This latter situation is highly desireable, * as it keeps the Magic window viewable when switching to * other X clients that use the default colormap. */ pScreen->blackPixel = 0; pScreen->whitePixel = 1; } /* Place our save screen function */ pScreen->SaveScreen = winSaveScreen; /* Finish fb initialization */ if (!fbFinishScreenInit (pScreen, pScreenInfo->pfb, pScreenInfo->dwWidth, pScreenInfo->dwHeight, monitorResolution, monitorResolution, pScreenInfo->dwStride, pScreenInfo->dwBPP)) { ErrorF ("winFinishScreenInitFB - fbFinishScreenInit failed\n"); return FALSE; } /* Save a pointer to the root visual */ for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++); pScreenPriv->pRootVisual = pVisual; /* * Setup points to the block and wakeup handlers. Pass a pointer * to the current screen as pWakeupdata. */ pScreen->BlockHandler = winBlockHandler; pScreen->WakeupHandler = winWakeupHandler; pScreen->blockData = pScreen; pScreen->wakeupData = pScreen; /* Render extension initialization, calls miPictureInit */ if (!fbPictureInit (pScreen, NULL, 0)) { ErrorF ("winFinishScreenInitFB - fbPictureInit () failed\n"); return FALSE; } #ifdef RANDR /* Initialize resize and rotate support */ if (!winRandRInit (pScreen)) { ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n"); return FALSE; } #endif /* * Backing store support should reduce network traffic and increase * performance. */ miInitializeBackingStore (pScreen); /* KDrive does miDCInitialize right after miInitializeBackingStore */ /* Setup the cursor routines */ #if CYGDEBUG winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n"); #endif miDCInitialize (pScreen, &g_winPointerCursorFuncs); /* KDrive does winCreateDefColormap right after miDCInitialize */ /* Create a default colormap */ #if CYGDEBUG winDebug ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n"); #endif if (!winCreateDefColormap (pScreen)) { ErrorF ("winFinishScreenInitFB - Could not create colormap\n"); return FALSE; } /* Initialize the shadow framebuffer layer */ if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) #ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fMWExtWM #endif ) { #if CYGDEBUG winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n"); #endif if (!shadowSetup(pScreen)) { ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n"); return FALSE; } /* Wrap CreateScreenResources so we can add the screen pixmap to the Shadow framebuffer after it's been created */ pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources; pScreen->CreateScreenResources = winCreateScreenResources; } #ifdef XWIN_MULTIWINDOWEXTWM /* Handle multi-window external window manager mode */ if (pScreenInfo->fMWExtWM) { winDebug ("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n"); RootlessInit(pScreen, &winMWExtWMProcs); winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n"); rootless_CopyBytes_threshold = 0; /* FIXME: How many? Profiling needed? */ rootless_CopyWindow_threshold = 1; winWindowsWMExtensionInit (); } #endif /* Handle rootless mode */ if (pScreenInfo->fRootless) { /* Define the WRAP macro temporarily for local use */ #define WRAP(a) \ if (pScreen->a) { \ pScreenPriv->a = pScreen->a; \ } else { \ ErrorF("null screen fn " #a "\n"); \ pScreenPriv->a = NULL; \ } /* Save a pointer to each lower-level window procedure */ WRAP(CreateWindow); WRAP(DestroyWindow); WRAP(RealizeWindow); WRAP(UnrealizeWindow); WRAP(PositionWindow); WRAP(ChangeWindowAttributes); WRAP(SetShape); /* Assign rootless window procedures to be top level procedures */ pScreen->CreateWindow = winCreateWindowRootless; pScreen->DestroyWindow = winDestroyWindowRootless; pScreen->PositionWindow = winPositionWindowRootless; /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;*/ pScreen->RealizeWindow = winMapWindowRootless; pScreen->UnrealizeWindow = winUnmapWindowRootless; pScreen->SetShape = winSetShapeRootless; /* Undefine the WRAP macro, as it is not needed elsewhere */ #undef WRAP } #ifdef XWIN_MULTIWINDOW /* Handle multi window mode */ else if (pScreenInfo->fMultiWindow) { /* Define the WRAP macro temporarily for local use */ #define WRAP(a) \ if (pScreen->a) { \ pScreenPriv->a = pScreen->a; \ } else { \ ErrorF("null screen fn " #a "\n"); \ pScreenPriv->a = NULL; \ } /* Save a pointer to each lower-level window procedure */ WRAP(CreateWindow); WRAP(DestroyWindow); WRAP(RealizeWindow); WRAP(UnrealizeWindow); WRAP(PositionWindow); WRAP(ChangeWindowAttributes); WRAP(ReparentWindow); WRAP(RestackWindow); WRAP(ResizeWindow); WRAP(MoveWindow); WRAP(CopyWindow); WRAP(SetShape); /* Assign multi-window window procedures to be top level procedures */ pScreen->CreateWindow = winCreateWindowMultiWindow; pScreen->DestroyWindow = winDestroyWindowMultiWindow; pScreen->PositionWindow = winPositionWindowMultiWindow; /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow;*/ pScreen->RealizeWindow = winMapWindowMultiWindow; pScreen->UnrealizeWindow = winUnmapWindowMultiWindow; pScreen->ReparentWindow = winReparentWindowMultiWindow; pScreen->RestackWindow = winRestackWindowMultiWindow; pScreen->ResizeWindow = winResizeWindowMultiWindow; pScreen->MoveWindow = winMoveWindowMultiWindow; pScreen->CopyWindow = winCopyWindowMultiWindow; pScreen->SetShape = winSetShapeMultiWindow; /* Undefine the WRAP macro, as it is not needed elsewhere */ #undef WRAP } #endif /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */ pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) /* Create a mutex for modules in separate threads to wait for */ iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL); if (iReturn != 0) { ErrorF ("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n", iReturn); return FALSE; } /* Own the mutex for modules in separate threads */ iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted); if (iReturn != 0) { ErrorF ("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n", iReturn); return FALSE; } /* Set the ServerStarted flag to false */ pScreenPriv->fServerStarted = FALSE; #endif #ifdef XWIN_MULTIWINDOWEXTWM pScreenPriv->fRestacking = FALSE; #endif #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) if (FALSE #ifdef XWIN_MULTIWINDOW || pScreenInfo->fMultiWindow #endif #ifdef XWIN_MULTIWINDOWEXTWM || pScreenInfo->fInternalWM #endif ) { #if CYGDEBUG || YES winDebug ("winFinishScreenInitFB - Calling winInitWM.\n"); #endif /* Initialize multi window mode */ if (!winInitWM (&pScreenPriv->pWMInfo, &pScreenPriv->ptWMProc, &pScreenPriv->ptXMsgProc, &pScreenPriv->pmServerStarted, pScreenInfo->dwScreen, (HWND)&pScreenPriv->hwndScreen, #ifdef XWIN_MULTIWINDOWEXTWM pScreenInfo->fInternalWM || #endif FALSE)) { ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n"); return FALSE; } } #endif /* Tell the server that we are enabled */ pScreenPriv->fEnabled = TRUE; /* Tell the server that we have a valid depth */ pScreenPriv->fBadDepth = FALSE; #if CYGDEBUG || YES winDebug ("winFinishScreenInitFB - returning\n"); #endif return TRUE; }