Esempio n. 1
0
static void
XAAGetImage (
    DrawablePtr pDraw,
    int	sx, int sy, int w, int h,
    unsigned int    format,
    unsigned long   planemask,
    char	    *pdstLine 
)
{
    ScreenPtr pScreen = pDraw->pScreen;
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    ScrnInfoPtr pScrn = infoRec->pScrn;

    if(pScrn->vtSema && 
	((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) 
    {
	if(infoRec->ReadPixmap && (format == ZPixmap) && 
	   ((planemask & infoRec->FullPlanemasks[pDraw->depth - 1]) == 
                           infoRec->FullPlanemasks[pDraw->depth - 1]) &&
	   (pDraw->bitsPerPixel == BitsPerPixel(pDraw->depth)))
	{
	    (*infoRec->ReadPixmap)(pScrn, 
		   sx + pDraw->x, sy + pDraw->y, w, h,
		   (unsigned char *)pdstLine,
		   PixmapBytePad(w, pDraw->depth), 
		   pDraw->bitsPerPixel, pDraw->depth);
	    return;
	}
	SYNC_CHECK(pDraw);
    }

    XAA_SCREEN_PROLOGUE (pScreen, GetImage);
    (*pScreen->GetImage) (pDraw, sx, sy, w, h, format, planemask, pdstLine);
    XAA_SCREEN_EPILOGUE (pScreen, GetImage, XAAGetImage);
}
void
XAAOverWindowExposures(
   WindowPtr pWin,
   RegionPtr pReg,
   RegionPtr pOtherReg
){
    ScreenPtr pScreen = pWin->drawable.pScreen;
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);

    if((pWin->drawable.bitsPerPixel != 8) && infoRec->pScrn->vtSema) {
	if(REGION_NUM_RECTS(pReg) && infoRec->FillSolidRects) {
	    XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);

	    SWITCH_DEPTH(8);
	    (*infoRec->FillSolidRects)(infoRec->pScrn, 
		infoRec->pScrn->colorKey, GXcopy, ~0,
			REGION_NUM_RECTS(pReg), REGION_RECTS(pReg));
	    miWindowExposures(pWin, pReg, pOtherReg);
	    return;
	} else if(infoRec->NeedToSync) {
            (*infoRec->Sync)(infoRec->pScrn);
            infoRec->NeedToSync = FALSE;
	}
    } 

    XAA_SCREEN_PROLOGUE (pScreen, WindowExposures);
    (*pScreen->WindowExposures) (pWin, pReg, pOtherReg);
    XAA_SCREEN_EPILOGUE(pScreen, WindowExposures, XAAOverWindowExposures);
}
Esempio n. 3
0
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;
}
Esempio n. 4
0
void
XAASetupOverlay8_32Planar(ScreenPtr pScreen)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    int i;

    pScreen->CopyWindow = XAACopyWindow8_32;

    if (!(infoRec->FillSolidRectsFlags & NO_PLANEMASK))
        miOverlaySetTransFunction(pScreen, XAASetColorKey8_32);

    infoRec->FullPlanemask = ~0;
    for (i = 0; i < 32; i++)    /* haven't thought about this much */
        infoRec->FullPlanemasks[i] = ~0;
}
static void
XAAOverPaintWindow(
    WindowPtr   pWin,
    RegionPtr   pRegion,
    int         what
){
    ScreenPtr pScreen = pWin->drawable.pScreen;
    XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    ScrnInfoPtr pScrn = infoRec->pScrn;

    if(pScrn->vtSema) {
	if(what == PW_BACKGROUND) {
	    SWITCH_DEPTH(pWin->drawable.depth);
	    (*infoRec->PaintWindowBackground)(pWin, pRegion, what);
	    return;
	} else {
	    if(pWin->drawable.bitsPerPixel == 8) {
		SWITCH_DEPTH(8);
		(*infoRec->PaintWindowBorder)(pWin, pRegion, what);
		return;
	    } else if (infoRec->FillSolidRects)  {
		SWITCH_DEPTH(8);
		(*infoRec->FillSolidRects)(pScrn, pScrn->colorKey, GXcopy, 
			~0, REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion));

		SWITCH_DEPTH(pWin->drawable.depth);
		(*infoRec->PaintWindowBorder)(pWin, pRegion, what);
		return;
	    } 
	}

	if(infoRec->NeedToSync) {
	    (*infoRec->Sync)(infoRec->pScrn);
	    infoRec->NeedToSync = FALSE;
	}
    }

    if(what == PW_BACKGROUND) {
	XAA_SCREEN_PROLOGUE (pScreen, PaintWindowBackground);
	(*pScreen->PaintWindowBackground) (pWin, pRegion, what);
	XAA_SCREEN_EPILOGUE(pScreen, PaintWindowBackground, XAAOverPaintWindow);
    } else {
	XAA_SCREEN_PROLOGUE (pScreen, PaintWindowBorder);
	(*pScreen->PaintWindowBorder) (pWin, pRegion, what);
	XAA_SCREEN_EPILOGUE(pScreen, PaintWindowBorder, XAAOverPaintWindow);
    }
}
Esempio n. 6
0
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;
}
Esempio n. 7
0
static void
XAASetColorKey8_32(ScreenPtr pScreen, int nbox, BoxPtr pbox)
{
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    ScrnInfoPtr pScrn = infoRec->pScrn;

    /* I'm counting on writes being clipped away while switched away.
       If this isn't going to be true then I need to be wrapping instead. */
    if (!infoRec->pScrn->vtSema)
        return;

    (*infoRec->FillSolidRects) (pScrn, pScrn->colorKey << 24, GXcopy,
                                0xff000000, nbox, pbox);

    SET_SYNC_FLAG(infoRec);
}
Esempio n. 8
0
static void
XAASaveAreas (
    PixmapPtr pPixmap,
    RegionPtr prgnSave,
    int       xorg,
    int       yorg,
    WindowPtr pWin
){
    ScreenPtr pScreen = pPixmap->drawable.pScreen;
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);

    if(IS_OFFSCREEN_PIXMAP(pPixmap)) {
	BoxPtr pbox = REGION_RECTS(prgnSave);
	int nboxes = REGION_NUM_RECTS(prgnSave);

	(*infoRec->SetupForScreenToScreenCopy)(pScrn, 1, 1, GXcopy, ~0, -1);
	while(nboxes--) {
	    (*infoRec->SubsequentScreenToScreenCopy)(pScrn, 
		pbox->x1 + xorg, pbox->y1 + yorg, 
		pPixmap->drawable.x + pbox->x1, 
		pPixmap->drawable.y + pbox->y1,
		pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
	    pbox++;
	}
	SET_SYNC_FLAG(infoRec);
	return;
    }

    if(xf86Screens[pScreen->myNum]->vtSema && infoRec->ReadPixmap &&
	(pWin->drawable.bitsPerPixel == pPixmap->drawable.bitsPerPixel)) {
	BoxPtr pbox = REGION_RECTS(prgnSave);
	int nboxes = REGION_NUM_RECTS(prgnSave);
	int Bpp =  pPixmap->drawable.bitsPerPixel >> 3;
	unsigned char *dstp = (unsigned char*)pPixmap->devPrivate.ptr;

	while(nboxes--) {
	    (*infoRec->ReadPixmap)(infoRec->pScrn,
		pbox->x1 + xorg, pbox->y1 + yorg, 
		pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, 
		dstp + (pPixmap->devKind * pbox->y1) + (pbox->x1 * Bpp),
		pPixmap->devKind,
		pPixmap->drawable.bitsPerPixel, pPixmap->drawable.depth);
	    pbox++;
	}
	return;
    }
static void
XAAInitializeOffscreenDepths (ScreenPtr pScreen)
{
    XAAInfoRecPtr   infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    ScrnInfoPtr	    pScrn = xf86Screens[pScreen->myNum];
    int		    d, dep;

    infoRec->offscreenDepthsInitialized = TRUE;
    infoRec->offscreenDepths = 0;
    if (infoRec->Flags & OFFSCREEN_PIXMAPS) {
        for (d = 0; d < pScreen->numDepths; d++) {
            dep = pScreen->allowedDepths[d].depth;
            if (XAAPixmapBPP (pScreen, dep) == pScrn->bitsPerPixel)
                infoRec->offscreenDepths |= (1 << (dep - 1));
        }
    }
}
static void
XAAEnableDisableFBAccess (int index, Bool enable)
{
    ScreenPtr pScreen = screenInfo.screens[index];
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    XAAScreenPtr pScreenPriv =
        (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);

    if(!enable) {
        if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
            XAAMoveOutOffscreenPixmaps(pScreen);
        if(infoRec->Flags & PIXMAP_CACHE)
            XAAInvalidatePixmapCache(pScreen);
        SwitchedOut = TRUE;
    }

    (*pScreenPriv->EnableDisableFBAccess)(index, enable);

    if(enable) {
        if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
            XAAMoveInOffscreenPixmaps(pScreen);
        SwitchedOut = FALSE;
    }
}
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;
}
void
XAAOverCopyWindow(
    WindowPtr pWin,
    DDXPointRec ptOldOrg,
    RegionPtr prgnSrc
){
    ScreenPtr pScreen = pWin->drawable.pScreen;
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
    ScrnInfoPtr pScrn = infoRec->pScrn;
    DDXPointPtr ppt, pptSrc;
    RegionRec rgnDst;
    BoxPtr pbox;
    int i, nbox, dx, dy;
    WindowPtr pRoot = WindowTable[pScreen->myNum];


    if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) { 
	XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
	if(pScrn->vtSema && infoRec->NeedToSync) {
	    (*infoRec->Sync)(pScrn);
	    infoRec->NeedToSync = FALSE;
	}
        (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
	XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAAOverCopyWindow);
    	return;
    }

    infoRec->ScratchGC.alu = GXcopy;
    infoRec->ScratchGC.planemask = ~0;

    REGION_NULL(pScreen, &rgnDst);

    dx = ptOldOrg.x - pWin->drawable.x;
    dy = ptOldOrg.y - pWin->drawable.y;
    REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
    REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);

    nbox = REGION_NUM_RECTS(&rgnDst);
    if(nbox &&
	(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {

	pbox = REGION_RECTS(&rgnDst);
	for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
	    ppt->x = pbox->x1 + dx;
	    ppt->y = pbox->y1 + dy;
	}

	SWITCH_DEPTH(8);
	XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
        		&(infoRec->ScratchGC), &rgnDst, pptSrc);

	if(pWin->drawable.bitsPerPixel != 8) {
	    SWITCH_DEPTH(pScrn->depth);
	    XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
        		&(infoRec->ScratchGC), &rgnDst, pptSrc);
	}

	DEALLOCATE_LOCAL(pptSrc);
    }

    REGION_UNINIT(pScreen, &rgnDst);

    if(pWin->drawable.depth == 8) {
      REGION_NULL(pScreen, &rgnDst);
      miSegregateChildren(pWin, &rgnDst, pScrn->depth);
      if(REGION_NOTEMPTY(pScreen, &rgnDst)) {
	REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc);
	nbox = REGION_NUM_RECTS(&rgnDst);
	if(nbox &&
	  (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))){

	    pbox = REGION_RECTS(&rgnDst);
	    for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
		ppt->x = pbox->x1 + dx;
		ppt->y = pbox->y1 + dy;
	    }

	    SWITCH_DEPTH(pScrn->depth);
	    XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
        		&(infoRec->ScratchGC), &rgnDst, pptSrc);
	    DEALLOCATE_LOCAL(pptSrc);
	}
      }
      REGION_UNINIT(pScreen, &rgnDst);
    }
}
Bool
XAAInitDualFramebufferOverlay(
    ScreenPtr pScreen, 
    DepthChangeFuncPtr callback
){
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    XAAOverlayPtr pOverPriv;

    if (XAAOverlayGeneration != serverGeneration) {
	if((XAAOverlayIndex = AllocateScreenPrivateIndex()) < 0)
		return FALSE;

	XAAOverlayGeneration = serverGeneration;
    }
   

    if(!(pOverPriv = xalloc(sizeof(XAAOverlayRec))))
	return FALSE;

    pScreen->devPrivates[XAAOverlayIndex].ptr = (pointer)pOverPriv;

    pOverPriv->pScrn = pScrn;
    pOverPriv->callback = callback;
    pOverPriv->currentDepth = -1;

    /* Overwrite key screen functions.  The XAA core will clean up */

    pScreen->CopyWindow = XAAOverCopyWindow;
    pScreen->PaintWindowBackground = XAAOverPaintWindow;
    pScreen->PaintWindowBorder = XAAOverPaintWindow;
    pScreen->WindowExposures = XAAOverWindowExposures;
    pScreen->BackingStoreFuncs.SaveAreas = XAAOverSaveAreas;
    pScreen->BackingStoreFuncs.RestoreAreas = XAAOverRestoreAreas;

    pOverPriv->StippledFillChooser = infoRec->StippledFillChooser;
    pOverPriv->OpaqueStippledFillChooser = infoRec->OpaqueStippledFillChooser;
    pOverPriv->TiledFillChooser = infoRec->TiledFillChooser;

    infoRec->StippledFillChooser = XAAOverStippledFillChooser;
    infoRec->OpaqueStippledFillChooser = XAAOverOpaqueStippledFillChooser;
    infoRec->TiledFillChooser = XAAOverTiledFillChooser;

    /* wrap all XAA GC rendering */

    pOverPriv->CopyArea = infoRec->CopyArea;
    pOverPriv->CopyPlane = infoRec->CopyPlane;
    pOverPriv->PushPixelsSolid = infoRec->PushPixelsSolid;
    pOverPriv->PolyFillRectSolid = infoRec->PolyFillRectSolid;
    pOverPriv->PolyFillRectStippled = infoRec->PolyFillRectStippled;
    pOverPriv->PolyFillRectOpaqueStippled = infoRec->PolyFillRectOpaqueStippled;
    pOverPriv->PolyFillRectTiled = infoRec->PolyFillRectTiled;
    pOverPriv->FillSpansSolid = infoRec->FillSpansSolid;
    pOverPriv->FillSpansStippled = infoRec->FillSpansStippled;
    pOverPriv->FillSpansOpaqueStippled = infoRec->FillSpansOpaqueStippled;
    pOverPriv->FillSpansTiled = infoRec->FillSpansTiled;
    pOverPriv->PolyText8TE = infoRec->PolyText8TE;
    pOverPriv->PolyText16TE = infoRec->PolyText16TE;
    pOverPriv->ImageText8TE = infoRec->ImageText8TE;
    pOverPriv->ImageText16TE = infoRec->ImageText16TE;
    pOverPriv->ImageGlyphBltTE = infoRec->ImageGlyphBltTE;
    pOverPriv->PolyGlyphBltTE = infoRec->PolyGlyphBltTE;
    pOverPriv->PolyText8NonTE = infoRec->PolyText8NonTE;
    pOverPriv->PolyText16NonTE = infoRec->PolyText16NonTE;
    pOverPriv->ImageText8NonTE = infoRec->ImageText8NonTE;
    pOverPriv->ImageText16NonTE = infoRec->ImageText16NonTE;
    pOverPriv->ImageGlyphBltNonTE = infoRec->ImageGlyphBltNonTE;
    pOverPriv->PolyGlyphBltNonTE = infoRec->PolyGlyphBltNonTE;
    pOverPriv->PolyRectangleThinSolid = infoRec->PolyRectangleThinSolid;
    pOverPriv->PolylinesWideSolid = infoRec->PolylinesWideSolid;
    pOverPriv->PolylinesThinSolid = infoRec->PolylinesThinSolid;
    pOverPriv->PolySegmentThinSolid = infoRec->PolySegmentThinSolid;
    pOverPriv->PolylinesThinDashed = infoRec->PolylinesThinDashed;
    pOverPriv->PolySegmentThinDashed = infoRec->PolySegmentThinDashed;
    pOverPriv->FillPolygonSolid = infoRec->FillPolygonSolid;
    pOverPriv->FillPolygonStippled = infoRec->FillPolygonStippled;
    pOverPriv->FillPolygonOpaqueStippled = infoRec->FillPolygonOpaqueStippled;
    pOverPriv->FillPolygonTiled = infoRec->FillPolygonTiled;
    pOverPriv->PolyFillArcSolid = infoRec->PolyFillArcSolid;
    pOverPriv->PutImage = infoRec->PutImage;


    if(infoRec->CopyArea)
	infoRec->CopyArea = XAAOverCopyArea;
    if(infoRec->CopyPlane)
	infoRec->CopyPlane = XAAOverCopyPlane;
    if(infoRec->PushPixelsSolid)
	infoRec->PushPixelsSolid = XAAOverPushPixelsSolid;
    if(infoRec->PolyFillRectSolid)
	infoRec->PolyFillRectSolid = XAAOverPolyFillRectSolid;
    if(infoRec->PolyFillRectStippled)
	infoRec->PolyFillRectStippled = XAAOverPolyFillRectStippled;
    if(infoRec->PolyFillRectOpaqueStippled)
	infoRec->PolyFillRectOpaqueStippled = XAAOverPolyFillRectOpaqueStippled;
    if(infoRec->PolyFillRectTiled)
	infoRec->PolyFillRectTiled = XAAOverPolyFillRectTiled;
    if(infoRec->FillSpansSolid)
	infoRec->FillSpansSolid = XAAOverFillSpansSolid;
    if(infoRec->FillSpansStippled)
	infoRec->FillSpansStippled = XAAOverFillSpansStippled;
    if(infoRec->FillSpansOpaqueStippled)
	infoRec->FillSpansOpaqueStippled = XAAOverFillSpansOpaqueStippled;
    if(infoRec->FillSpansTiled)
	infoRec->FillSpansTiled = XAAOverFillSpansTiled;
    if(infoRec->PolyText8TE)
	infoRec->PolyText8TE = XAAOverPolyText8TE;
    if(infoRec->PolyText16TE)
	infoRec->PolyText16TE = XAAOverPolyText16TE;
    if(infoRec->ImageText8TE)
	infoRec->ImageText8TE = XAAOverImageText8TE;
    if(infoRec->ImageText16TE)
	infoRec->ImageText16TE = XAAOverImageText16TE;
    if(infoRec->ImageGlyphBltTE)
	infoRec->ImageGlyphBltTE = XAAOverImageGlyphBltTE;
    if(infoRec->PolyGlyphBltTE)
	infoRec->PolyGlyphBltTE = XAAOverPolyGlyphBltTE;
    if(infoRec->PolyText8NonTE)
	infoRec->PolyText8NonTE = XAAOverPolyText8NonTE;
    if(infoRec->PolyText16NonTE)
	infoRec->PolyText16NonTE = XAAOverPolyText16NonTE;
    if(infoRec->ImageText8NonTE)
	infoRec->ImageText8NonTE = XAAOverImageText8NonTE;
    if(infoRec->ImageText16NonTE)
	infoRec->ImageText16NonTE = XAAOverImageText16NonTE;
    if(infoRec->ImageGlyphBltNonTE)
	infoRec->ImageGlyphBltNonTE = XAAOverImageGlyphBltNonTE;
    if(infoRec->PolyGlyphBltNonTE)
	infoRec->PolyGlyphBltNonTE = XAAOverPolyGlyphBltNonTE;
    if(infoRec->PolyRectangleThinSolid)
	infoRec->PolyRectangleThinSolid = XAAOverPolyRectangleThinSolid;
    if(infoRec->PolylinesWideSolid)
	infoRec->PolylinesWideSolid = XAAOverPolylinesWideSolid;
    if(infoRec->PolylinesThinSolid)
	infoRec->PolylinesThinSolid = XAAOverPolylinesThinSolid;
    if(infoRec->PolySegmentThinSolid)
	infoRec->PolySegmentThinSolid = XAAOverPolySegmentThinSolid;
    if(infoRec->PolylinesThinDashed)
	infoRec->PolylinesThinDashed = XAAOverPolylinesThinDashed;
    if(infoRec->PolySegmentThinDashed)
	infoRec->PolySegmentThinDashed = XAAOverPolySegmentThinDashed;
    if(infoRec->FillPolygonSolid)
	infoRec->FillPolygonSolid = XAAOverFillPolygonSolid;
    if(infoRec->FillPolygonStippled)
	infoRec->FillPolygonStippled = XAAOverFillPolygonStippled;
    if(infoRec->FillPolygonOpaqueStippled)
	infoRec->FillPolygonOpaqueStippled = XAAOverFillPolygonOpaqueStippled;
    if(infoRec->FillPolygonTiled)
	infoRec->FillPolygonTiled = XAAOverFillPolygonTiled;
    if(infoRec->PolyFillArcSolid)
	infoRec->PolyFillArcSolid = XAAOverPolyFillArcSolid;
    if(infoRec->PutImage)
	infoRec->PutImage = XAAOverPutImage;

    return TRUE;
}
Esempio n. 14
0
void
XAAOverCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
    ScrnInfoPtr pScrn = infoRec->pScrn;
    DDXPointPtr ppt, pptSrc;
    RegionRec rgnDst;
    BoxPtr pbox;
    int i, nbox, dx, dy;
    WindowPtr pRoot = pScreen->root;

    if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
        XAA_SCREEN_PROLOGUE(pScreen, CopyWindow);
        if (pScrn->vtSema && infoRec->NeedToSync) {
            (*infoRec->Sync) (pScrn);
            infoRec->NeedToSync = FALSE;
        }
        (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
        XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAAOverCopyWindow);
        return;
    }

    infoRec->ScratchGC.alu = GXcopy;
    infoRec->ScratchGC.planemask = ~0;

    RegionNull(&rgnDst);

    dx = ptOldOrg.x - pWin->drawable.x;
    dy = ptOldOrg.y - pWin->drawable.y;
    RegionTranslate(prgnSrc, -dx, -dy);
    RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);

    nbox = RegionNumRects(&rgnDst);
    if (nbox && (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {

        pbox = RegionRects(&rgnDst);
        for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
            ppt->x = pbox->x1 + dx;
            ppt->y = pbox->y1 + dy;
        }

        SWITCH_DEPTH(8);
        XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
                    &(infoRec->ScratchGC), &rgnDst, pptSrc);

        if (pWin->drawable.bitsPerPixel != 8) {
            SWITCH_DEPTH(pScrn->depth);
            XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
                        &(infoRec->ScratchGC), &rgnDst, pptSrc);
        }

        free(pptSrc);
    }

    RegionUninit(&rgnDst);

    if (pWin->drawable.depth == 8) {
        RegionNull(&rgnDst);
        miSegregateChildren(pWin, &rgnDst, pScrn->depth);
        if (RegionNotEmpty(&rgnDst)) {
            RegionIntersect(&rgnDst, &rgnDst, prgnSrc);
            nbox = RegionNumRects(&rgnDst);
            if (nbox &&
                (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {

                pbox = RegionRects(&rgnDst);
                for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
                    ppt->x = pbox->x1 + dx;
                    ppt->y = pbox->y1 + dy;
                }

                SWITCH_DEPTH(pScrn->depth);
                XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
                            &(infoRec->ScratchGC), &rgnDst, pptSrc);
                free(pptSrc);
            }
        }
        RegionUninit(&rgnDst);
    }
}
Esempio n. 15
0
Bool
XAAInitDualFramebufferOverlay(ScreenPtr pScreen, DepthChangeFuncPtr callback)
{
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    XAAOverlayPtr pOverPriv;

    if (!dixRegisterPrivateKey(&XAAOverlayKeyRec, PRIVATE_SCREEN, 0))
        return FALSE;

    if (!(pOverPriv = malloc(sizeof(XAAOverlayRec))))
        return FALSE;

    dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);

    pOverPriv->pScrn = pScrn;
    pOverPriv->callback = callback;
    pOverPriv->currentDepth = -1;

    /* Overwrite key screen functions.  The XAA core will clean up */

    pScreen->CopyWindow = XAAOverCopyWindow;
    pScreen->WindowExposures = XAAOverWindowExposures;

    pOverPriv->StippledFillChooser = infoRec->StippledFillChooser;
    pOverPriv->OpaqueStippledFillChooser = infoRec->OpaqueStippledFillChooser;
    pOverPriv->TiledFillChooser = infoRec->TiledFillChooser;

    infoRec->StippledFillChooser = XAAOverStippledFillChooser;
    infoRec->OpaqueStippledFillChooser = XAAOverOpaqueStippledFillChooser;
    infoRec->TiledFillChooser = XAAOverTiledFillChooser;

    /* wrap all XAA GC rendering */

    pOverPriv->CopyArea = infoRec->CopyArea;
    pOverPriv->CopyPlane = infoRec->CopyPlane;
    pOverPriv->PushPixelsSolid = infoRec->PushPixelsSolid;
    pOverPriv->PolyFillRectSolid = infoRec->PolyFillRectSolid;
    pOverPriv->PolyFillRectStippled = infoRec->PolyFillRectStippled;
    pOverPriv->PolyFillRectOpaqueStippled = infoRec->PolyFillRectOpaqueStippled;
    pOverPriv->PolyFillRectTiled = infoRec->PolyFillRectTiled;
    pOverPriv->FillSpansSolid = infoRec->FillSpansSolid;
    pOverPriv->FillSpansStippled = infoRec->FillSpansStippled;
    pOverPriv->FillSpansOpaqueStippled = infoRec->FillSpansOpaqueStippled;
    pOverPriv->FillSpansTiled = infoRec->FillSpansTiled;
    pOverPriv->PolyText8TE = infoRec->PolyText8TE;
    pOverPriv->PolyText16TE = infoRec->PolyText16TE;
    pOverPriv->ImageText8TE = infoRec->ImageText8TE;
    pOverPriv->ImageText16TE = infoRec->ImageText16TE;
    pOverPriv->ImageGlyphBltTE = infoRec->ImageGlyphBltTE;
    pOverPriv->PolyGlyphBltTE = infoRec->PolyGlyphBltTE;
    pOverPriv->PolyText8NonTE = infoRec->PolyText8NonTE;
    pOverPriv->PolyText16NonTE = infoRec->PolyText16NonTE;
    pOverPriv->ImageText8NonTE = infoRec->ImageText8NonTE;
    pOverPriv->ImageText16NonTE = infoRec->ImageText16NonTE;
    pOverPriv->ImageGlyphBltNonTE = infoRec->ImageGlyphBltNonTE;
    pOverPriv->PolyGlyphBltNonTE = infoRec->PolyGlyphBltNonTE;
    pOverPriv->PolyRectangleThinSolid = infoRec->PolyRectangleThinSolid;
    pOverPriv->PolylinesWideSolid = infoRec->PolylinesWideSolid;
    pOverPriv->PolylinesThinSolid = infoRec->PolylinesThinSolid;
    pOverPriv->PolySegmentThinSolid = infoRec->PolySegmentThinSolid;
    pOverPriv->PolylinesThinDashed = infoRec->PolylinesThinDashed;
    pOverPriv->PolySegmentThinDashed = infoRec->PolySegmentThinDashed;
    pOverPriv->FillPolygonSolid = infoRec->FillPolygonSolid;
    pOverPriv->FillPolygonStippled = infoRec->FillPolygonStippled;
    pOverPriv->FillPolygonOpaqueStippled = infoRec->FillPolygonOpaqueStippled;
    pOverPriv->FillPolygonTiled = infoRec->FillPolygonTiled;
    pOverPriv->PolyFillArcSolid = infoRec->PolyFillArcSolid;
    pOverPriv->PutImage = infoRec->PutImage;

    if (infoRec->CopyArea)
        infoRec->CopyArea = XAAOverCopyArea;
    if (infoRec->CopyPlane)
        infoRec->CopyPlane = XAAOverCopyPlane;
    if (infoRec->PushPixelsSolid)
        infoRec->PushPixelsSolid = XAAOverPushPixelsSolid;
    if (infoRec->PolyFillRectSolid)
        infoRec->PolyFillRectSolid = XAAOverPolyFillRectSolid;
    if (infoRec->PolyFillRectStippled)
        infoRec->PolyFillRectStippled = XAAOverPolyFillRectStippled;
    if (infoRec->PolyFillRectOpaqueStippled)
        infoRec->PolyFillRectOpaqueStippled = XAAOverPolyFillRectOpaqueStippled;
    if (infoRec->PolyFillRectTiled)
        infoRec->PolyFillRectTiled = XAAOverPolyFillRectTiled;
    if (infoRec->FillSpansSolid)
        infoRec->FillSpansSolid = XAAOverFillSpansSolid;
    if (infoRec->FillSpansStippled)
        infoRec->FillSpansStippled = XAAOverFillSpansStippled;
    if (infoRec->FillSpansOpaqueStippled)
        infoRec->FillSpansOpaqueStippled = XAAOverFillSpansOpaqueStippled;
    if (infoRec->FillSpansTiled)
        infoRec->FillSpansTiled = XAAOverFillSpansTiled;
    if (infoRec->PolyText8TE)
        infoRec->PolyText8TE = XAAOverPolyText8TE;
    if (infoRec->PolyText16TE)
        infoRec->PolyText16TE = XAAOverPolyText16TE;
    if (infoRec->ImageText8TE)
        infoRec->ImageText8TE = XAAOverImageText8TE;
    if (infoRec->ImageText16TE)
        infoRec->ImageText16TE = XAAOverImageText16TE;
    if (infoRec->ImageGlyphBltTE)
        infoRec->ImageGlyphBltTE = XAAOverImageGlyphBltTE;
    if (infoRec->PolyGlyphBltTE)
        infoRec->PolyGlyphBltTE = XAAOverPolyGlyphBltTE;
    if (infoRec->PolyText8NonTE)
        infoRec->PolyText8NonTE = XAAOverPolyText8NonTE;
    if (infoRec->PolyText16NonTE)
        infoRec->PolyText16NonTE = XAAOverPolyText16NonTE;
    if (infoRec->ImageText8NonTE)
        infoRec->ImageText8NonTE = XAAOverImageText8NonTE;
    if (infoRec->ImageText16NonTE)
        infoRec->ImageText16NonTE = XAAOverImageText16NonTE;
    if (infoRec->ImageGlyphBltNonTE)
        infoRec->ImageGlyphBltNonTE = XAAOverImageGlyphBltNonTE;
    if (infoRec->PolyGlyphBltNonTE)
        infoRec->PolyGlyphBltNonTE = XAAOverPolyGlyphBltNonTE;
    if (infoRec->PolyRectangleThinSolid)
        infoRec->PolyRectangleThinSolid = XAAOverPolyRectangleThinSolid;
    if (infoRec->PolylinesWideSolid)
        infoRec->PolylinesWideSolid = XAAOverPolylinesWideSolid;
    if (infoRec->PolylinesThinSolid)
        infoRec->PolylinesThinSolid = XAAOverPolylinesThinSolid;
    if (infoRec->PolySegmentThinSolid)
        infoRec->PolySegmentThinSolid = XAAOverPolySegmentThinSolid;
    if (infoRec->PolylinesThinDashed)
        infoRec->PolylinesThinDashed = XAAOverPolylinesThinDashed;
    if (infoRec->PolySegmentThinDashed)
        infoRec->PolySegmentThinDashed = XAAOverPolySegmentThinDashed;
    if (infoRec->FillPolygonSolid)
        infoRec->FillPolygonSolid = XAAOverFillPolygonSolid;
    if (infoRec->FillPolygonStippled)
        infoRec->FillPolygonStippled = XAAOverFillPolygonStippled;
    if (infoRec->FillPolygonOpaqueStippled)
        infoRec->FillPolygonOpaqueStippled = XAAOverFillPolygonOpaqueStippled;
    if (infoRec->FillPolygonTiled)
        infoRec->FillPolygonTiled = XAAOverFillPolygonTiled;
    if (infoRec->PolyFillArcSolid)
        infoRec->PolyFillArcSolid = XAAOverPolyFillArcSolid;
    if (infoRec->PutImage)
        infoRec->PutImage = XAAOverPutImage;

    return TRUE;
}