1 2#ifdef HAVE_XORG_CONFIG_H 3#include <xorg-config.h> 4#endif 5 6#include "misc.h" 7#include "xf86.h" 8#include "xf86_OSproc.h" 9 10#include <X11/X.h> 11#include "scrnintstr.h" 12#include "windowstr.h" 13#include "xf86str.h" 14#include "xaa.h" 15#include "xaalocal.h" 16#include "xaawrap.h" 17#include "gcstruct.h" 18#include "pixmapstr.h" 19#include "mioverlay.h" 20 21#ifdef PANORAMIX 22#include "panoramiX.h" 23#include "panoramiXsrv.h" 24#endif 25 26static void 27XAACopyWindow8_32( 28 WindowPtr pWin, 29 DDXPointRec ptOldOrg, 30 RegionPtr prgnSrc 31){ 32 DDXPointPtr pptSrc, ppt; 33 RegionRec rgnDst; 34 BoxPtr pbox; 35 int dx, dy, nbox; 36 WindowPtr pwinRoot; 37 ScreenPtr pScreen = pWin->drawable.pScreen; 38 XAAInfoRecPtr infoRec = 39 GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable)); 40 Bool doUnderlay = miOverlayCopyUnderlay(pScreen); 41 RegionPtr borderClip = &pWin->borderClip; 42 Bool freeReg = FALSE; 43 44 if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt || 45 (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK)) 46 { 47 XAA_SCREEN_PROLOGUE (pScreen, CopyWindow); 48 if(infoRec->pScrn->vtSema && infoRec->NeedToSync) { 49 (*infoRec->Sync)(infoRec->pScrn); 50 infoRec->NeedToSync = FALSE; 51 } 52 (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); 53 XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow8_32); 54 return; 55 } 56 57 pwinRoot = pScreen->root; 58 59 if(doUnderlay) 60 freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip); 61 62 RegionNull(&rgnDst); 63 64 dx = ptOldOrg.x - pWin->drawable.x; 65 dy = ptOldOrg.y - pWin->drawable.y; 66 RegionTranslate(prgnSrc, -dx, -dy); 67 RegionIntersect(&rgnDst, borderClip, prgnSrc); 68 69 pbox = RegionRects(&rgnDst); 70 nbox = RegionNumRects(&rgnDst); 71 if(!nbox || 72 !(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) { 73 RegionUninit(&rgnDst); 74 return; 75 } 76 ppt = pptSrc; 77 78 while(nbox--) { 79 ppt->x = pbox->x1 + dx; 80 ppt->y = pbox->y1 + dy; 81 ppt++; pbox++; 82 } 83 84 infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000; 85 infoRec->ScratchGC.alu = GXcopy; 86 87 XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, 88 &(infoRec->ScratchGC), &rgnDst, pptSrc); 89 90 free(pptSrc); 91 RegionUninit(&rgnDst); 92 if(freeReg) 93 RegionDestroy(borderClip); 94} 95 96static void 97XAASetColorKey8_32( 98 ScreenPtr pScreen, 99 int nbox, 100 BoxPtr pbox 101){ 102 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); 103 ScrnInfoPtr pScrn = infoRec->pScrn; 104 105 /* I'm counting on writes being clipped away while switched away. 106 If this isn't going to be true then I need to be wrapping instead. */ 107 if(!infoRec->pScrn->vtSema) return; 108 109 (*infoRec->FillSolidRects)(pScrn, pScrn->colorKey << 24, GXcopy, 110 0xff000000, nbox, pbox); 111 112 SET_SYNC_FLAG(infoRec); 113} 114 115void 116XAASetupOverlay8_32Planar(ScreenPtr pScreen) 117{ 118 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); 119 int i; 120 121 pScreen->CopyWindow = XAACopyWindow8_32; 122 123 if(!(infoRec->FillSolidRectsFlags & NO_PLANEMASK)) 124 miOverlaySetTransFunction(pScreen, XAASetColorKey8_32); 125 126 infoRec->FullPlanemask = ~0; 127 for(i = 0; i < 32; i++) /* haven't thought about this much */ 128 infoRec->FullPlanemasks[i] = ~0; 129} 130