if (sp->realbpp == 8)
if (sp->realbpp == 8) {
decPXInit(int screen, ScreenPtr pScreen, int argc, char **argv){	pxScreenPrivPtr sp;	static int generation;	struct stic_xmap *sxm;	struct stic_xinfo sxi;	int bpp, realbpp, mode;	char buf[MAXPATHLEN];	size_t sz;	fbFd *pFb;	pFb = &decFbs[screen];	realbpp = pFb->depth > 8 ? 32 : 8;	if (ioctl(pFb->fd, STICIO_RESET)) {		ErrorF("decPXInit: ioctl(STICIO_RESET) failed\n");		return (FALSE);	}	if (ioctl(pFb->fd, STICIO_GXINFO, &sxi)) {		ErrorF("decPXInit: ioctl(STICIO_GXINFO) failed\n");		return (FALSE);	}	if (sxi.sxi_unit < 0) {		ErrorF("decPXInit: no auxiallary control device for STIC\n");		return (FALSE);	}	pFb->EnterLeave = (void (*)())NoopDDA;    	if (!decScreenAllocate(pScreen))		return (FALSE);	switch (decWantedDepth) {	case 8:		bpp = 8;		break;	case 32:		if (realbpp == 32)			bpp = 32;		else {			ErrorF("pxFBInit: 32-bit color not available\n");			bpp = realbpp;		}		break;	default:		bpp = realbpp;		break;	}	if (!pxScreenInit(pScreen, NULL, pFb->width, pFb->height,	    monitorResolution, monitorResolution, pFb->width, bpp))		return (FALSE);	pScreen->backingStoreSupport = NotUseful;	pScreen->saveUnderSupport = NotUseful;	if (generation != serverGeneration) {		pxGCPrivateIndex = AllocateGCPrivateIndex();		pxWindowPrivateIndex = AllocateWindowPrivateIndex();		pxScreenPrivateIndex = AllocateScreenPrivateIndex();		if (pxGCPrivateIndex < 0 ||		    pxWindowPrivateIndex < 0 ||		    pxScreenPrivateIndex < 0)			return (FALSE);		generation = serverGeneration;		sp = (pxScreenPrivPtr)xalloc(sizeof(*sp));		if (!sp)			return (FALSE);		memset(sp, 0, sizeof(*sp));		pScreen->devPrivates[pxScreenPrivateIndex].ptr =		    (pointer)sp;	 	if (!AllocateGCPrivate(pScreen, pxGCPrivateIndex,		    sizeof(pxPrivGCRec)) ||		    !AllocateWindowPrivate(pScreen, pxWindowPrivateIndex,		    sizeof(pxPrivWinRec)))			return FALSE;	}	sp = pScreen->devPrivates[pxScreenPrivateIndex].ptr;	if (pScreen->CloseScreen != pxCloseScreen) {		sp->CloseScreen = pScreen->CloseScreen;		pScreen->CloseScreen = pxCloseScreen;		sp->mapfd = -1;	}	if (sp->sxc == NULL) {		snprintf(buf, sizeof(buf) - 1, "/dev/stic%d", sxi.sxi_unit);		if ((sp->mapfd = open(buf, O_RDWR)) < 0)			FatalError("decPXInit: unable to open %s: %s\n",			    buf, strerror(errno));		sz = (size_t)(sizeof(*sxm) - sizeof(sxm->sxm_xcomm) +		    sxi.sxi_buf_size);		mode = WSDISPLAYIO_MODE_MAPPED;		if (ioctl(pFb->fd, WSDISPLAYIO_SMODE, &mode) == -1)			FatalError("WSDISPLAYIO_SMODE");		sxm = mmap(NULL, sz, PROT_READ | PROT_WRITE,		    MAP_SHARED /* | MAP_NODUMP */, sp->mapfd, 0);		if (sxm == NULL) {			FatalError("unable to map buffers");			return (FALSE);		}		sp->fd = pFb->fd;		sp->bpp = bpp;		sp->realbpp = realbpp;		sp->stampw = sxi.sxi_stampw;		sp->stamph = sxi.sxi_stamph;		sp->buf_pa = sxi.sxi_buf_phys;		sp->nbuf = sxi.sxi_buf_pktcnt;#ifdef notyet		sp->queueing = (ioctl(pFb->fd, STICIO_STARTQ) == 0);#else		sp->queueing = 0;#endif		sp->stic = (volatile struct stic_regs *)sxm->sxm_stic;		sp->poll = (volatile u_int32_t *)sxm->sxm_poll;		sp->sxc = (volatile struct stic_xcomm *)sxm->sxm_xcomm;		sp->buf = (u_int32_t *)((caddr_t)sp->sxc + sxi.sxi_buf_pktoff);		sp->ib[0].ptr =		    (u_int32_t *)((caddr_t)sp->sxc + sxi.sxi_buf_imgoff); 		sp->ib[1].ptr =		    sp->ib[0].ptr + (STIC_IMGBUF_SIZE / sizeof(u_int32_t));		sp->ib[0].paddr = pxVirtToStic(sp, sp->ib[0].ptr);		sp->ib[1].paddr = pxVirtToStic(sp, sp->ib[1].ptr);		sp->ib[0].bufnum = 0;		sp->ib[1].bufnum = 0;		sp->ib[0].ident = 2;		/* an impossible ID */		sp->ib[1].ident = 2;		/* an impossible ID */		if (sp->bpp == 8) {			sp->compressBuf = pxCompressBuf24to8;			if (sp->realbpp == 8)				sp->expandBuf = pxExpandBuf8to8;			else				sp->expandBuf = pxExpandBuf8to24;		} else {			sp->compressBuf = pxCompressBuf24to24;			sp->expandBuf = pxExpandBuf24to24;		}	}	if (bpp > 8) {		struct wsdisplay_cmap cm;		u_char intensity[256];		int i;		for (i = 0; i < 256; i++)			intensity[i] = i;		cm.index = 0;		cm.count = 256;		cm.red = intensity;		cm.green = intensity;		cm.blue = intensity;		if (ioctl(pFb->fd, WSDISPLAYIO_PUTCMAP, &cm)) {			ErrorF("pxFBInit: unable to set colormap\n");			return (FALSE);		}	}	decColormapScreenInit(pScreen);	if (!decScreenInit(pScreen)) {                fprintf(stderr, "decScreenInit failed\n");		return FALSE;	}	decSaveScreen(pScreen, SCREEN_SAVER_OFF);	return (cfbCreateDefColormap(pScreen));}