static void XAAChangeGC ( GCPtr pGC, unsigned long mask ) { XAA_GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeGC) (pGC, mask); XAA_GC_FUNC_EPILOGUE (pGC); /* we have to assume that shared memory pixmaps are dirty because we can't wrap all operations on them */ if((mask & GCTile) && !pGC->tileIsPixel && PIXMAP_IS_SHARED(pGC->tile.pixmap)) { XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); pPixPriv->flags |= DIRTY; } if((mask & GCStipple) && PIXMAP_IS_SHARED(pGC->stipple)){ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); pPixPriv->flags |= DIRTY; } }
static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask) { ScreenPtr pScreen = pWin->drawable.pScreen; Bool ret; XAA_SCREEN_PROLOGUE (pScreen, ChangeWindowAttributes); ret = (*pScreen->ChangeWindowAttributes) (pWin, mask); XAA_SCREEN_EPILOGUE (pScreen, ChangeWindowAttributes, XAAChangeWindowAttributes); /* we have to assume that shared memory pixmaps are dirty because we can't wrap operations on them */ if((mask & CWBackPixmap) && (pWin->backgroundState == BackgroundPixmap) && PIXMAP_IS_SHARED(pWin->background.pixmap)) { XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->background.pixmap); pPixPriv->flags |= DIRTY; } if((mask & CWBorderPixmap) && !(pWin->borderIsPixel) && PIXMAP_IS_SHARED(pWin->border.pixmap)) { XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->border.pixmap); pPixPriv->flags |= DIRTY; } return ret; }
static void XAARenderMono8x8Rects( GCPtr pGC, int nboxes, BoxPtr pClipBoxes, int xorg, int yorg ){ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); XAAPixmapPtr pPriv; int fg, bg; switch(pGC->fillStyle) { case FillStippled: pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); fg = pGC->fgPixel; bg = -1; break; case FillOpaqueStippled: pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); fg = pGC->fgPixel; bg = pGC->bgPixel; break; case FillTiled: pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); fg = pPriv->fg; bg = pPriv->bg; break; default: /* Muffle compiler */ pPriv = NULL; /* Kaboom */ fg = -1; bg = -1; break; } (*infoRec->FillMono8x8PatternRects) (infoRec->pScrn, fg, bg, pGC->alu, pGC->planemask, nboxes, pClipBoxes, pPriv->pattern0, pPriv->pattern1, (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y)); }
static void XAARenderPixmapCopySpans( GCPtr pGC, int n, DDXPointPtr ppt, int *pwidth, int fSorted, int xorg, int yorg ){ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec); XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); pCache->x = pPriv->offscreenArea->box.x1; pCache->y = pPriv->offscreenArea->box.y1; pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x; pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y; pCache->trans_color = -1; (*infoRec->FillCacheBltSpans) (infoRec->pScrn, pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache, (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y)); }
static int XAASetDGAMode(int index, int num, DGADevicePtr devRet) { ScreenPtr pScreen = screenInfo.screens[index]; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAScreenPtr pScreenPriv = (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); int ret; if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */ SavedCacheStatePtr state = (SavedCacheStatePtr) infoRec->dgaSaves; infoRec->UsingPixmapCache = state->UsingPixmapCache; infoRec->CanDoColor8x8 = state->CanDoColor8x8; infoRec->CanDoMono8x8 = state->CanDoMono8x8; free(infoRec->dgaSaves); infoRec->dgaSaves = NULL; } ret = (*pScreenPriv->SetDGAMode) (index, num, devRet); if (ret != Success) return ret; if (num && devRet->pPix) { /* accelerate this pixmap */ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(devRet->pPix); FBAreaPtr area; if ((area = malloc(sizeof(FBArea)))) { area->pScreen = pScreen; area->box.x1 = 0; area->box.x2 = 0; area->box.y1 = devRet->mode->pixmapWidth; area->box.y2 = devRet->mode->pixmapHeight; area->granularity = 0; area->MoveAreaCallback = 0; area->RemoveAreaCallback = 0; area->devPrivate.ptr = 0; pixPriv->flags |= OFFSCREEN | DGA_PIXMAP; pixPriv->offscreenArea = area; if (!infoRec->dgaSaves) { /* save pixmap cache state */ SavedCacheStatePtr state = malloc(sizeof(SavedCacheState)); state->UsingPixmapCache = infoRec->UsingPixmapCache; state->CanDoColor8x8 = infoRec->CanDoColor8x8; state->CanDoMono8x8 = infoRec->CanDoMono8x8; infoRec->dgaSaves = (char *) state; infoRec->UsingPixmapCache = FALSE; if (infoRec->PixmapCacheFlags & CACHE_MONO_8x8) infoRec->CanDoMono8x8 = FALSE; if (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8) infoRec->CanDoColor8x8 = FALSE; } } } return ret; }
static Bool XAADestroyPixmap(PixmapPtr pPix) { ScreenPtr pScreen = pPix->drawable.pScreen; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); Bool ret; if (pPix->refcnt == 1) { if (pPriv->flags & OFFSCREEN) { if (pPriv->flags & DGA_PIXMAP) free(pPriv->offscreenArea); else { FBAreaPtr area = pPriv->offscreenArea; PixmapLinkPtr pLink = infoRec->OffscreenPixmaps; PixmapLinkPtr prev = NULL; while (pLink->pPix != pPix) { prev = pLink; pLink = pLink->next; } if (prev) prev->next = pLink->next; else infoRec->OffscreenPixmaps = pLink->next; if (!area) area = pLink->area; xf86FreeOffscreenArea(area); pPriv->offscreenArea = NULL; free(pLink); } } if (pPriv->freeData) { /* pixmaps that were once in video ram */ free(pPix->devPrivate.ptr); pPix->devPrivate.ptr = NULL; } } XAA_SCREEN_PROLOGUE(pScreen, DestroyPixmap); ret = (*pScreen->DestroyPixmap) (pPix); XAA_SCREEN_EPILOGUE(pScreen, DestroyPixmap, XAADestroyPixmap); return ret; }
static void XAARenderPixmapCopyRects(GCPtr pGC, int nboxes, BoxPtr pClipBoxes, int xorg, int yorg) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec); XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); pCache->x = pPriv->offscreenArea->box.x1; pCache->y = pPriv->offscreenArea->box.y1; pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x; pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y; pCache->trans_color = -1; (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu, pGC->planemask, nboxes, pClipBoxes, (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y), pCache); }
static RegionPtr XAACopyAreaPixmap( DrawablePtr pSrc, DrawablePtr pDst, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty ){ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); RegionPtr ret; if(infoRec->pScrn->vtSema && ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) { if(infoRec->ReadPixmap && (pGC->alu == GXcopy) && (pSrc->bitsPerPixel == pDst->bitsPerPixel) && ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1]) == infoRec->FullPlanemasks[pSrc->depth - 1])) { XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst)); pixPriv->flags |= DIRTY; return (XAABitBlt( pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty, XAADoImageRead, 0L)); } else if(infoRec->NeedToSync) { (*infoRec->Sync)(infoRec->pScrn); infoRec->NeedToSync = FALSE; } } { XAA_PIXMAP_OP_PROLOGUE(pGC, pDst); ret = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty); XAA_PIXMAP_OP_EPILOGUE(pGC); } return ret; }
static void XAAPaintWindow8_32( WindowPtr pWin, RegionPtr prgn, int what ){ ScreenPtr pScreen = pWin->drawable.pScreen; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable)); int nBox = REGION_NUM_RECTS(prgn); BoxPtr pBox = REGION_RECTS(prgn); PixmapPtr pPix = NULL; int depth = pWin->drawable.depth; int fg = 0, pm; if(!infoRec->pScrn->vtSema) goto BAILOUT; switch (what) { case PW_BACKGROUND: switch(pWin->backgroundState) { case None: return; case ParentRelative: do { pWin = pWin->parent; } while(pWin->backgroundState == ParentRelative); (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, what); return; case BackgroundPixel: fg = pWin->background.pixel; break; case BackgroundPixmap: pPix = pWin->background.pixmap; break; } break; case PW_BORDER: if (pWin->borderIsPixel) fg = pWin->border.pixel; else /* pixmap */ pPix = pWin->border.pixmap; break; default: return; } if(depth == 8) { pm = 0xff000000; fg <<= 24; } else pm = 0x00ffffff; if(!pPix) { if(infoRec->FillSolidRects && !(infoRec->FillSolidRectsFlags & NO_PLANEMASK) && (!(infoRec->FillSolidRectsFlags & RGB_EQUAL) || (depth == 8) || CHECK_RGB_EQUAL(fg))) { (*infoRec->FillSolidRects)(infoRec->pScrn, fg, GXcopy, pm, nBox, pBox); return; } } else { /* pixmap */ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); WindowPtr pBgWin = pWin; int xorg, yorg; if (what == PW_BORDER) { for (pBgWin = pWin; pBgWin->backgroundState == ParentRelative; pBgWin = pBgWin->parent); } xorg = pBgWin->drawable.x; yorg = pBgWin->drawable.y; #ifdef PANORAMIX if(!noPanoramiXExtension) { int index = pScreen->myNum; if(WindowTable[index] == pBgWin) { xorg -= panoramiXdataPtr[index].x; yorg -= panoramiXdataPtr[index].y; } } #endif if(IS_OFFSCREEN_PIXMAP(pPix) && infoRec->FillCacheBltRects) { XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec); pCache->x = pPriv->offscreenArea->box.x1; pCache->y = pPriv->offscreenArea->box.y1; pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x; pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y; pCache->trans_color = -1; (*infoRec->FillCacheBltRects)(infoRec->pScrn, GXcopy, pm, nBox, pBox, xorg, yorg, pCache); return; } if(pPriv->flags & DIRTY) { pPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK); pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; } if(!(pPriv->flags & REDUCIBILITY_CHECKED) && (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) { XAACheckTileReducibility(pPix, infoRec->CanDoMono8x8); } if(pPriv->flags & REDUCIBLE_TO_8x8) { if((pPriv->flags & REDUCIBLE_TO_2_COLOR) && infoRec->CanDoMono8x8 && infoRec->FillMono8x8PatternRects && !(infoRec->FillMono8x8PatternRectsFlags & NO_PLANEMASK) && !(infoRec->FillMono8x8PatternRectsFlags & TRANSPARENCY_ONLY) && (!(infoRec->FillMono8x8PatternRectsFlags & RGB_EQUAL) || (CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg)))) { (*infoRec->FillMono8x8PatternRects)(infoRec->pScrn, pPriv->fg, pPriv->bg, GXcopy, pm, nBox, pBox, pPriv->pattern0, pPriv->pattern1, xorg, yorg); return; } if(infoRec->CanDoColor8x8 && infoRec->FillColor8x8PatternRects && !(infoRec->FillColor8x8PatternRectsFlags & NO_PLANEMASK)) { XAACacheInfoPtr pCache = (*infoRec->CacheColor8x8Pattern)( infoRec->pScrn, pPix, -1, -1); (*infoRec->FillColor8x8PatternRects) (infoRec->pScrn, GXcopy, pm, nBox, pBox, xorg, yorg, pCache); return; } } if(infoRec->UsingPixmapCache && infoRec->FillCacheBltRects && !(infoRec->FillCacheBltRectsFlags & NO_PLANEMASK) && (pPix->drawable.height <= infoRec->MaxCacheableTileHeight) && (pPix->drawable.width <= infoRec->MaxCacheableTileWidth)) { XAACacheInfoPtr pCache = (*infoRec->CacheTile)(infoRec->pScrn, pPix); (*infoRec->FillCacheBltRects)(infoRec->pScrn, GXcopy, pm, nBox, pBox, xorg, yorg, pCache); return; } if(infoRec->FillImageWriteRects && !(infoRec->FillImageWriteRectsFlags & NO_PLANEMASK)) { (*infoRec->FillImageWriteRects) (infoRec->pScrn, GXcopy, pm, nBox, pBox, xorg, yorg, pPix); return; } } if(infoRec->NeedToSync) { (*infoRec->Sync)(infoRec->pScrn); infoRec->NeedToSync = FALSE; } BAILOUT: if(what == PW_BACKGROUND) { XAA_SCREEN_PROLOGUE (pScreen, PaintWindowBackground); (*pScreen->PaintWindowBackground) (pWin, prgn, what); XAA_SCREEN_EPILOGUE(pScreen, PaintWindowBackground, XAAPaintWindow8_32); } else { XAA_SCREEN_PROLOGUE (pScreen, PaintWindowBorder); (*pScreen->PaintWindowBorder) (pWin, prgn, what); XAA_SCREEN_EPILOGUE(pScreen, PaintWindowBorder, XAAPaintWindow8_32); } }
void XAAPaintWindow( WindowPtr pWin, RegionPtr prgn, int what ) { ScreenPtr pScreen = pWin->drawable.pScreen; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable)); int nBox = REGION_NUM_RECTS(prgn); BoxPtr pBox = REGION_RECTS(prgn); int fg = -1; PixmapPtr pPix = NULL; if(!infoRec->pScrn->vtSema) goto BAILOUT; switch (what) { case PW_BACKGROUND: switch(pWin->backgroundState) { case None: return; case ParentRelative: do { pWin = pWin->parent; } while(pWin->backgroundState == ParentRelative); (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, what); return; case BackgroundPixel: fg = pWin->background.pixel; break; case BackgroundPixmap: pPix = pWin->background.pixmap; break; } break; case PW_BORDER: if (pWin->borderIsPixel) fg = pWin->border.pixel; else /* pixmap */ pPix = pWin->border.pixmap; break; default: return; } if(!pPix) { if(infoRec->FillSolidRects && (!(infoRec->FillSolidRectsFlags & RGB_EQUAL) || (CHECK_RGB_EQUAL(fg))) ) { (*infoRec->FillSolidRects)(infoRec->pScrn, fg, GXcopy, ~0, nBox, pBox); return; } } else { /* pixmap */ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); WindowPtr pBgWin = pWin; Bool NoCache = FALSE; int xorg, yorg; /* Hack so we can use this with the dual framebuffer layers which only support the pixmap cache in the primary bpp */ if(pPix->drawable.bitsPerPixel != infoRec->pScrn->bitsPerPixel) NoCache = TRUE; if (what == PW_BORDER) { for (pBgWin = pWin; pBgWin->backgroundState == ParentRelative; pBgWin = pBgWin->parent); } xorg = pBgWin->drawable.x; yorg = pBgWin->drawable.y; if(IS_OFFSCREEN_PIXMAP(pPix) && infoRec->FillCacheBltRects) { XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec); pCache->x = pPriv->offscreenArea->box.x1; pCache->y = pPriv->offscreenArea->box.y1; pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x; pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y; pCache->trans_color = -1; (*infoRec->FillCacheBltRects)(infoRec->pScrn, GXcopy, ~0, nBox, pBox, xorg, yorg, pCache); return; } if(pPriv->flags & DIRTY) { pPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK); pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; } if(!(pPriv->flags & REDUCIBILITY_CHECKED) && (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) { XAACheckTileReducibility(pPix, infoRec->CanDoMono8x8); } if(pPriv->flags & REDUCIBLE_TO_8x8) { if((pPriv->flags & REDUCIBLE_TO_2_COLOR) && infoRec->CanDoMono8x8 && infoRec->FillMono8x8PatternRects && !(infoRec->FillMono8x8PatternRectsFlags & TRANSPARENCY_ONLY) && (!(infoRec->FillMono8x8PatternRectsFlags & RGB_EQUAL) || (CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg)))) { (*infoRec->FillMono8x8PatternRects)(infoRec->pScrn, pPriv->fg, pPriv->bg, GXcopy, ~0, nBox, pBox, pPriv->pattern0, pPriv->pattern1, xorg, yorg); return; } if(infoRec->CanDoColor8x8 && !NoCache && infoRec->FillColor8x8PatternRects) { XAACacheInfoPtr pCache = (*infoRec->CacheColor8x8Pattern)( infoRec->pScrn, pPix, -1, -1); (*infoRec->FillColor8x8PatternRects) ( infoRec->pScrn, GXcopy, ~0, nBox, pBox, xorg, yorg, pCache); return; } } /* The window size check is to reduce pixmap cache thrashing when there are lots of little windows with pixmap backgrounds like are sometimes used for buttons, etc... */ if(infoRec->UsingPixmapCache && infoRec->FillCacheBltRects && !NoCache && ((what == PW_BORDER) || (pPix->drawable.height != pWin->drawable.height) || (pPix->drawable.width != pWin->drawable.width)) && (pPix->drawable.height <= infoRec->MaxCacheableTileHeight) && (pPix->drawable.width <= infoRec->MaxCacheableTileWidth)) { XAACacheInfoPtr pCache = (*infoRec->CacheTile)(infoRec->pScrn, pPix); (*infoRec->FillCacheBltRects)(infoRec->pScrn, GXcopy, ~0, nBox, pBox, xorg, yorg, pCache); return; } if(infoRec->FillImageWriteRects && !(infoRec->FillImageWriteRectsFlags & NO_GXCOPY)) { (*infoRec->FillImageWriteRects) (infoRec->pScrn, GXcopy, ~0, nBox, pBox, xorg, yorg, pPix); return; } } if(infoRec->NeedToSync) { (*infoRec->Sync)(infoRec->pScrn); infoRec->NeedToSync = FALSE; } BAILOUT: if(what == PW_BACKGROUND) { XAA_SCREEN_PROLOGUE (pScreen, PaintWindowBackground); (*pScreen->PaintWindowBackground) (pWin, prgn, what); XAA_SCREEN_EPILOGUE(pScreen, PaintWindowBackground, XAAPaintWindow); } else { XAA_SCREEN_PROLOGUE (pScreen, PaintWindowBorder); (*pScreen->PaintWindowBorder) (pWin, prgn, what); XAA_SCREEN_EPILOGUE(pScreen, PaintWindowBorder, XAAPaintWindow); } }
static void XAAValidateGC( GCPtr pGC, unsigned long changes, DrawablePtr pDraw ){ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); XAA_GC_FUNC_PROLOGUE(pGC); (*pGC->funcs->ValidateGC)(pGC, changes, pDraw); if((changes & GCPlaneMask) && ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) == infoRec->FullPlanemasks[pGC->depth - 1])) { pGC->planemask = ~0; } if(pGC->depth != 32) { /* 0xffffffff is reserved for transparency */ if(pGC->bgPixel == 0xffffffff) pGC->bgPixel = 0x7fffffff; if(pGC->fgPixel == 0xffffffff) pGC->fgPixel = 0x7fffffff; } if((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)){ pGCPriv->flags = OPS_ARE_PIXMAP; pGCPriv->changes |= changes; /* make sure we're not using videomemory pixmaps to render onto system memory drawables */ if((pGC->fillStyle == FillTiled) && IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) && !OFFSCREEN_PIXMAP_LOCKED(pGC->tile.pixmap)) { XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); FBAreaPtr area = pPriv->offscreenArea; XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */ xf86FreeOffscreenArea(area); } } else if(!infoRec->pScrn->vtSema && (pDraw->type == DRAWABLE_WINDOW)) { pGCPriv->flags = 0; pGCPriv->changes |= changes; } else { if(!(pGCPriv->flags & OPS_ARE_ACCEL)) { changes |= pGCPriv->changes; pGCPriv->changes = 0; } pGCPriv->flags = OPS_ARE_ACCEL; #if 1 /* Ugh. If we can't use the blitter on offscreen pixmaps used as tiles, then we need to move them out as cfb can't handle tiles with non-zero origins */ if((pGC->fillStyle == FillTiled) && IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) && (DO_PIXMAP_COPY != (*infoRec->TiledFillChooser)(pGC))) { XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); FBAreaPtr area = pPriv->offscreenArea; XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */ xf86FreeOffscreenArea(area); } #endif } XAA_GC_FUNC_EPILOGUE(pGC); if(!(pGCPriv->flags & OPS_ARE_ACCEL)) return; if((changes & GCTile) && !pGC->tileIsPixel && pGC->tile.pixmap){ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); if(pixPriv->flags & DIRTY) { pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK); pGC->tile.pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; } } if((changes & GCStipple) && pGC->stipple){ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); if(pixPriv->flags & DIRTY) { pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK); pGC->stipple->drawable.serialNumber = NEXT_SERIAL_NUMBER; } } /* If our Ops are still the default ones we need to allocate new ones */ if(pGC->ops == &XAAFallbackOps) { if(!(pGCPriv->XAAOps = xalloc(sizeof(GCOps)))) { pGCPriv->XAAOps = &XAAFallbackOps; return; } /* make a modifiable copy of the default ops */ memcpy(pGCPriv->XAAOps, &XAAFallbackOps, sizeof(GCOps)); pGC->ops = pGCPriv->XAAOps; changes = ~0; } if(!changes) return; if((changes & GCDashList) && infoRec->ComputeDash) infoRec->ComputeDash(pGC); if(changes & infoRec->FillSpansMask) (*infoRec->ValidateFillSpans)(pGC, changes, pDraw); if(changes & infoRec->SetSpansMask) (*infoRec->ValidateSetSpans)(pGC, changes, pDraw); if(changes & infoRec->PutImageMask) (*infoRec->ValidatePutImage)(pGC, changes, pDraw); if(changes & infoRec->CopyAreaMask) (*infoRec->ValidateCopyArea)(pGC, changes, pDraw); if(changes & infoRec->CopyPlaneMask) (*infoRec->ValidateCopyPlane)(pGC, changes, pDraw); if(changes & infoRec->PolyPointMask) (*infoRec->ValidatePolyPoint)(pGC, changes, pDraw); if(changes & infoRec->PolylinesMask) (*infoRec->ValidatePolylines)(pGC, changes, pDraw); if(changes & infoRec->PolySegmentMask) (*infoRec->ValidatePolySegment)(pGC, changes, pDraw); if(changes & infoRec->PolyRectangleMask) (*infoRec->ValidatePolyRectangle)(pGC, changes, pDraw); if(changes & infoRec->PolyArcMask) (*infoRec->ValidatePolyArc)(pGC, changes, pDraw); if(changes & infoRec->FillPolygonMask) (*infoRec->ValidateFillPolygon)(pGC, changes, pDraw); if(changes & infoRec->PolyFillRectMask) (*infoRec->ValidatePolyFillRect)(pGC, changes, pDraw); if(changes & infoRec->PolyFillArcMask) (*infoRec->ValidatePolyFillArc)(pGC, changes, pDraw); if(changes & infoRec->PolyGlyphBltMask) (*infoRec->ValidatePolyGlyphBlt)(pGC, changes, pDraw); if(changes & infoRec->ImageGlyphBltMask) (*infoRec->ValidateImageGlyphBlt)(pGC, changes, pDraw); if(changes & infoRec->PolyText8Mask) (*infoRec->ValidatePolyText8)(pGC, changes, pDraw); if(changes & infoRec->PolyText16Mask) (*infoRec->ValidatePolyText16)(pGC, changes, pDraw); if(changes & infoRec->ImageText8Mask) (*infoRec->ValidateImageText8)(pGC, changes, pDraw); if(changes & infoRec->ImageText16Mask) (*infoRec->ValidateImageText16)(pGC, changes, pDraw); if(changes & infoRec->PushPixelsMask) (*infoRec->ValidatePushPixels)(pGC, changes, pDraw); }
static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; XAAPixmapPtr pPriv; PixmapPtr pPix = NULL; int size = w * h; if (w > 32767 || h > 32767) return NullPixmap; if (!infoRec->offscreenDepthsInitialized) XAAInitializeOffscreenDepths (pScreen); if(pScrn->vtSema && (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) && (infoRec->offscreenDepths & (1 << (depth - 1))) && (size >= MIN_OFFPIX_SIZE) && !SwitchedOut && (!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) && (!infoRec->maxOffPixHeight || (h <= infoRec->maxOffPixHeight)) ) { PixmapLinkPtr pLink; PixmapPtr pScreenPix; FBAreaPtr area; int gran = 0; switch(pScrn->bitsPerPixel) { case 24: case 8: gran = 4; break; case 16: gran = 2; break; case 32: gran = 1; break; default: break; } if(BITMAP_SCANLINE_PAD == 64) gran *= 2; if(!(area = xf86AllocateOffscreenArea(pScreen, w, h, gran, 0, XAARemoveAreaCallback, NULL))) { goto BAILOUT; } if(!(pLink = malloc(sizeof(PixmapLink)))) { xf86FreeOffscreenArea(area); goto BAILOUT; } XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap); pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint); XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap); if (!pPix) { free(pLink); xf86FreeOffscreenArea(area); goto BAILOUT; } pScreenPix = (*pScreen->GetScreenPixmap)(pScreen); pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); pPix->drawable.x = area->box.x1; pPix->drawable.y = area->box.y1; pPix->drawable.width = w; pPix->drawable.height = h; pPix->drawable.bitsPerPixel = pScrn->bitsPerPixel; pPix->devKind = pScreenPix->devKind; pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr; area->devPrivate.ptr = pPix; pPriv->flags = OFFSCREEN; pPriv->offscreenArea = area; pPriv->freeData = FALSE; pLink->next = infoRec->OffscreenPixmaps; pLink->pPix = pPix; infoRec->OffscreenPixmaps = pLink; return pPix; } BAILOUT: XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap); pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint); XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap); if(pPix) { pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); pPriv->flags = 0; pPriv->offscreenArea = NULL; pPriv->freeData = FALSE; if(!w || !h) /* either scratch or shared memory */ pPriv->flags |= SHARED_PIXMAP; } return pPix; }