1706f2543Smrg 2706f2543Smrg#ifdef HAVE_XORG_CONFIG_H 3706f2543Smrg#include <xorg-config.h> 4706f2543Smrg#endif 5706f2543Smrg 6706f2543Smrg#include "misc.h" 7706f2543Smrg#include "xf86.h" 8706f2543Smrg#include "xf86_OSproc.h" 9706f2543Smrg 10706f2543Smrg#include <X11/X.h> 11706f2543Smrg#include "scrnintstr.h" 12706f2543Smrg#include "windowstr.h" 13706f2543Smrg#include "xf86str.h" 14706f2543Smrg#include "xaa.h" 15706f2543Smrg#include "xaalocal.h" 16706f2543Smrg#include "xaawrap.h" 17706f2543Smrg#include "gcstruct.h" 18706f2543Smrg#include "pixmapstr.h" 19706f2543Smrg#include "mioverlay.h" 20706f2543Smrg 21706f2543Smrg#ifdef PANORAMIX 22706f2543Smrg#include "panoramiX.h" 23706f2543Smrg#include "panoramiXsrv.h" 24706f2543Smrg#endif 25706f2543Smrg 26706f2543Smrgstatic void 27706f2543SmrgXAACopyWindow8_32( 28706f2543Smrg WindowPtr pWin, 29706f2543Smrg DDXPointRec ptOldOrg, 30706f2543Smrg RegionPtr prgnSrc 31706f2543Smrg){ 32706f2543Smrg DDXPointPtr pptSrc, ppt; 33706f2543Smrg RegionRec rgnDst; 34706f2543Smrg BoxPtr pbox; 35706f2543Smrg int dx, dy, nbox; 36706f2543Smrg WindowPtr pwinRoot; 37706f2543Smrg ScreenPtr pScreen = pWin->drawable.pScreen; 38706f2543Smrg XAAInfoRecPtr infoRec = 39706f2543Smrg GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable)); 40706f2543Smrg Bool doUnderlay = miOverlayCopyUnderlay(pScreen); 41706f2543Smrg RegionPtr borderClip = &pWin->borderClip; 42706f2543Smrg Bool freeReg = FALSE; 43706f2543Smrg 44706f2543Smrg if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt || 45706f2543Smrg (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK)) 46706f2543Smrg { 47706f2543Smrg XAA_SCREEN_PROLOGUE (pScreen, CopyWindow); 48706f2543Smrg if(infoRec->pScrn->vtSema && infoRec->NeedToSync) { 49706f2543Smrg (*infoRec->Sync)(infoRec->pScrn); 50706f2543Smrg infoRec->NeedToSync = FALSE; 51706f2543Smrg } 52706f2543Smrg (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); 53706f2543Smrg XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow8_32); 54706f2543Smrg return; 55706f2543Smrg } 56706f2543Smrg 57706f2543Smrg pwinRoot = pScreen->root; 58706f2543Smrg 59706f2543Smrg if(doUnderlay) 60706f2543Smrg freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip); 61706f2543Smrg 62706f2543Smrg RegionNull(&rgnDst); 63706f2543Smrg 64706f2543Smrg dx = ptOldOrg.x - pWin->drawable.x; 65706f2543Smrg dy = ptOldOrg.y - pWin->drawable.y; 66706f2543Smrg RegionTranslate(prgnSrc, -dx, -dy); 67706f2543Smrg RegionIntersect(&rgnDst, borderClip, prgnSrc); 68706f2543Smrg 69706f2543Smrg pbox = RegionRects(&rgnDst); 70706f2543Smrg nbox = RegionNumRects(&rgnDst); 71706f2543Smrg if(!nbox || 72706f2543Smrg !(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) { 73706f2543Smrg RegionUninit(&rgnDst); 74706f2543Smrg return; 75706f2543Smrg } 76706f2543Smrg ppt = pptSrc; 77706f2543Smrg 78706f2543Smrg while(nbox--) { 79706f2543Smrg ppt->x = pbox->x1 + dx; 80706f2543Smrg ppt->y = pbox->y1 + dy; 81706f2543Smrg ppt++; pbox++; 82706f2543Smrg } 83706f2543Smrg 84706f2543Smrg infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000; 85706f2543Smrg infoRec->ScratchGC.alu = GXcopy; 86706f2543Smrg 87706f2543Smrg XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, 88706f2543Smrg &(infoRec->ScratchGC), &rgnDst, pptSrc); 89706f2543Smrg 90706f2543Smrg free(pptSrc); 91706f2543Smrg RegionUninit(&rgnDst); 92706f2543Smrg if(freeReg) 93706f2543Smrg RegionDestroy(borderClip); 94706f2543Smrg} 95706f2543Smrg 96706f2543Smrgstatic void 97706f2543SmrgXAASetColorKey8_32( 98706f2543Smrg ScreenPtr pScreen, 99706f2543Smrg int nbox, 100706f2543Smrg BoxPtr pbox 101706f2543Smrg){ 102706f2543Smrg XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); 103706f2543Smrg ScrnInfoPtr pScrn = infoRec->pScrn; 104706f2543Smrg 105706f2543Smrg /* I'm counting on writes being clipped away while switched away. 106706f2543Smrg If this isn't going to be true then I need to be wrapping instead. */ 107706f2543Smrg if(!infoRec->pScrn->vtSema) return; 108706f2543Smrg 109706f2543Smrg (*infoRec->FillSolidRects)(pScrn, pScrn->colorKey << 24, GXcopy, 110706f2543Smrg 0xff000000, nbox, pbox); 111706f2543Smrg 112706f2543Smrg SET_SYNC_FLAG(infoRec); 113706f2543Smrg} 114706f2543Smrg 115706f2543Smrgvoid 116706f2543SmrgXAASetupOverlay8_32Planar(ScreenPtr pScreen) 117706f2543Smrg{ 118706f2543Smrg XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); 119706f2543Smrg int i; 120706f2543Smrg 121706f2543Smrg pScreen->CopyWindow = XAACopyWindow8_32; 122706f2543Smrg 123706f2543Smrg if(!(infoRec->FillSolidRectsFlags & NO_PLANEMASK)) 124706f2543Smrg miOverlaySetTransFunction(pScreen, XAASetColorKey8_32); 125706f2543Smrg 126706f2543Smrg infoRec->FullPlanemask = ~0; 127706f2543Smrg for(i = 0; i < 32; i++) /* haven't thought about this much */ 128706f2543Smrg infoRec->FullPlanemasks[i] = ~0; 129706f2543Smrg} 130