static Bool cfb24_32AllocatePrivates(ScreenPtr pScreen) { if(cfb24_32Generation != serverGeneration) { if( ((cfb24_32GCIndex = AllocateGCPrivateIndex()) < 0) | ((cfb24_32PixmapIndex = AllocatePixmapPrivateIndex()) < 0)) return FALSE; cfb24_32Generation = serverGeneration; } /* All cfb will have the same GC and Window private indicies */ if(!mfbAllocatePrivates(pScreen,&cfbWindowPrivateIndex, &cfbGCPrivateIndex)) return FALSE; /* The cfb indicies are the mfb indicies. Reallocating them resizes them */ if(!AllocateWindowPrivate(pScreen,cfbWindowPrivateIndex,sizeof(cfbPrivWin))) return FALSE; if(!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC))) return FALSE; if(!AllocateGCPrivate(pScreen, cfb24_32GCIndex, sizeof(cfb24_32GCRec))) return FALSE; if(!AllocatePixmapPrivate( pScreen, cfb24_32PixmapIndex, sizeof(cfb24_32PixmapRec))) return FALSE; return TRUE; }
static Bool cfb8_32AllocatePrivates(ScreenPtr pScreen) { cfb8_32ScreenPtr pScreenPriv; if(cfb8_32Generation != serverGeneration) { if(((cfb8_32GCPrivateIndex = AllocateGCPrivateIndex()) < 0) || ((cfb8_32ScreenPrivateIndex = AllocateScreenPrivateIndex()) < 0)) return FALSE; cfb8_32Generation = serverGeneration; } if (!(pScreenPriv = xalloc(sizeof(cfb8_32ScreenRec)))) return FALSE; pScreen->devPrivates[cfb8_32ScreenPrivateIndex].ptr = (pointer)pScreenPriv; /* All cfb will have the same GC and Window private indicies */ if(!mfbAllocatePrivates(pScreen,&cfbWindowPrivateIndex, &cfbGCPrivateIndex)) return FALSE; /* The cfb indicies are the mfb indicies. Reallocating them resizes them */ if(!AllocateWindowPrivate(pScreen,cfbWindowPrivateIndex,sizeof(cfbPrivWin))) return FALSE; if(!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC))) return FALSE; if(!AllocateGCPrivate(pScreen, cfb8_32GCPrivateIndex, sizeof(cfb8_32GCRec))) return FALSE; return TRUE; }
static Bool RootlessAllocatePrivates(ScreenPtr pScreen) { RootlessScreenRec *s; static unsigned long rootlessGeneration = 0; if (rootlessGeneration != serverGeneration) { rootlessScreenPrivateIndex = AllocateScreenPrivateIndex(); if (rootlessScreenPrivateIndex == -1) return FALSE; rootlessGCPrivateIndex = AllocateGCPrivateIndex(); if (rootlessGCPrivateIndex == -1) return FALSE; rootlessWindowPrivateIndex = AllocateWindowPrivateIndex(); if (rootlessWindowPrivateIndex == -1) return FALSE; rootlessGeneration = serverGeneration; } // no allocation needed for screen privates if (!AllocateGCPrivate(pScreen, rootlessGCPrivateIndex, sizeof(RootlessGCRec))) return FALSE; if (!AllocateWindowPrivate(pScreen, rootlessWindowPrivateIndex, 0)) return FALSE; s = xalloc(sizeof(RootlessScreenRec)); if (! s) return FALSE; SCREENREC(pScreen) = s; return TRUE; }
Bool LeoAccelInit (ScreenPtr pScreen, LeoPtr pLeo) { LeoCommand0 *lc0; LeoDraw *ld0; if (serverGeneration != LeoGeneration) { LeoScreenPrivateIndex = AllocateScreenPrivateIndex (); if (LeoScreenPrivateIndex == -1) return FALSE; LeoGCPrivateIndex = AllocateGCPrivateIndex (); LeoWindowPrivateIndex = AllocateWindowPrivateIndex (); LeoGeneration = serverGeneration; } /* Allocate private structures holding pointer to both videoRAM and control registers. We do not have to map these by ourselves, because the XServer did it for us; we only copy the pointers to out structures. */ if (!AllocateGCPrivate(pScreen, LeoGCPrivateIndex, sizeof(LeoPrivGCRec))) return FALSE; if (!AllocateWindowPrivate(pScreen, LeoWindowPrivateIndex, 0)) return FALSE; pScreen->devPrivates[LeoScreenPrivateIndex].ptr = pLeo; pLeo->lc0 = lc0 = (LeoCommand0 *) ((char *)pLeo->fb + LEO_LC0_VOFF); pLeo->ld0 = ld0 = (LeoDraw *) ((char *)pLeo->fb + LEO_LD0_VOFF); if (!pLeo->NoAccel) { /* Replace various screen functions. */ pScreen->CreateGC = LeoCreateGC; pScreen->CopyWindow = LeoCopyWindow; } /* We will now clear the screen: we'll draw a rectangle covering all the * viewscreen, using a 'blackness' ROP. */ ld0->wid = 1; ld0->widclip = 0; ld0->wmask = 0xffff; ld0->planemask = 0xffffff; ld0->rop = LEO_ATTR_WE_ENABLE|LEO_ATTR_RGBE_ENABLE|LEO_ATTR_FORCE_WID; ld0->fg = 0; ld0->vclipmin = 0; ld0->vclipmax = (pLeo->psdp->width - 1) | ((pLeo->psdp->height - 1) << 16); pLeo->vclipmax = (pLeo->psdp->width - 1) | ((pLeo->psdp->height - 1) << 16); pLeo->width = pLeo->psdp->width; pLeo->height = pLeo->psdp->height; while (lc0->csr & LEO_CSR_BLT_BUSY); lc0->extent = (pLeo->psdp->width - 1) | ((pLeo->psdp->height - 1) << 11); lc0->fill = 0; while (lc0->csr & LEO_CSR_BLT_BUSY); lc0->addrspace = LEO_ADDRSPC_OBGR; ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; /* Success */ 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; }
/* Screen initialization/teardown */ void miInitializeCompositeWrapper(ScreenPtr pScreen) { cwScreenPtr pScreenPriv; if (cwDisabled[pScreen->myNum]) return; if (cwGeneration != serverGeneration) { cwScreenIndex = AllocateScreenPrivateIndex(); if (cwScreenIndex < 0) return; cwGCIndex = AllocateGCPrivateIndex(); cwWindowIndex = AllocateWindowPrivateIndex(); #ifdef RENDER cwPictureIndex = AllocatePicturePrivateIndex(); #endif cwGeneration = serverGeneration; } if (!AllocateGCPrivate(pScreen, cwGCIndex, sizeof(cwGCRec))) return; if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0)) return; #ifdef RENDER if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0)) return; #endif pScreenPriv = (cwScreenPtr)xalloc(sizeof(cwScreenRec)); if (!pScreenPriv) return; pScreen->devPrivates[cwScreenIndex].ptr = (pointer)pScreenPriv; SCREEN_EPILOGUE(pScreen, CloseScreen, cwCloseScreen); SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage); SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans); SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC); SCREEN_EPILOGUE(pScreen, PaintWindowBackground, cwPaintWindowBackground); SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder); SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow); SCREEN_EPILOGUE(pScreen, SetWindowPixmap, cwSetWindowPixmap); SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap); #ifdef RENDER if (GetPictureScreen (pScreen)) cwInitializeRender(pScreen); #endif }
rdpDevPrivateKey rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes) { rdpDevPrivateKey rv; #if XRDP_PRI == 1 rv = INT2PTR(AllocateGCPrivateIndex()); AllocateGCPrivate(pScreen, PTR2INT(rv), bytes); #elif XRDP_PRI == 2 dixRequestPrivate(&g_privateKeyRecGC, bytes); rv = &g_privateKeyRecGC; #else dixRegisterPrivateKey(&g_privateKeyRecGC, PRIVATE_GC, bytes); rv = &g_privateKeyRecGC; #endif return rv; }
Bool afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex) { if (afbGeneration != serverGeneration) { #ifdef PIXMAP_PER_WINDOW frameWindowPrivateIndex = AllocateWindowPrivateIndex(); #endif afbWindowPrivateIndex = AllocateWindowPrivateIndex(); afbGCPrivateIndex = AllocateGCPrivateIndex(); afbGeneration = serverGeneration; } if (pWinIndex) *pWinIndex = afbWindowPrivateIndex; if (pGCIndex) *pGCIndex = afbGCPrivateIndex; afbScreenPrivateIndex = AllocateScreenPrivateIndex(); pScreen->GetWindowPixmap = afbGetWindowPixmap; pScreen->SetWindowPixmap = afbSetWindowPixmap; return(AllocateWindowPrivate(pScreen, afbWindowPrivateIndex, sizeof(afbPrivWin)) && AllocateGCPrivate(pScreen, afbGCPrivateIndex, sizeof(afbPrivGC))); }
Bool XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; XAAScreenPtr pScreenPriv; int i; #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif /* Return successfully if no acceleration wanted */ if (!infoRec) return TRUE; if (XAAGeneration != serverGeneration) { if ( ((XAAScreenIndex = AllocateScreenPrivateIndex()) < 0) || ((XAAGCIndex = AllocateGCPrivateIndex()) < 0) || ((XAAPixmapIndex = AllocatePixmapPrivateIndex()) < 0)) return FALSE; XAAGeneration = serverGeneration; } if (!AllocateGCPrivate(pScreen, XAAGCIndex, sizeof(XAAGCRec))) return FALSE; if (!AllocatePixmapPrivate(pScreen, XAAPixmapIndex, sizeof(XAAPixmapRec))) return FALSE; if (!(pScreenPriv = xalloc(sizeof(XAAScreenRec)))) return FALSE; pScreen->devPrivates[XAAScreenIndex].ptr = (pointer)pScreenPriv; if(!xf86FBManagerRunning(pScreen)) infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS); if(!(infoRec->Flags & LINEAR_FRAMEBUFFER)) infoRec->Flags &= ~OFFSCREEN_PIXMAPS; if(!infoRec->FullPlanemask) { /* for backwards compatibility */ infoRec->FullPlanemask = (1 << pScrn->depth) - 1; infoRec->FullPlanemasks[pScrn->depth - 1] = infoRec->FullPlanemask; } for(i = 0; i < 32; i++) { if(!infoRec->FullPlanemasks[i]) /* keep any set by caller */ infoRec->FullPlanemasks[i] = (1 << (i+1)) - 1; } if(!XAAInitAccel(pScreen, infoRec)) return FALSE; pScreenPriv->AccelInfoRec = infoRec; infoRec->ScratchGC.pScreen = pScreen; if(!infoRec->GetImage) infoRec->GetImage = XAAGetImage; if(!infoRec->GetSpans) infoRec->GetSpans = XAAGetSpans; if(!infoRec->PaintWindowBackground) infoRec->PaintWindowBackground = XAAPaintWindow; if(!infoRec->PaintWindowBorder) infoRec->PaintWindowBorder = XAAPaintWindow; if(!infoRec->CopyWindow) infoRec->CopyWindow = XAACopyWindow; if(!infoRec->SaveAreas) infoRec->SaveAreas = XAASaveAreas; if(!infoRec->RestoreAreas) infoRec->RestoreAreas = XAARestoreAreas; pScreenPriv->CreateGC = pScreen->CreateGC; pScreen->CreateGC = XAACreateGC; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = XAACloseScreen; pScreenPriv->GetImage = pScreen->GetImage; pScreen->GetImage = infoRec->GetImage; pScreenPriv->GetSpans = pScreen->GetSpans; pScreen->GetSpans = infoRec->GetSpans; pScreenPriv->PaintWindowBackground = pScreen->PaintWindowBackground; pScreen->PaintWindowBackground = infoRec->PaintWindowBackground; pScreenPriv->PaintWindowBorder = pScreen->PaintWindowBorder; pScreen->PaintWindowBorder = infoRec->PaintWindowBorder; pScreenPriv->CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = infoRec->CopyWindow; pScreenPriv->CreatePixmap = pScreen->CreatePixmap; pScreen->CreatePixmap = XAACreatePixmap; pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap; pScreen->DestroyPixmap = XAADestroyPixmap; pScreenPriv->BackingStoreFuncs.RestoreAreas = pScreen->BackingStoreFuncs.RestoreAreas; pScreen->BackingStoreFuncs.RestoreAreas = infoRec->RestoreAreas; pScreenPriv->BackingStoreFuncs.SaveAreas = pScreen->BackingStoreFuncs.SaveAreas; pScreen->BackingStoreFuncs.SaveAreas = infoRec->SaveAreas; pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; pScreen->ChangeWindowAttributes = XAAChangeWindowAttributes; pScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = XAAEnterVT; pScreenPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = XAALeaveVT; pScreenPriv->SetDGAMode = pScrn->SetDGAMode; pScrn->SetDGAMode = XAASetDGAMode; pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess; pScrn->EnableDisableFBAccess = XAAEnableDisableFBAccess; pScreenPriv->WindowExposures = pScreen->WindowExposures; #ifdef RENDER if (ps) { pScreenPriv->Composite = ps->Composite; ps->Composite = XAAComposite; pScreenPriv->Glyphs = ps->Glyphs; ps->Glyphs = XAAGlyphs; } #endif if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR) XAASetupOverlay8_32Planar(pScreen); infoRec->PreAllocMem = xalloc(MAX_PREALLOC_MEM); if(infoRec->PreAllocMem) infoRec->PreAllocSize = MAX_PREALLOC_MEM; if(infoRec->Flags & PIXMAP_CACHE) xf86RegisterFreeBoxCallback(pScreen, infoRec->InitPixmapCache, (pointer)infoRec); if(infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS) miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4); #ifdef COMPOSITE /* Initialize the composite wrapper. This needs to happen after the * wrapping above (so it comes before us), but before all other extensions, * so it doesn't confuse them. (particularly damage). */ miInitializeCompositeWrapper(pScreen); #endif return TRUE; }
Bool ShadowFBInit2 ( ScreenPtr pScreen, RefreshAreaFuncPtr preRefreshArea, RefreshAreaFuncPtr postRefreshArea ){ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ShadowScreenPtr pPriv; #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif /* RENDER */ if(!preRefreshArea && !postRefreshArea) return FALSE; if (ShadowGeneration != serverGeneration) { if(((ShadowScreenIndex = AllocateScreenPrivateIndex ()) < 0) || ((ShadowGCIndex = AllocateGCPrivateIndex()) < 0)) return FALSE; ShadowGeneration = serverGeneration; } if(!AllocateGCPrivate(pScreen, ShadowGCIndex, sizeof(ShadowGCRec))) return FALSE; if(!(pPriv = (ShadowScreenPtr)xalloc(sizeof(ShadowScreenRec)))) return FALSE; pScreen->devPrivates[ShadowScreenIndex].ptr = (pointer)pPriv; pPriv->pScrn = pScrn; pPriv->preRefresh = preRefreshArea; pPriv->postRefresh = postRefreshArea; pPriv->vtSema = TRUE; pPriv->CloseScreen = pScreen->CloseScreen; pPriv->PaintWindowBackground = pScreen->PaintWindowBackground; pPriv->PaintWindowBorder = pScreen->PaintWindowBorder; pPriv->CopyWindow = pScreen->CopyWindow; pPriv->CreateGC = pScreen->CreateGC; pPriv->RestoreAreas = pScreen->BackingStoreFuncs.RestoreAreas; pPriv->ModifyPixmapHeader = pScreen->ModifyPixmapHeader; pPriv->EnterVT = pScrn->EnterVT; pPriv->LeaveVT = pScrn->LeaveVT; pScreen->CloseScreen = ShadowCloseScreen; pScreen->PaintWindowBackground = ShadowPaintWindow; pScreen->PaintWindowBorder = ShadowPaintWindow; pScreen->CopyWindow = ShadowCopyWindow; pScreen->CreateGC = ShadowCreateGC; pScreen->BackingStoreFuncs.RestoreAreas = ShadowRestoreAreas; pScreen->ModifyPixmapHeader = ShadowModifyPixmapHeader; pScrn->EnterVT = ShadowEnterVT; pScrn->LeaveVT = ShadowLeaveVT; #ifdef RENDER if(ps) { pPriv->Composite = ps->Composite; ps->Composite = ShadowComposite; } #endif /* RENDER */ return TRUE; }