CG6SaveScreen(pScreen, SCREEN_SAVER_ON);
CG6ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv){    ScrnInfoPtr pScrn;    Cg6Ptr pCg6;    sbusDevicePtr psdp;    int ret;    pScrn = xf86Screens[pScreen->myNum];    pCg6 = GET_CG6_FROM_SCRN(pScrn);    psdp = pCg6->psdp;    /* Map CG6 memory areas */        pCg6->fbc = xf86MapSbusMem(psdp, CG6_FBC_VOFF, sizeof(*pCg6->fbc));    pCg6->thc = xf86MapSbusMem(psdp, CG6_THC_VOFF, sizeof(*pCg6->thc));    /*     * XXX need something better here - we rely on the OS to allow mmap()ing      * usable VRAM ONLY. Works with NetBSD, may crash and burn on other OSes.     */    pCg6->vidmem = 2 * 1024 * 1024;    pCg6->fb = xf86MapSbusMem(psdp, CG6_RAM_VOFF, pCg6->vidmem);        if (pCg6->fb == NULL) {	/* mapping 2MB failed - try 1MB */	pCg6->vidmem = 1024 * 1024;	pCg6->fb = xf86MapSbusMem(psdp, CG6_RAM_VOFF, pCg6->vidmem);    }    if (pCg6->fb == NULL) {    	/* we can't map all video RAM - fall back to width*height */	pCg6->vidmem = psdp->width * psdp->height;	pCg6->fb = xf86MapSbusMem(psdp, CG6_RAM_VOFF, pCg6->vidmem);    }        if (pCg6->fb != NULL) {        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "mapped %d KB video RAM\n", 	    pCg6->vidmem >> 10);    }        if (!pCg6->fbc || !pCg6->thc || !pCg6->fb) {    	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,		   "xf86MapSbusMem failed fbc:%" PRIxPTR " fb:%" PRIxPTR                   " thc:%" PRIxPTR "\n",		   pCg6->fbc, pCg6->fb, pCg6->thc );    	if (pCg6->fbc) {	    xf86UnmapSbusMem(psdp, pCg6->fbc, sizeof(*pCg6->fbc));	    pCg6->fbc = NULL;	}	if (pCg6->thc) {	    xf86UnmapSbusMem(psdp, pCg6->thc, sizeof(*pCg6->thc));	    pCg6->thc = NULL;	}	if (pCg6->fb) {	    xf86UnmapSbusMem(psdp, pCg6->fb, pCg6->vidmem);	    pCg6->fb = NULL;	}	return FALSE;    }    /* Darken the screen for aesthetic reasons and set the viewport */    CG6SaveScreen(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, pCg6->fb, pScrn->virtualX,		       pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,		       pScrn->virtualX, 8);    /*if (!ret)	return FALSE;*/    pCg6->width=pScrn->virtualX;    pCg6->height=pScrn->virtualY;    pCg6->maxheight=(pCg6->vidmem/pCg6->width)&0xffff;    fbPictureInit(pScreen, 0, 0);    miInitializeBackingStore(pScreen);    xf86SetBackingStore(pScreen);    xf86SetSilkenMouse(pScreen);    xf86SetBlackWhitePixels(pScreen);        if (!pCg6->NoAccel) {    	BoxRec bx;	pCg6->pXAA=XAACreateInfoRec();	CG6AccelInit(pScrn);	bx.x1=bx.y1=0;	bx.x2=pCg6->width;	bx.y2=pCg6->maxheight;	xf86InitFBManager(pScreen,&bx);	if(!XAAInit(pScreen, pCg6->pXAA))	    return FALSE;	xf86Msg(X_INFO, "%s: Using acceleration\n", pCg6->psdp->device);    }    /* Initialise cursor functions */    miDCInitialize(pScreen, xf86GetPointerScreenFuncs());    /* Initialize HW cursor layer.       Must follow software cursor initialization*/    if (pCg6->HWCursor) {	if(!CG6HWCursorInit(pScreen)) {	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,		       "Hardware cursor initialization failed\n");	    return(FALSE);	}	xf86SbusHideOsHwCursor(psdp);    }    /* Initialise default colourmap */    if (!miCreateDefColormap(pScreen))	return FALSE;    if(!xf86SbusHandleColormaps(pScreen, psdp))	return FALSE;    pCg6->CloseScreen = pScreen->CloseScreen;    pScreen->CloseScreen = CG6CloseScreen;    pScreen->SaveScreen = CG6SaveScreen;    /* Report any unused options (only for the first generation) */    if (serverGeneration == 1) {	xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);    }    /* unblank the screen */    CG6SaveScreen(pScreen, SCREEN_SAVER_OFF);    /* Done */    return TRUE;}