/** Initialize the RENDER extension, allocate the picture privates and * wrap mi function hooks. If the shadow frame buffer is used, then * call the appropriate fb initialization function. */ Bool dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) { DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; PictureScreenPtr ps; /* The shadow framebuffer only relies on FB to be initialized */ if (dmxShadowFB) return fbPictureInit(pScreen, formats, nformats); if (!miPictureInit(pScreen, formats, nformats)) return FALSE; if (!dixRegisterPrivateKey (&dmxPictPrivateKeyRec, PRIVATE_PICTURE, sizeof(dmxPictPrivRec))) return FALSE; ps = GetPictureScreen(pScreen); DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps); DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps); DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps); DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps); DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps); DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps); DMX_WRAP(Composite, dmxComposite, dmxScreen, ps); DMX_WRAP(Glyphs, dmxGlyphs, dmxScreen, ps); DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps); DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps); DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps); 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; }
Bool KdScreenInit(ScreenPtr pScreen, int argc, char **argv) { KdScreenInfo *screen = kdCurrentScreen; KdCardInfo *card = screen->card; KdPrivScreenPtr pScreenPriv; /* * note that screen->fb is set up for the nominal orientation * of the screen; that means if randr is rotated, the values * there should reflect a rotated frame buffer (or shadow). */ Bool rotated = (screen->randr & (RR_Rotate_90 | RR_Rotate_270)) != 0; int width, height, *width_mmp, *height_mmp; KdAllocatePrivates(pScreen); pScreenPriv = KdGetScreenPriv(pScreen); if (!rotated) { width = screen->width; height = screen->height; width_mmp = &screen->width_mm; height_mmp = &screen->height_mm; } else { width = screen->height; height = screen->width; width_mmp = &screen->height_mm; height_mmp = &screen->width_mm; } screen->pScreen = pScreen; pScreenPriv->screen = screen; pScreenPriv->card = card; pScreenPriv->bytesPerPixel = screen->fb.bitsPerPixel >> 3; pScreenPriv->dpmsState = KD_DPMS_NORMAL; pScreen->x = screen->origin.x; pScreen->y = screen->origin.y; if (!monitorResolution) monitorResolution = 75; /* * This is done in this order so that backing store wraps * our GC functions; fbFinishScreenInit initializes MI * backing store */ if (!fbSetupScreen(pScreen, screen->fb.frameBuffer, width, height, monitorResolution, monitorResolution, screen->fb.pixelStride, screen->fb.bitsPerPixel)) { return FALSE; } /* * Set colormap functions */ pScreen->InstallColormap = KdInstallColormap; pScreen->UninstallColormap = KdUninstallColormap; pScreen->ListInstalledColormaps = KdListInstalledColormaps; pScreen->StoreColors = KdStoreColors; pScreen->SaveScreen = KdSaveScreen; pScreen->CreateWindow = KdCreateWindow; if (!fbFinishScreenInit(pScreen, screen->fb.frameBuffer, width, height, monitorResolution, monitorResolution, screen->fb.pixelStride, screen->fb.bitsPerPixel)) { return FALSE; } /* * Fix screen sizes; for some reason mi takes dpi instead of mm. * Rounding errors are annoying */ if (*width_mmp) pScreen->mmWidth = *width_mmp; else *width_mmp = pScreen->mmWidth; if (*height_mmp) pScreen->mmHeight = *height_mmp; else *height_mmp = pScreen->mmHeight; /* * Plug in our own block/wakeup handlers. * miScreenInit installs NoopDDA in both places */ pScreen->BlockHandler = KdBlockHandler; pScreen->WakeupHandler = KdWakeupHandler; if (!fbPictureInit(pScreen, 0, 0)) return FALSE; if (card->cfuncs->initScreen) if (!(*card->cfuncs->initScreen) (pScreen)) return FALSE; if (!screen->dumb && card->cfuncs->initAccel) if (!(*card->cfuncs->initAccel) (pScreen)) screen->dumb = TRUE; if (card->cfuncs->finishInitScreen) if (!(*card->cfuncs->finishInitScreen) (pScreen)) return FALSE; /* * Wrap CloseScreen, the order now is: * KdCloseScreen * miBSCloseScreen * fbCloseScreen */ pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = KdCloseScreen; pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources; pScreen->CreateScreenResources = KdCreateScreenResources; if (screen->softCursor || !card->cfuncs->initCursor || !(*card->cfuncs->initCursor) (pScreen)) { /* Use MI for cursor display and event queueing. */ screen->softCursor = TRUE; miDCInitialize(pScreen, &kdPointerScreenFuncs); } if (!fbCreateDefColormap(pScreen)) { return FALSE; } KdSetSubpixelOrder(pScreen, screen->randr); /* * Enable the hardware */ if (!kdEnabled) { kdEnabled = TRUE; if (kdOsFuncs->Enable) (*kdOsFuncs->Enable) (); } if (screen->mynum == card->selected) { if (card->cfuncs->preserve) (*card->cfuncs->preserve) (card); if (card->cfuncs->enable) if (!(*card->cfuncs->enable) (pScreen)) return FALSE; pScreenPriv->enabled = TRUE; if (!screen->softCursor && card->cfuncs->enableCursor) (*card->cfuncs->enableCursor) (pScreen); KdEnableColormap(pScreen); if (!screen->dumb && card->cfuncs->enableAccel) (*card->cfuncs->enableAccel) (pScreen); } return TRUE; }
Bool KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) { KdScreenInfo *screen = kdCurrentScreen; KdCardInfo *card = screen->card; KdPrivScreenPtr pScreenPriv; int fb; /* * note that screen->fb is set up for the nominal orientation * of the screen; that means if randr is rotated, the values * there should reflect a rotated frame buffer (or shadow). */ Bool rotated = (screen->randr & (RR_Rotate_90|RR_Rotate_270)) != 0; int width, height, *width_mmp, *height_mmp; KdAllocatePrivates (pScreen); pScreenPriv = KdGetScreenPriv(pScreen); if (!rotated) { width = screen->width; height = screen->height; width_mmp = &screen->width_mm; height_mmp = &screen->height_mm; } else { width = screen->height; height = screen->width; width_mmp = &screen->height_mm; height_mmp = &screen->width_mm; } screen->pScreen = pScreen; pScreenPriv->screen = screen; pScreenPriv->card = card; for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++) pScreenPriv->bytesPerPixel[fb] = screen->fb[fb].bitsPerPixel >> 3; pScreenPriv->dpmsState = KD_DPMS_NORMAL; #ifdef PANORAMIX dixScreenOrigins[pScreen->myNum] = screen->origin; #endif if (!monitorResolution) monitorResolution = 75; /* * This is done in this order so that backing store wraps * our GC functions; fbFinishScreenInit initializes MI * backing store */ if (!fbSetupScreen (pScreen, screen->fb[0].frameBuffer, width, height, monitorResolution, monitorResolution, screen->fb[0].pixelStride, screen->fb[0].bitsPerPixel)) { return FALSE; } /* * Set colormap functions */ pScreen->InstallColormap = KdInstallColormap; pScreen->UninstallColormap = KdUninstallColormap; pScreen->ListInstalledColormaps = KdListInstalledColormaps; pScreen->StoreColors = KdStoreColors; pScreen->SaveScreen = KdSaveScreen; pScreen->CreateWindow = KdCreateWindow; #ifdef FB_OLD_SCREEN pScreenPriv->BackingStoreFuncs.SaveAreas = fbSaveAreas; pScreenPriv->BackingStoreFuncs.RestoreAreas = fbSaveAreas; pScreenPriv->BackingStoreFuncs.SetClipmaskRgn = 0; pScreenPriv->BackingStoreFuncs.GetImagePixmap = 0; pScreenPriv->BackingStoreFuncs.GetSpansPixmap = 0; #endif #if KD_MAX_FB > 1 if (screen->fb[1].depth) { if (!fbOverlayFinishScreenInit (pScreen, screen->fb[0].frameBuffer, screen->fb[1].frameBuffer, width, height, monitorResolution, monitorResolution, screen->fb[0].pixelStride, screen->fb[1].pixelStride, screen->fb[0].bitsPerPixel, screen->fb[1].bitsPerPixel, screen->fb[0].depth, screen->fb[1].depth)) { return FALSE; } } else #endif { if (!fbFinishScreenInit (pScreen, screen->fb[0].frameBuffer, width, height, monitorResolution, monitorResolution, screen->fb[0].pixelStride, screen->fb[0].bitsPerPixel)) { return FALSE; } } /* * Fix screen sizes; for some reason mi takes dpi instead of mm. * Rounding errors are annoying */ if (*width_mmp) pScreen->mmWidth = *width_mmp; else *width_mmp = pScreen->mmWidth; if (*height_mmp) pScreen->mmHeight = *height_mmp; else *height_mmp = pScreen->mmHeight; /* * Plug in our own block/wakeup handlers. * miScreenInit installs NoopDDA in both places */ pScreen->BlockHandler = KdBlockHandler; pScreen->WakeupHandler = KdWakeupHandler; #ifdef RENDER if (!fbPictureInit (pScreen, 0, 0)) return FALSE; #endif if (card->cfuncs->initScreen) if (!(*card->cfuncs->initScreen) (pScreen)) return FALSE; if (!screen->dumb && card->cfuncs->initAccel) if (!(*card->cfuncs->initAccel) (pScreen)) screen->dumb = TRUE; if (screen->off_screen_base < screen->memory_size) KdOffscreenInit (pScreen); #ifdef PSEUDO8 (void) p8Init (pScreen, PSEUDO8_USE_DEFAULT); #endif if (card->cfuncs->finishInitScreen) if (!(*card->cfuncs->finishInitScreen) (pScreen)) return FALSE; #if 0 fbInitValidateTree (pScreen); #endif #if 0 pScreen->backingStoreSupport = Always; #ifdef FB_OLD_SCREEN miInitializeBackingStore (pScreen, &pScreenPriv->BackingStoreFuncs); #else miInitializeBackingStore (pScreen); #endif #endif /* * Wrap CloseScreen, the order now is: * KdCloseScreen * miBSCloseScreen * fbCloseScreen */ pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = KdCloseScreen; pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources; pScreen->CreateScreenResources = KdCreateScreenResources; if (screen->softCursor || !card->cfuncs->initCursor || !(*card->cfuncs->initCursor) (pScreen)) { /* Use MI for cursor display and event queueing. */ screen->softCursor = TRUE; miDCInitialize(pScreen, &kdPointerScreenFuncs); } if (!fbCreateDefColormap (pScreen)) { return FALSE; } KdSetSubpixelOrder (pScreen, screen->randr); /* * Enable the hardware */ if (!kdEnabled) { kdEnabled = TRUE; if(kdOsFuncs->Enable) (*kdOsFuncs->Enable) (); } if (screen->mynum == card->selected) { if(card->cfuncs->preserve) (*card->cfuncs->preserve) (card); if(card->cfuncs->enable) if (!(*card->cfuncs->enable) (pScreen)) return FALSE; pScreenPriv->enabled = TRUE; if (!screen->softCursor && card->cfuncs->enableCursor) (*card->cfuncs->enableCursor) (pScreen); KdEnableColormap (pScreen); if (!screen->dumb && card->cfuncs->enableAccel) (*card->cfuncs->enableAccel) (pScreen); } return TRUE; }
static Bool CG3ScreenInit(SCREEN_INIT_ARGS_DECL) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); Cg3Ptr pCg3; int ret; pCg3 = GET_CG3_FROM_SCRN(pScrn); /* Map the CG3 memory */ pCg3->fb = xf86MapSbusMem (pCg3->psdp, CG3_RAM_VOFF, (pCg3->psdp->width * pCg3->psdp->height)); if (! pCg3->fb) return FALSE; /* Darken the screen for aesthetic reasons and set the viewport */ CG3SaveScreen(pScreen, SCREEN_SAVER_ON); /* * The next step is to setup the screen's visuals, and initialise the * framebuffer code. In cases where the framebuffer's default * choices for things like visual layouts and bits per RGB are OK, * this may be as simple as calling the framebuffer's ScreenInit() * function. If not, the visuals will need to be setup before calling * a fb ScreenInit() function and fixed up after. */ /* * Reset visual list. */ miClearVisualTypes(); /* Set the bits per RGB for 8bpp mode */ pScrn->rgbBits = 8; /* Setup the visuals we support. */ if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; miSetPixmapDepths (); /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. */ ret = fbScreenInit(pScreen, pCg3->fb, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->virtualX, 8); if (!ret) return FALSE; #ifdef RENDER fbPictureInit (pScreen, 0, 0); #endif xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); xf86SetBlackWhitePixels(pScreen); /* Initialise cursor functions */ miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); /* Initialise default colourmap */ if (!miCreateDefColormap(pScreen)) return FALSE; if(!xf86SbusHandleColormaps(pScreen, pCg3->psdp)) return FALSE; pCg3->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = CG3CloseScreen; pScreen->SaveScreen = CG3SaveScreen; /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); } /* unblank the screen */ CG3SaveScreen(pScreen, SCREEN_SAVER_OFF); /* Done */ return TRUE; }
vfbScreenInit(ScreenPtr pScreen, int argc, char **argv) #endif { #if XORG < 113 vfbScreenInfoPtr pvfb = &vfbScreens[index]; #else vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum]; #endif int dpi; int ret; void *pbits; #ifdef RANDR rrScrPrivPtr rp; #endif #if XORG >= 113 if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0)) return FALSE; #endif /* 96 is the default used by most other systems */ dpi = 96; if (monitorResolution) dpi = monitorResolution; pbits = vfbAllocateFramebufferMemory(&pvfb->fb); if (!pbits) return FALSE; #if XORG < 113 vncFbptr[index] = pbits; vncFbstride[index] = pvfb->fb.paddedWidth; #else vncFbptr[pScreen->myNum] = pbits; vncFbstride[pScreen->myNum] = pvfb->fb.paddedWidth; #endif miSetPixmapDepths(); switch (pvfb->fb.depth) { case 8: miSetVisualTypesAndMasks (8, ((1 << StaticGray) | (1 << GrayScale) | (1 << StaticColor) | (1 << PseudoColor) | (1 << TrueColor) | (1 << DirectColor)), 8, PseudoColor, 0, 0, 0); break; case 16: miSetVisualTypesAndMasks (16, ((1 << TrueColor) | (1 << DirectColor)), 8, TrueColor, 0xf800, 0x07e0, 0x001f); break; case 24: miSetVisualTypesAndMasks (24, ((1 << TrueColor) | (1 << DirectColor)), 8, TrueColor, 0xff0000, 0x00ff00, 0x0000ff); break; case 32: miSetVisualTypesAndMasks (32, ((1 << TrueColor) | (1 << DirectColor)), 8, TrueColor, 0xff000000, 0x00ff0000, 0x0000ff00); break; default: return FALSE; } ret = fbScreenInit(pScreen, pbits, pvfb->fb.width, pvfb->fb.height, dpi, dpi, pvfb->fb.paddedWidth, pvfb->fb.bitsPerPixel); #ifdef RENDER if (ret && Render) ret = fbPictureInit (pScreen, 0, 0); #endif if (!ret) return FALSE; #if XORG < 110 miInitializeBackingStore(pScreen); #endif /* * Circumvent the backing store that was just initialised. This amounts * to a truely bizarre way of initialising SaveDoomedAreas and friends. */ pScreen->InstallColormap = vfbInstallColormap; pScreen->UninstallColormap = vfbUninstallColormap; pScreen->ListInstalledColormaps = vfbListInstalledColormaps; pScreen->SaveScreen = vfbSaveScreen; miPointerInitialize(pScreen, &vfbPointerSpriteFuncs, &vfbPointerCursorFuncs, FALSE); pScreen->blackPixel = pvfb->blackPixel; pScreen->whitePixel = pvfb->whitePixel; if (!pvfb->pixelFormatDefined) { switch (pvfb->fb.depth) { case 16: pvfb->pixelFormatDefined = TRUE; pvfb->rgbNotBgr = TRUE; pvfb->blueBits = pvfb->redBits = 5; pvfb->greenBits = 6; break; case 24: case 32: pvfb->pixelFormatDefined = TRUE; pvfb->rgbNotBgr = TRUE; pvfb->blueBits = pvfb->redBits = pvfb->greenBits = 8; break; } } if (pvfb->pixelFormatDefined) { VisualPtr vis = pScreen->visuals; for (int i = 0; i < pScreen->numVisuals; i++) { if (pvfb->rgbNotBgr) { vis->offsetBlue = 0; vis->blueMask = (1 << pvfb->blueBits) - 1; vis->offsetGreen = pvfb->blueBits; vis->greenMask = ((1 << pvfb->greenBits) - 1) << vis->offsetGreen; vis->offsetRed = vis->offsetGreen + pvfb->greenBits; vis->redMask = ((1 << pvfb->redBits) - 1) << vis->offsetRed; } else { vis->offsetRed = 0; vis->redMask = (1 << pvfb->redBits) - 1; vis->offsetGreen = pvfb->redBits; vis->greenMask = ((1 << pvfb->greenBits) - 1) << vis->offsetGreen; vis->offsetBlue = vis->offsetGreen + pvfb->greenBits; vis->blueMask = ((1 << pvfb->blueBits) - 1) << vis->offsetBlue; } vis++; } } ret = fbCreateDefColormap(pScreen); if (!ret) return FALSE; miSetZeroLineBias(pScreen, pvfb->lineBias); pvfb->closeScreen = pScreen->CloseScreen; pScreen->CloseScreen = vfbCloseScreen; #ifdef RANDR ret = RRScreenInit(pScreen); if (!ret) return FALSE; rp = rrGetScrPriv(pScreen); rp->rrGetInfo = vncRandRGetInfo; rp->rrSetConfig = NULL; rp->rrScreenSetSize = vncRandRScreenSetSize; rp->rrCrtcSet = vncRandRCrtcSet; rp->rrOutputValidateMode = vncRandROutputValidateMode; rp->rrModeDestroy = vncRandRModeDestroy; ret = vncRandRInit(pScreen); if (!ret) return FALSE; #endif return TRUE; } /* end vfbScreenInit */