diff options
-rw-r--r-- | composite/compalloc.c | 1 | ||||
-rw-r--r-- | composite/compinit.c | 37 | ||||
-rw-r--r-- | composite/compint.h | 13 | ||||
-rw-r--r-- | composite/compwindow.c | 25 | ||||
-rw-r--r-- | dix/colormap.c | 18 | ||||
-rw-r--r-- | fb/fbpict.h | 9 | ||||
-rw-r--r-- | fb/fbwindow.c | 10 | ||||
-rw-r--r-- | render/mipict.c | 128 | ||||
-rw-r--r-- | render/mirect.c | 11 |
9 files changed, 180 insertions, 72 deletions
diff --git a/composite/compalloc.c b/composite/compalloc.c index f63c475a7..8e2881e85 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -460,6 +460,7 @@ compFreePixmap (WindowPtr pWin) { DamageUnregister (&pWin->drawable, cw->damage); cw->damageRegistered = FALSE; + DamageEmpty (cw->damage); } /* * Move the parent-constrained border clip region back into diff --git a/composite/compinit.c b/composite/compinit.c index 759c1d3f9..5109a74fa 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -40,6 +40,7 @@ compCloseScreen (int index, ScreenPtr pScreen) pScreen->CloseScreen = cs->CloseScreen; pScreen->BlockHandler = cs->BlockHandler; + pScreen->InstallColormap = cs->InstallColormap; pScreen->ReparentWindow = cs->ReparentWindow; pScreen->MoveWindow = cs->MoveWindow; pScreen->ResizeWindow = cs->ResizeWindow; @@ -60,6 +61,23 @@ compCloseScreen (int index, ScreenPtr pScreen) } static void +compInstallColormap (ColormapPtr pColormap) +{ + VisualPtr pVisual = pColormap->pVisual; + ScreenPtr pScreen = pColormap->pScreen; + CompScreenPtr cs = GetCompScreen (pScreen); + int a; + + for (a = 0; a < NUM_COMP_ALTERNATE_VISUALS; a++) + if (pVisual->vid == cs->alternateVisuals[a]) + return; + pScreen->InstallColormap = cs->InstallColormap; + (*pScreen->InstallColormap) (pColormap); + cs->InstallColormap = pScreen->InstallColormap; + pScreen->InstallColormap = compInstallColormap; +} + +static void compScreenUpdate (ScreenPtr pScreen) { CompScreenPtr cs = GetCompScreen (pScreen); @@ -126,7 +144,9 @@ typedef struct _alternateVisual { } CompAlternateVisual; static CompAlternateVisual altVisuals[NUM_COMP_ALTERNATE_VISUALS] = { +#if COMP_INCLUDE_RGB24_VISUAL { 24, PICT_r8g8b8 }, +#endif { 32, PICT_a8r8g8b8 }, }; @@ -164,10 +184,6 @@ compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs) continue; /* - * Ok, create a visual id for this format - */ - cs->alternateVisuals[numAlternate] = FakeClientID (0); - /* * Allocate vid list for this depth */ vids[numAlternate] = xalloc (sizeof (VisualID)); @@ -235,6 +251,7 @@ compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs) DepthPtr depth = depths[alt]; PictFormatPtr pPictFormat = pPictFormats[alt]; VisualPtr visual = &visuals[numVisuals + alt]; + unsigned long alphaMask; /* * Initialize the visual @@ -249,16 +266,19 @@ compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs) pPictFormat->direct.green); visual->blueMask = (((unsigned long) pPictFormat->direct.blueMask) << pPictFormat->direct.blue); + alphaMask = (((unsigned long) pPictFormat->direct.alphaMask) << + pPictFormat->direct.alpha); visual->offsetRed = pPictFormat->direct.red; visual->offsetGreen = pPictFormat->direct.green; visual->offsetBlue = pPictFormat->direct.blue; /* - * follow GLX and set nplanes to just the bits - * used for the RGB value, not A + * Include A bits in this (unlike GLX which includes only RGB) + * This lets DIX compute suitable masks for colormap allocations */ visual->nplanes = Ones (visual->redMask | visual->greenMask | - visual->blueMask); + visual->blueMask | + alphaMask); /* * find widest component */ @@ -355,6 +375,9 @@ compScreenInit (ScreenPtr pScreen) cs->ReparentWindow = pScreen->ReparentWindow; pScreen->ReparentWindow = compReparentWindow; + cs->InstallColormap = pScreen->InstallColormap; + pScreen->InstallColormap = compInstallColormap; + cs->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = compBlockHandler; diff --git a/composite/compint.h b/composite/compint.h index 80496da30..78a138a74 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -75,7 +75,15 @@ typedef struct _CompSubwindows { CompClientWindowPtr clients; } CompSubwindowsRec, *CompSubwindowsPtr; +#ifndef COMP_INCLUDE_RGB24_VISUAL +#define COMP_INCLUDE_RGB24_VISUAL 0 +#endif + +#if COMP_INCLUDE_RGB24_VISUAL #define NUM_COMP_ALTERNATE_VISUALS 2 +#else +#define NUM_COMP_ALTERNATE_VISUALS 1 +#endif typedef struct _CompScreen { PositionWindowProcPtr PositionWindow; @@ -99,6 +107,11 @@ typedef struct _CompScreen { */ ReparentWindowProcPtr ReparentWindow; + /* + * Colormaps for new visuals better not get installed + */ + InstallColormapProcPtr InstallColormap; + ScreenBlockHandlerProcPtr BlockHandler; CloseScreenProcPtr CloseScreen; Bool damaged; diff --git a/composite/compwindow.c b/composite/compwindow.c index 29883666e..314593f25 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -667,15 +667,32 @@ compWindowUpdateAutomatic (WindowPtr pWin) &subwindowMode, serverClient, &error); - + + /* + * First move the region from window to screen coordinates + */ REGION_TRANSLATE (pScreen, pRegion, - pSrcPixmap->screen_x, pSrcPixmap->screen_y); + pWin->drawable.x, pWin->drawable.y); + + /* + * Clip against the "real" border clip + */ REGION_INTERSECT (pScreen, pRegion, pRegion, &cw->borderClip); + + /* + * Now translate from screen to pixmap coordinates + */ REGION_TRANSLATE (pScreen, pRegion, -pSrcPixmap->screen_x, -pSrcPixmap->screen_y); + /* + * Clip the picture + */ SetPictureClipRegion (pSrcPicture, 0, 0, pRegion); + /* + * And paint + */ CompositePicture (PictOpSrc, pSrcPicture, 0, @@ -689,6 +706,10 @@ compWindowUpdateAutomatic (WindowPtr pWin) pSrcPixmap->drawable.height); FreePicture (pSrcPicture, 0); FreePicture (pDstPicture, 0); + /* + * Empty the damage region. This has the nice effect of + * rendering the translations above harmless + */ DamageEmpty (cw->damage); } diff --git a/dix/colormap.c b/dix/colormap.c index a0c6b8056..947ffe46d 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/dix/colormap.c,v 1.3 2004/07/31 08:24:13 anholt Exp $ */ +/* $XdotOrg: xc/programs/Xserver/dix/colormap.c,v 1.4 2004/08/07 00:58:21 keithp Exp $ */ /* $XFree86: xc/programs/Xserver/dix/colormap.c,v 3.11 2003/11/03 05:10:59 tsi Exp $ */ /*********************************************************** @@ -190,11 +190,10 @@ static void FindColorInRootCmap ( #define NUMRED(vis) ((vis->redMask >> vis->offsetRed) + 1) #define NUMGREEN(vis) ((vis->greenMask >> vis->offsetGreen) + 1) #define NUMBLUE(vis) ((vis->blueMask >> vis->offsetBlue) + 1) -#if 0 -#define NUMALPHA(vis) XXX cant store in visual because of ABI concerns -#define ALPHAMASK(vis) XXX cant store in visual because of ABI concerns +#if COMPOSITE +#define ALPHAMASK(vis) ((vis)->nplanes < 32 ? 0 : \ + (CARD32) ~((vis)->redMask|(vis)->greenMask|(vis)->blueMask)) #else -#define NUMALPHA(vis) 0 #define ALPHAMASK(vis) 0 #endif @@ -873,9 +872,8 @@ AllocColor (pmap, pred, pgreen, pblue, pPix, client) pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP); *pPix = (pixR << pVisual->offsetRed) | (pixG << pVisual->offsetGreen) | - (pixB << pVisual->offsetBlue); - - *pPix |= ALPHAMASK(pVisual); + (pixB << pVisual->offsetBlue) | + ALPHAMASK(pVisual); *pred = pmap->red[pixR].co.local.red; *pgreen = pmap->green[pixG].co.local.green; @@ -966,9 +964,7 @@ AllocColor (pmap, pred, pgreen, pblue, pPix, client) (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0); return (BadAlloc); } - *pPix = pixR | pixG | pixB; - - *pPix |= ALPHAMASK(pVisual); + *pPix = pixR | pixG | pixB | ALPHAMASK(pVisual); break; } diff --git a/fb/fbpict.h b/fb/fbpict.h index 4b09bc881..82f722c41 100644 --- a/fb/fbpict.h +++ b/fb/fbpict.h @@ -201,15 +201,6 @@ typedef struct _FbAccessMap { */ extern FbAccessMap fbAccessMap[]; -/* fbaddtrap.c */ - -void -fbAddTraps (PicturePtr pPicture, - INT16 xOff, - INT16 yOff, - int ntrap, - xTrap *traps); - /* fbcompose.c */ typedef struct _fbCompSrc { diff --git a/fb/fbwindow.c b/fb/fbwindow.c index 1666dfe16..afc7e510a 100644 --- a/fb/fbwindow.c +++ b/fb/fbwindow.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/fb/fbwindow.c,v 1.2 2004/04/23 19:05:14 eich Exp $ */ +/* $XdotOrg: xc/programs/Xserver/fb/fbwindow.c,v 1.3 2004/08/11 22:40:14 keithp Exp $ */ /* * Id: fbwindow.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * @@ -122,13 +122,13 @@ fbCopyWindow(WindowPtr pWin, { RegionRec rgnDst; int dx, dy; - WindowPtr pwinRoot; #ifdef COMPOSITE PixmapPtr pPixmap = fbGetWindowPixmap (pWin); + DrawablePtr pDrawable = &pPixmap->drawable; +#else + DrawablePtr pDrawable = &WindowTable[pWin->drawable.pScreen->myNum]->drawable; #endif - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; - dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); @@ -143,7 +143,7 @@ fbCopyWindow(WindowPtr pWin, -pPixmap->screen_x, -pPixmap->screen_y); #endif - fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, + fbCopyRegion (pDrawable, pDrawable, 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); diff --git a/render/mipict.c b/render/mipict.c index e642b9910..8e51ebeab 100644 --- a/render/mipict.c +++ b/render/mipict.c @@ -249,8 +249,7 @@ miValidatePicture (PicturePtr pPicture, #define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) static __inline Bool -miClipPictureReg (ScreenPtr pScreen, - RegionPtr pRegion, +miClipPictureReg (RegionPtr pRegion, RegionPtr pClip, int dx, int dy) @@ -276,19 +275,22 @@ miClipPictureReg (ScreenPtr pScreen, REGION_EMPTY(pScreen, pRegion); } } + else if (!REGION_NOTEMPTY (pScreen, pClip)) + return FALSE; else { - REGION_TRANSLATE(pScreen, pRegion, dx, dy); + if (dx || dy) + REGION_TRANSLATE(pScreen, pRegion, -dx, -dy); if (!REGION_INTERSECT (pScreen, pRegion, pRegion, pClip)) return FALSE; - REGION_TRANSLATE(pScreen, pRegion, -dx, -dy); + if (dx || dy) + REGION_TRANSLATE(pScreen, pRegion, dx, dy); } - return TRUE; + return REGION_NOTEMPTY(pScreen, pRegion); } static __inline Bool -miClipPictureSrc (ScreenPtr pScreen, - RegionPtr pRegion, +miClipPictureSrc (RegionPtr pRegion, PicturePtr pPicture, int dx, int dy) @@ -314,11 +316,70 @@ miClipPictureSrc (ScreenPtr pScreen, } else { - return miClipPictureReg (pScreen, pRegion, pPicture->pCompositeClip, - dx, dy); + return miClipPictureReg (pRegion, + pPicture->pCompositeClip, + dx, + dy); + } +} + +static void +miCompositeSourceValidate (PicturePtr pPicture, + INT16 x, + INT16 y, + CARD16 width, + CARD16 height) +{ + DrawablePtr pDrawable = pPicture->pDrawable; + ScreenPtr pScreen = pDrawable->pScreen; + + if (pScreen->SourceValidate) + { + x -= pPicture->pDrawable->x; + y -= pPicture->pDrawable->y; + if (pPicture->transform) + { + xPoint points[4]; + int i; + int xmin, ymin, xmax, ymax; + +#define VectorSet(i,_x,_y) { points[i].x = _x; points[i].y = _y; } + VectorSet (0, x, y); + VectorSet (1, x + width, y); + VectorSet (2, x, y + height); + VectorSet (3, x + width, y + height); + xmin = ymin = 32767; + xmax = ymax = -32737; + for (i = 0; i < 4; i++) + { + PictVector t; + t.vector[0] = IntToxFixed (points[i].x); + t.vector[1] = IntToxFixed (points[i].y); + t.vector[2] = xFixed1; + if (PictureTransformPoint (pPicture->transform, &t)) + { + int tx = xFixedToInt (t.vector[0]); + int ty = xFixedToInt (t.vector[1]); + if (tx < xmin) xmin = tx; + if (tx > xmax) xmax = tx; + if (ty < ymin) ymin = ty; + if (ty > ymax) ymax = ty; + } + } + x = xmin; + y = ymin; + width = xmax - xmin; + height = ymax - ymin; + } + (*pScreen->SourceValidate) (pDrawable, x, y, width, height); } } +/* + * returns FALSE if the final region is empty. Indistinguishable from + * an allocation failure, but rendering ignores those anyways. + */ + Bool miComputeCompositeRegion (RegionPtr pRegion, PicturePtr pSrc, @@ -333,7 +394,6 @@ miComputeCompositeRegion (RegionPtr pRegion, CARD16 width, CARD16 height) { - ScreenPtr pScreen = pSrc->pDrawable->pScreen; int v; pRegion->extents.x1 = xDst; @@ -347,18 +407,34 @@ miComputeCompositeRegion (RegionPtr pRegion, if (pRegion->extents.x1 >= pRegion->extents.x2 || pRegion->extents.y1 >= pRegion->extents.y2) { - REGION_EMPTY (pScreen, pRegion); - return TRUE; + REGION_EMPTY (pDst->pDrawable->pScreen, pRegion); + return FALSE; + } + /* clip against dst */ + if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0)) + { + REGION_UNINIT (pScreen, pRegion); + return FALSE; + } + if (pDst->alphaMap) + { + if (!miClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip, + -pDst->alphaOrigin.x, + -pDst->alphaOrigin.y)) + { + REGION_UNINIT (pScreen, pRegion); + return FALSE; + } } /* clip against src */ - if (!miClipPictureSrc (pScreen, pRegion, pSrc, xDst - xSrc, yDst - ySrc)) + if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc)) { REGION_UNINIT (pScreen, pRegion); return FALSE; } if (pSrc->alphaMap) { - if (!miClipPictureSrc (pScreen, pRegion, pSrc->alphaMap, + if (!miClipPictureSrc (pRegion, pSrc->alphaMap, xDst - (xSrc + pSrc->alphaOrigin.x), yDst - (ySrc + pSrc->alphaOrigin.y))) { @@ -369,15 +445,14 @@ miComputeCompositeRegion (RegionPtr pRegion, /* clip against mask */ if (pMask) { - if (!miClipPictureSrc (pScreen, pRegion, pMask, - xDst - xMask, yDst - yMask)) + if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask)) { REGION_UNINIT (pScreen, pRegion); return FALSE; } if (pMask->alphaMap) { - if (!miClipPictureSrc (pScreen, pRegion, pMask->alphaMap, + if (!miClipPictureSrc (pRegion, pMask->alphaMap, xDst - (xMask + pMask->alphaOrigin.x), yDst - (yMask + pMask->alphaOrigin.y))) { @@ -386,22 +461,9 @@ miComputeCompositeRegion (RegionPtr pRegion, } } } - if (!miClipPictureReg (pScreen, pRegion, pDst->pCompositeClip, 0, 0)) - { - REGION_UNINIT (pScreen, pRegion); - return FALSE; - } - if (pDst->alphaMap) - { - if (!miClipPictureReg (pScreen, - pRegion, pDst->alphaMap->pCompositeClip, - -pDst->alphaOrigin.x, - -pDst->alphaOrigin.y)) - { - REGION_UNINIT (pScreen, pRegion); - return FALSE; - } - } + miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height); + if (pMask) + miCompositeSourceValidate (pMask, xMask, yMask, width, height); return TRUE; } diff --git a/render/mirect.c b/render/mirect.c index 63e9c7cc4..bb50e8583 100644 --- a/render/mirect.c +++ b/render/mirect.c @@ -42,7 +42,7 @@ miColorRects (PicturePtr pDst, ScreenPtr pScreen = pDst->pDrawable->pScreen; CARD32 pixel; GCPtr pGC; - CARD32 tmpval[4]; + CARD32 tmpval[5]; RegionPtr pClip; unsigned long mask; @@ -53,12 +53,13 @@ miColorRects (PicturePtr pDst, return; tmpval[0] = GXcopy; tmpval[1] = pixel; - mask = GCFunction | GCForeground; + tmpval[2] = pDst->subWindowMode; + mask = GCFunction | GCForeground | GCSubwindowMode; if (pClipPict->clientClipType == CT_REGION) { - tmpval[2] = pDst->clipOrigin.x - xoff; - tmpval[3] = pDst->clipOrigin.y - yoff; - mask |= CPClipXOrigin|CPClipYOrigin; + tmpval[3] = pDst->clipOrigin.x - xoff; + tmpval[4] = pDst->clipOrigin.y - yoff; + mask |= GCClipXOrigin|GCClipYOrigin; pClip = REGION_CREATE (pScreen, NULL, 1); REGION_COPY (pScreen, pClip, |