xserver/miext/damage damage.c, 1.13, 1.14 damage.h, 1.4,
1.5 damagestr.h, 1.3, 1.4
Keith Packard
xserver-commit at pdx.freedesktop.org
Tue Feb 8 14:39:26 PST 2005
- Previous message: xserver/miext/shadow shadow.c,1.17,1.18
- Next message: xserver/composite compalloc.c, 1.9, 1.10 compinit.c, 1.14,
1.15 compint.h, 1.9, 1.10 compwindow.c, 1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /cvs/xserver/xserver/miext/damage
In directory gabe:/tmp/cvs-serv18301/miext/damage
Modified Files:
damage.c damage.h damagestr.h
Log Message:
2005-02-08 Keith Packard <keithp at keithp.com>
* composite/compalloc.c: (compRedirectWindow), (compNewPixmap),
(compAllocPixmap), (compFreePixmap), (compReallocPixmap):
* composite/compinit.c: (compCloseScreen), (compInstallColormap),
(compAddAlternateVisuals), (compScreenInit):
* composite/compint.h:
* composite/compwindow.c: (compRepaintBorder),
(compSetPixmapVisitWindow), (compCheckRedirect),
(compPositionWindow), (compCopyWindow),
(compSetRedirectBorderClip), (compWindowUpdateAutomatic):
Avoid telling DDX about colormaps for synthetic visuals
Fix border repainting on resize.
Change pixmap allocation around
* damageext/damageext.c: (DamageExtReport), (ProcDamageCreate),
(ProcDamageSubtract):
* dix/colormap.c: (CopyFree), (AllocColor), (AllocDirect):
* fb/fbcmap.c: (fbInitVisuals):
Change where the 'alpha bits' live in visuals.
* include/regionstr.h:
* include/scrnintstr.h:
* mi/misprite.c:
* miext/damage/damage.c: (getDrawableDamageRef),
(damageDamageRegion), (damageCreateGC), (damageCopyArea),
(damageCopyPlane), (damageRemoveDamage), (damageInsertDamage),
(damageDestroyPixmap), (damageSetWindowPixmap), (DamageSetup),
(DamageCreate), (DamageRegister), (DamageUnregister),
(DamageDestroy), (DamageSubtract), (DamageEmpty):
* miext/damage/damage.h:
* miext/damage/damagestr.h:
* miext/shadow/shadow.c: (shadowSetup):
Check for NULL pCompositeClip in damage code.
Call SourceValidate for self CopyArea/CopyPlane
Change damageInsertDamage API so it doesn't require a pixmap
Index: damage.c
===================================================================
RCS file: /cvs/xserver/xserver/miext/damage/damage.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- damage.c 25 Jan 2005 22:44:53 -0000 1.13
+++ damage.c 8 Feb 2005 22:39:20 -0000 1.14
@@ -61,30 +61,44 @@
#define DAMAGE_DEBUG(x)
#endif
-static PixmapPtr
-GetDrawablePixmap (DrawablePtr pDrawable)
+#define getPixmapDamageRef(pPixmap) \
+ ((DamagePtr *) &(pPixmap->devPrivates[damagePixPrivateIndex].ptr))
+
+#define pixmapDamage(pPixmap) damagePixPriv(pPixmap)
+
+static DamagePtr *
+getDrawableDamageRef (DrawablePtr pDrawable)
{
- ScreenPtr pScreen = pDrawable->pScreen;
- PixmapPtr pPixmap;
+ PixmapPtr pPixmap;
+
if (pDrawable->type == DRAWABLE_WINDOW)
{
- pPixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ pPixmap = 0;
+ if (pScreen->GetWindowPixmap)
+ pPixmap = (*pScreen->GetWindowPixmap) ((WindowPtr)pDrawable);
+
if (!pPixmap)
- pPixmap = (*pScreen->GetScreenPixmap) (pDrawable->pScreen);
+ {
+ damageScrPriv(pScreen);
+
+ return &pScrPriv->pScreenDamage;
+ }
}
else
pPixmap = (PixmapPtr) pDrawable;
- return pPixmap;
+ return getPixmapDamageRef (pPixmap);
}
-#define pixmapDamage(pPixmap) damagePixPriv(pPixmap)
-#define drawableDamage(pDrawable) damagePixPriv(GetDrawablePixmap(pDrawable))
-#define windowDamage(pWin) drawableDamage(&(pWin)->drawable)
-#define getDrawableDamage(pDrawable) damageGetPixPriv(GetDrawablePixmap(pDrawable))
-#define getWindowDamage(pWin) getDrawableDamage(&(pWin)->drawable)
-#define pixDamageRef(pPixmap) \
- DamagePtr *pPrev = (DamagePtr *) \
- &(pPixmap->devPrivates[damagePixPrivateIndex].ptr)
+#define getDrawableDamage(pDrawable) (*getDrawableDamageRef (pDrawable))
+#define getWindowDamage(pWin) getDrawableDamage(&(pWin)->drawable)
+
+#define drawableDamage(pDrawable) \
+ DamagePtr pDamage = getDrawableDamage(pDrawable)
+
+#define windowDamage(pWin) drawableDamage(&(pWin)->drawable)
+
#define winDamageRef(pWindow) \
DamagePtr *pPrev = (DamagePtr *) \
&(pWindow->devPrivates[damageWinPrivateIndex].ptr)
@@ -98,7 +112,8 @@
damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip)
#endif
{
- damageScrPriv(pDrawable->pScreen);
+ ScreenPtr pScreen = pDrawable->pScreen;
+ damageScrPriv(pScreen);
drawableDamage(pDrawable);
DamagePtr pNext;
RegionPtr pClip;
@@ -125,14 +140,14 @@
*/
if (pDrawable->type != DRAWABLE_WINDOW)
{
- screen_x = ((PixmapPtr) pDrawable)->screen_x;
- screen_y = ((PixmapPtr) pDrawable)->screen_y;
+ screen_x = ((PixmapPtr) pDrawable)->screen_x - pDrawable->x;
+ screen_y = ((PixmapPtr) pDrawable)->screen_y - pDrawable->y;
}
if (screen_x || screen_y)
- REGION_TRANSLATE (pScreen, pRegion, screen_x, screen_y);
+ REGION_TRANSLATE (pScreen, pRegion, screen_x, screen_y);
#endif
- REGION_INIT (pScreen, &clippedRec, NullBox, 0);
+ REGION_NULL (pScreen, &clippedRec);
for (; pDamage; pDamage = pNext)
{
pNext = pDamage->pNext;
@@ -151,7 +166,9 @@
if (pDamage->pDrawable->type == DRAWABLE_WINDOW &&
!((WindowPtr) (pDamage->pDrawable))->realized)
{
+#if 0
DAMAGE_DEBUG (("damage while window unrealized\n"));
+#endif
continue;
}
@@ -197,10 +214,12 @@
continue;
}
- DAMAGE_DEBUG (("%s %d x %d +%d +%d\n", where,
+ DAMAGE_DEBUG (("%s %d x %d +%d +%d (target 0x%lx monitor 0x%lx)\n",
+ where,
pDamageRegion->extents.x2 - pDamageRegion->extents.x1,
pDamageRegion->extents.y2 - pDamageRegion->extents.y1,
- pDamageRegion->extents.x1, pDamageRegion->extents.y1));
+ pDamageRegion->extents.x1, pDamageRegion->extents.y1,
+ pDrawable->id, pDamage->pDrawable->id));
/*
* Move region to target coordinate space
@@ -213,7 +232,7 @@
(*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure);
break;
case DamageReportDeltaRegion:
- REGION_INIT (pScreen, &tmpRegion, NullBox, 0);
+ REGION_NULL (pScreen, &tmpRegion);
REGION_SUBTRACT (pScreen, &tmpRegion, pDamageRegion, &pDamage->damage);
if (REGION_NOTEMPTY (pScreen, &tmpRegion))
{
@@ -298,6 +317,7 @@
damageGCPriv(pGC);
Bool ret;
+ pGC->pCompositeClip = 0;
unwrap (pScrPriv, pScreen, CreateGC);
if((ret = (*pScreen->CreateGC) (pGC))) {
pGCPriv->ops = NULL;
@@ -309,7 +329,7 @@
return ret;
}
-#if NOTUSED
+#ifdef NOTUSED
static void
damageWrapGC (GCPtr pGC)
{
@@ -415,7 +435,7 @@
DAMAGE_GC_FUNC_EPILOGUE (pGC);
}
-#define TRIM_BOX(box, pGC) { \
+#define TRIM_BOX(box, pGC) if (pGC->pCompositeClip) { \
BoxPtr extents = &pGC->pCompositeClip->extents;\
if(box.x1 < extents->x1) box.x1 = extents->x1; \
if(box.x2 > extents->x2) box.x2 = extents->x2; \
@@ -439,7 +459,9 @@
(((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
#define checkGCDamage(d,g) (getDrawableDamage(d) && \
- REGION_NOTEMPTY(pScreen, g->pCompositeClip))
+ (!g->pCompositeClip ||\
+ REGION_NOTEMPTY(d->pScreen, \
+ g->pCompositeClip)))
#ifdef RENDER
@@ -710,6 +732,12 @@
RegionPtr ret;
DAMAGE_GC_OP_PROLOGUE(pGC, pDst);
+ /* The driver will only call SourceValidate() when pSrc != pDst,
+ * but the software sprite (misprite.c) always need to know when a
+ * drawable is copied so it can remove the sprite. See #1030. */
+ if ((pSrc == pDst) && pSrc->pScreen->SourceValidate)
+ (*pSrc->pScreen->SourceValidate) (pSrc, srcx, srcy, width, height);
+
if (checkGCDamage (pDst, pGC))
{
BoxRec box;
@@ -744,6 +772,13 @@
{
RegionPtr ret;
DAMAGE_GC_OP_PROLOGUE(pGC, pDst);
+
+ /* The driver will only call SourceValidate() when pSrc != pDst,
+ * but the software sprite (misprite.c) always need to know when a
+ * drawable is copied so it can remove the sprite. See #1030. */
+ if ((pSrc == pDst) && pSrc->pScreen->SourceValidate)
+ (*pSrc->pScreen->SourceValidate) (pSrc, srcx, srcy, width, height);
+
if (checkGCDamage (pDst, pGC))
{
BoxRec box;
@@ -1441,10 +1476,8 @@
}
static void
-damageRemoveDamage (PixmapPtr pPixmap, DamagePtr pDamage)
+damageRemoveDamage (DamagePtr *pPrev, DamagePtr pDamage)
{
- pixDamageRef (pPixmap);
-
while (*pPrev)
{
if (*pPrev == pDamage)
@@ -1461,10 +1494,8 @@
}
static void
-damageInsertDamage (PixmapPtr pPixmap, DamagePtr pDamage)
+damageInsertDamage (DamagePtr *pPrev, DamagePtr pDamage)
{
- pixDamageRef (pPixmap);
-
#if DAMAGE_VALIDATE_ENABLE
DamagePtr pOld;
@@ -1483,13 +1514,15 @@
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
damageScrPriv(pScreen);
- DamagePtr pDamage;
if (pPixmap->refcnt == 1)
{
- while ((pDamage = damageGetPixPriv(pPixmap)))
+ DamagePtr *pPrev = getPixmapDamageRef (pPixmap);
+ DamagePtr pDamage;
+
+ while ((pDamage = *pPrev))
{
- damageRemoveDamage (pPixmap, pDamage);
+ damageRemoveDamage (pPrev, pDamage);
if (!pDamage->isWindow)
DamageDestroy (pDamage);
}
@@ -1598,9 +1631,11 @@
if ((pDamage = damageGetWinPriv(pWindow)))
{
PixmapPtr pOldPixmap = (*pScreen->GetWindowPixmap) (pWindow);
+ DamagePtr *pPrev = getPixmapDamageRef(pOldPixmap);
+
while (pDamage)
{
- damageRemoveDamage (pOldPixmap, pDamage);
+ damageRemoveDamage (pPrev, pDamage);
pDamage = pDamage->pNextWin;
}
}
@@ -1609,9 +1644,11 @@
wrap (pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
if ((pDamage = damageGetWinPriv(pWindow)))
{
+ DamagePtr *pPrev = getPixmapDamageRef(pPixmap);
+
while (pDamage)
{
- damageInsertDamage (pPixmap, pDamage);
+ damageInsertDamage (pPrev, pDamage);
pDamage = pDamage->pNextWin;
}
}
@@ -1696,7 +1733,18 @@
if (!pScrPriv)
return FALSE;
+#ifdef COMPOSITE_WRAPPER
+ /* This is a kludge to ensure wrapping order with the composite wrapper.
+ * If it's done from compinit.c, then DamageSetup may be called before the
+ * extension init phase, so that cw will be higher in the wrapping chain and
+ * rewrite drawables before damage gets to it, causing confusion.
+ */
+ if (!noCompositeExtension)
+ miInitializeCompositeWrapper (pScreen);
+#endif
+
pScrPriv->internalLevel = 0;
+ pScrPriv->pScreenDamage = 0;
wrap (pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
wrap (pScrPriv, pScreen, CreateGC, damageCreateGC);
@@ -1724,6 +1772,7 @@
DamageDestroyFunc damageDestroy,
DamageReportLevel damageLevel,
Bool isInternal,
+ ScreenPtr pScreen,
void *closure)
{
DamagePtr pDamage;
@@ -1733,7 +1782,7 @@
return 0;
pDamage->pNext = 0;
pDamage->pNextWin = 0;
- REGION_INIT(pScreen, &pDamage->damage, NullBox, 0);
+ REGION_NULL(pScreen, &pDamage->damage);
pDamage->damageLevel = damageLevel;
pDamage->isInternal = isInternal;
@@ -1771,7 +1820,7 @@
else
pDamage->isWindow = FALSE;
pDamage->pDrawable = pDrawable;
- damageInsertDamage (GetDrawablePixmap (pDrawable), pDamage);
+ damageInsertDamage (getDrawableDamageRef (pDrawable), pDamage);
}
void
@@ -1814,7 +1863,7 @@
#endif
}
pDamage->pDrawable = 0;
- damageRemoveDamage (GetDrawablePixmap (pDrawable), pDamage);
+ damageRemoveDamage (getDrawableDamageRef (pDrawable), pDamage);
}
void
@@ -1822,7 +1871,7 @@
{
if (pDamage->damageDestroy)
(*pDamage->damageDestroy) (pDamage, pDamage->closure);
- REGION_UNINIT (pScreen, &pDamage->damage);
+ REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->damage);
xfree (pDamage);
}
@@ -1834,7 +1883,7 @@
RegionRec pixmapClip;
DrawablePtr pDrawable = pDamage->pDrawable;
- REGION_SUBTRACT (pScreen, &pDamage->damage, &pDamage->damage, pRegion);
+ REGION_SUBTRACT (pDrawable->pScreen, &pDamage->damage, &pDamage->damage, pRegion);
if (pDrawable)
{
if (pDrawable->type == DRAWABLE_WINDOW)
@@ -1847,20 +1896,20 @@
box.y1 = pDrawable->y;
box.x2 = pDrawable->x + pDrawable->width;
box.y2 = pDrawable->y + pDrawable->height;
- REGION_INIT (pScren, &pixmapClip, &box, 1);
+ REGION_INIT (pDrawable->pScreen, &pixmapClip, &box, 1);
pClip = &pixmapClip;
}
- REGION_TRANSLATE (pScreen, &pDamage->damage, pDrawable->x, pDrawable->y);
- REGION_INTERSECT (pScreen, &pDamage->damage, &pDamage->damage, pClip);
- REGION_TRANSLATE (pScreen, &pDamage->damage, -pDrawable->x, -pDrawable->y);
+ REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, pDrawable->x, pDrawable->y);
+ REGION_INTERSECT (pDrawable->pScreen, &pDamage->damage, &pDamage->damage, pClip);
+ REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, -pDrawable->x, -pDrawable->y);
}
- return REGION_NOTEMPTY (pScreen, &pDamage->damage);
+ return REGION_NOTEMPTY (pDrawable->pScreen, &pDamage->damage);
}
void
DamageEmpty (DamagePtr pDamage)
{
- REGION_EMPTY (pScreen, &pDamage->damage);
+ REGION_EMPTY (pDamage->pDrawable->pScreen, &pDamage->damage);
}
RegionPtr
Index: damage.h
===================================================================
RCS file: /cvs/xserver/xserver/miext/damage/damage.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- damage.h 8 Jul 2004 06:52:44 -0000 1.4
+++ damage.h 8 Feb 2005 22:39:20 -0000 1.5
@@ -46,7 +46,8 @@
DamageDestroyFunc damageDestroy,
DamageReportLevel damageLevel,
Bool isInternal,
- void *closure);
+ ScreenPtr pScreen,
+ void * closure);
void
DamageDrawInternal (ScreenPtr pScreen, Bool enable);
Index: damagestr.h
===================================================================
RCS file: /cvs/xserver/xserver/miext/damage/damagestr.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- damagestr.h 9 Nov 2003 07:05:59 -0000 1.3
+++ damagestr.h 8 Feb 2005 22:39:20 -0000 1.4
@@ -46,6 +46,12 @@
typedef struct _damageScrPriv {
int internalLevel;
+ /*
+ * For DDXen which don't provide GetScreenPixmap, this provides
+ * a place to hook damage for windows on the screen
+ */
+ DamagePtr pScreenDamage;
+
PaintWindowBackgroundProcPtr PaintWindowBackground;
PaintWindowBorderProcPtr PaintWindowBorder;
CopyWindowProcPtr CopyWindow;
- Previous message: xserver/miext/shadow shadow.c,1.17,1.18
- Next message: xserver/composite compalloc.c, 1.9, 1.10 compinit.c, 1.14,
1.15 compint.h, 1.9, 1.10 compwindow.c, 1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the xserver-commit
mailing list