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; }
rdpDevPrivateKey rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes) { rdpDevPrivateKey rv; #if XRDP_PRI == 1 rv = INT2PTR(AllocatePixmapPrivateIndex()); AllocatePixmapPrivate(pScreen, PTR2INT(rv), bytes); #elif XRDP_PRI == 2 dixRequestPrivate(&g_privateKeyRecPixmap, bytes); rv = &g_privateKeyRecPixmap; #else dixRegisterPrivateKey(&g_privateKeyRecPixmap, PRIVATE_PIXMAP, bytes); rv = &g_privateKeyRecPixmap; #endif return rv; }
/** * @param pScreen screen being initialized * @param pScreenInfo EXA driver record * * exaDriverInit sets up EXA given a driver record filled in by the driver. * pScreenInfo should have been allocated by exaDriverAlloc(). See the * comments in _ExaDriver for what must be filled in and what is optional. * * @return TRUE if EXA was successfully initialized. */ Bool exaDriverInit (ScreenPtr pScreen, ExaDriverPtr pScreenInfo) { ExaScreenPrivPtr pExaScr; #ifdef RENDER PictureScreenPtr ps; #endif if (!pScreenInfo) return FALSE; if (!pScreenInfo->memoryBase) { LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memoryBase must be " "non-zero\n", pScreen->myNum); return FALSE; } if (!pScreenInfo->memorySize) { LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memorySize must be " "non-zero\n", pScreen->myNum); return FALSE; } if (pScreenInfo->offScreenBase > pScreenInfo->memorySize) { LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::offScreenBase must be <= " "ExaDriverRec::memorySize\n", pScreen->myNum); return FALSE; } if (!pScreenInfo->PrepareSolid) { LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareSolid must be " "non-NULL\n", pScreen->myNum); return FALSE; } if (!pScreenInfo->PrepareCopy) { LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareCopy must be " "non-NULL\n", pScreen->myNum); return FALSE; } if (!pScreenInfo->WaitMarker) { LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::WaitMarker must be " "non-NULL\n", pScreen->myNum); return FALSE; } if (pScreenInfo->exa_major != EXA_VERSION_MAJOR || pScreenInfo->exa_minor > EXA_VERSION_MINOR) { LogMessage(X_ERROR, "EXA(%d): driver's EXA version requirements " "(%d.%d) are incompatible with EXA version (%d.%d)\n", pScreen->myNum, pScreenInfo->exa_major, pScreenInfo->exa_minor, EXA_VERSION_MAJOR, EXA_VERSION_MINOR); return FALSE; } #ifdef RENDER ps = GetPictureScreenIfSet(pScreen); #endif if (exaGeneration != serverGeneration) { exaScreenPrivateIndex = AllocateScreenPrivateIndex(); exaPixmapPrivateIndex = AllocatePixmapPrivateIndex(); exaGeneration = serverGeneration; } pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1); if (!pExaScr) { LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n", pScreen->myNum); return FALSE; } pExaScr->info = pScreenInfo; pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr; pExaScr->migration = ExaMigrationAlways; exaDDXDriverInit(pScreen); /* * Replace various fb screen functions */ pExaScr->SavedCloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = exaCloseScreen; pExaScr->SavedCreateGC = pScreen->CreateGC; pScreen->CreateGC = exaCreateGC; pExaScr->SavedGetImage = pScreen->GetImage; pScreen->GetImage = exaGetImage; pExaScr->SavedGetSpans = pScreen->GetSpans; pScreen->GetSpans = exaGetSpans; pExaScr->SavedCopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = exaCopyWindow; pExaScr->SavedPaintWindowBackground = pScreen->PaintWindowBackground; pScreen->PaintWindowBackground = exaPaintWindow; pExaScr->SavedPaintWindowBorder = pScreen->PaintWindowBorder; pScreen->PaintWindowBorder = exaPaintWindow; pScreen->BackingStoreFuncs.SaveAreas = ExaCheckSaveAreas; pScreen->BackingStoreFuncs.RestoreAreas = ExaCheckRestoreAreas; #ifdef RENDER if (ps) { pExaScr->SavedComposite = ps->Composite; ps->Composite = exaComposite; pExaScr->SavedRasterizeTrapezoid = ps->RasterizeTrapezoid; ps->RasterizeTrapezoid = exaRasterizeTrapezoid; pExaScr->SavedAddTriangles = ps->AddTriangles; ps->AddTriangles = exaAddTriangles; pExaScr->SavedGlyphs = ps->Glyphs; ps->Glyphs = exaGlyphs; pExaScr->SavedTrapezoids = ps->Trapezoids; ps->Trapezoids = exaTrapezoids; } #endif #ifdef MITSHM /* Re-register with the MI funcs, which don't allow shared pixmaps. * Shared pixmaps are almost always a performance loss for us, but this * still allows for SHM PutImage. */ ShmRegisterFuncs(pScreen, NULL); #endif /* * Hookup offscreen pixmaps */ if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) && pExaScr->info->offScreenBase < pExaScr->info->memorySize) { if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex, sizeof (ExaPixmapPrivRec))) { LogMessage(X_WARNING, "EXA(%d): Failed to allocate pixmap private\n", pScreen->myNum); return FALSE; } pExaScr->SavedCreatePixmap = pScreen->CreatePixmap; pScreen->CreatePixmap = exaCreatePixmap; pExaScr->SavedDestroyPixmap = pScreen->DestroyPixmap; pScreen->DestroyPixmap = exaDestroyPixmap; LogMessage(X_INFO, "EXA(%d): Offscreen pixmap area of %d bytes\n", pScreen->myNum, pExaScr->info->memorySize - pExaScr->info->offScreenBase); } else { LogMessage(X_INFO, "EXA(%d): No offscreen pixmaps\n", pScreen->myNum); if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex, 0)) return FALSE; } DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase, pExaScr->info->memorySize)); if (pExaScr->info->offScreenBase < pExaScr->info->memorySize) { if (!exaOffscreenInit (pScreen)) { LogMessage(X_WARNING, "EXA(%d): Offscreen pixmap setup failed\n", pScreen->myNum); return FALSE; } } LogMessage(X_INFO, "EXA(%d): Driver registered support for the following" " operations:\n", pScreen->myNum); assert(pScreenInfo->PrepareSolid != NULL); LogMessage(X_INFO, " Solid\n"); assert(pScreenInfo->PrepareCopy != NULL); LogMessage(X_INFO, " Copy\n"); if (pScreenInfo->PrepareComposite != NULL) { LogMessage(X_INFO, " Composite (RENDER acceleration)\n"); } if (pScreenInfo->UploadToScreen != NULL) { LogMessage(X_INFO, " UploadToScreen\n"); } if (pScreenInfo->DownloadFromScreen != NULL) { LogMessage(X_INFO, " DownloadFromScreen\n"); } return TRUE; }
Bool kaaDrawInit (ScreenPtr pScreen, KaaScreenInfoPtr pScreenInfo) { KaaScreenPrivPtr pKaaScr; KdScreenPriv(pScreen); KdScreenInfo *screen = pScreenPriv->screen; #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif if (kaaGeneration != serverGeneration) { kaaScreenPrivateIndex = AllocateScreenPrivateIndex(); kaaPixmapPrivateIndex = AllocatePixmapPrivateIndex(); kaaGeneration = serverGeneration; } pKaaScr = xalloc (sizeof (KaaScreenPrivRec)); if (!pKaaScr) return FALSE; pKaaScr->info = pScreenInfo; pScreen->devPrivates[kaaScreenPrivateIndex].ptr = (pointer) pKaaScr; /* * Hook up asynchronous drawing */ KdScreenInitAsync (pScreen); /* * Replace various fb screen functions */ pScreen->CreateGC = kaaCreateGC; pScreen->CopyWindow = kaaCopyWindow; pScreen->PaintWindowBackground = kaaPaintWindow; pScreen->PaintWindowBorder = kaaPaintWindow; #ifdef RENDER if (ps) { ps->Composite = kaaComposite; ps->RasterizeTrapezoid = kaaRasterizeTrapezoid; } #endif /* * Hookup offscreen pixmaps */ if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) && screen->off_screen_base < screen->memory_size) { if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, sizeof (KaaPixmapPrivRec))) return FALSE; pScreen->CreatePixmap = kaaCreatePixmap; pScreen->DestroyPixmap = kaaDestroyPixmap; } else { if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, 0)) return FALSE; } return TRUE; }
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; }
int pm2fb_init (ScreenPtr pScreen) { GLINTMMIOBase = fbdevRegBase; glintInfoRec = fbdevInfoRec; glintVideoMem = fbdevVirtBase; pm2fbVirtX = pm2fbMaxX = glintInfoRec.virtualX; pm2fbVirtY = pm2fbMaxY = glintInfoRec.virtualY; pprod = partprodPermedia[pm2fbMaxX >> 5]; /* I put this here, assuming that bpp can't change while the server runs */ switch (glintInfoRec.bitsPerPixel) { case 8: Bppshift = logbytesperaccess; pm2fbSetupForScreenToScreenCopy = Permedia2SetupForScreenToScreenCopy; pm2fbSubsequentScreenToScreenCopy = Permedia2SubsequentScreenToScreenCopy; break; case 16: Bppshift = logbytesperaccess-1; pm2fbSetupForScreenToScreenCopy = Permedia2SetupForScreenToScreenCopy; pm2fbSubsequentScreenToScreenCopy = Permedia2SubsequentScreenToScreenCopy; break; case 32: Bppshift = logbytesperaccess-2; pm2fbSetupForScreenToScreenCopy = Permedia2SetupForScreenToScreenCopy32bpp; pm2fbSubsequentScreenToScreenCopy = Permedia2SubsequentScreenToScreenCopy32bpp; break; default: ErrorF("pm2fb_init: Unsupported depth: %d\n", glintInfoRec.bitsPerPixel); return FALSE; } #ifdef DEBUG ErrorF("pm2fb_init: Bppshift = %d, pprod = %d\n", Bppshift, pprod); #endif pm2fb_reinit (pScreen) ; pm2fbImageInit(); #ifdef PM2_FBDEV_SERVER_GC_ACCEL pm2fbInitGC(); #endif #ifdef PIXPRIV pm2fbPixmapIndex = AllocatePixmapPrivateIndex(); if (!AllocatePixmapPrivate(pScreen, pm2fbPixmapIndex, sizeof(pm2fbPixPrivRec))) return FALSE; #endif pScreen->CopyWindow = pm2fbCopyWindow ; pScreen->GetImage = pm2fbGetImage; pScreen->PaintWindowBackground = pm2fbPaintWindow; pScreen->PaintWindowBorder = pm2fbPaintWindow; #ifdef PM2_FBDEV_SERVER_GC_ACCEL pScreen->CreateGC = pm2fbCreateGC; #endif return TRUE; }