summaryrefslogtreecommitdiff
path: root/miext
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2009-07-17 15:10:32 -0700
committerAaron Plattner <aplattner@nvidia.com>2009-07-24 13:11:43 -0700
commitc80ed4945ef6dd50473fab871211b71b3d20dc3c (patch)
treea13966a5fbd4bf1ba0dd74adc231f5095bc3ba81 /miext
parentfb46474feb69d52d3dfdd61452ced5cfc38f6651 (diff)
Damage: Add wrappable hooks for damage create, destroy, register, & unregister.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Diffstat (limited to 'miext')
-rw-r--r--miext/damage/damage.c61
-rw-r--r--miext/damage/damage.h20
-rw-r--r--miext/damage/damagestr.h4
3 files changed, 83 insertions, 2 deletions
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index ade67359a..2c7813492 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -1856,6 +1856,25 @@ damageCloseScreen (int i, ScreenPtr pScreen)
}
/**
+ * Default implementations of the damage management functions.
+ */
+void miDamageCreate (DamagePtr pDamage)
+{
+}
+
+void miDamageRegister (DrawablePtr pDrawable, DamagePtr pDamage)
+{
+}
+
+void miDamageUnregister (DrawablePtr pDrawable, DamagePtr pDamage)
+{
+}
+
+void miDamageDestroy (DamagePtr pDamage)
+{
+}
+
+/**
* Public functions for consumption outside this file.
*/
@@ -1866,6 +1885,9 @@ DamageSetup (ScreenPtr pScreen)
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
+ const DamageScreenFuncsRec miFuncs = {
+ miDamageCreate, miDamageRegister, miDamageUnregister, miDamageDestroy
+ };
if (dixLookupPrivate(&pScreen->devPrivates, damageScrPrivateKey))
return TRUE;
@@ -1894,6 +1916,8 @@ DamageSetup (ScreenPtr pScreen)
}
#endif
+ pScrPriv->funcs = miFuncs;
+
dixSetPrivate(&pScreen->devPrivates, damageScrPrivateKey, pScrPriv);
return TRUE;
}
@@ -1906,6 +1930,7 @@ DamageCreate (DamageReportFunc damageReport,
ScreenPtr pScreen,
void *closure)
{
+ damageScrPriv(pScreen);
DamagePtr pDamage;
pDamage = xalloc (sizeof (DamageRec));
@@ -1927,6 +1952,10 @@ DamageCreate (DamageReportFunc damageReport,
pDamage->damageReportPostRendering = NULL;
pDamage->damageDestroy = damageDestroy;
pDamage->damageMarker = NULL;
+ pDamage->pScreen = pScreen;
+
+ (*pScrPriv->funcs.Create) (pDamage);
+
return pDamage;
}
@@ -1934,6 +1963,17 @@ void
DamageRegister (DrawablePtr pDrawable,
DamagePtr pDamage)
{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ damageScrPriv(pScreen);
+
+#if DAMAGE_VALIDATE_ENABLE
+ if (pDrawable->pScreen != pDamage->pScreen)
+ {
+ ErrorF ("DamageRegister called with mismatched screens\n");
+ abort ();
+ }
+#endif
+
if (pDrawable->type == DRAWABLE_WINDOW)
{
WindowPtr pWindow = (WindowPtr) pDrawable;
@@ -1956,6 +1996,7 @@ DamageRegister (DrawablePtr pDrawable,
pDamage->isWindow = FALSE;
pDamage->pDrawable = pDrawable;
damageInsertDamage (getDrawableDamageRef (pDrawable), pDamage);
+ (*pScrPriv->funcs.Register) (pDrawable, pDamage);
}
void
@@ -1970,6 +2011,11 @@ void
DamageUnregister (DrawablePtr pDrawable,
DamagePtr pDamage)
{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ damageScrPriv(pScreen);
+
+ (*pScrPriv->funcs.Unregister) (pDrawable, pDamage);
+
if (pDrawable->type == DRAWABLE_WINDOW)
{
WindowPtr pWindow = (WindowPtr) pDrawable;
@@ -2004,10 +2050,14 @@ DamageUnregister (DrawablePtr pDrawable,
void
DamageDestroy (DamagePtr pDamage)
{
+ ScreenPtr pScreen = pDamage->pScreen;
+ damageScrPriv(pScreen);
+
if (pDamage->damageDestroy)
(*pDamage->damageDestroy) (pDamage, pDamage->closure);
- REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->damage);
- REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->pendingDamage);
+ (*pScrPriv->funcs.Destroy) (pDamage);
+ REGION_UNINIT (pScreen, &pDamage->damage);
+ REGION_UNINIT (pScreen, &pDamage->pendingDamage);
xfree (pDamage);
}
@@ -2111,3 +2161,10 @@ DamageSetPostRenderingFunctions(DamagePtr pDamage, DamageReportFunc damageReport
pDamage->damageReportPostRendering = damageReportPostRendering;
pDamage->damageMarker = damageMarker;
}
+
+DamageScreenFuncsPtr
+DamageGetScreenFuncs (ScreenPtr pScreen)
+{
+ damageScrPriv(pScreen);
+ return &pScrPriv->funcs;
+}
diff --git a/miext/damage/damage.h b/miext/damage/damage.h
index 9ead92567..067016f38 100644
--- a/miext/damage/damage.h
+++ b/miext/damage/damage.h
@@ -43,6 +43,23 @@ typedef void (*DamageDestroyFunc) (DamagePtr pDamage, void *closure);
/* At some point DamageRegionRendered() must be called. */
typedef void (*DamageMarkerFunc) (DrawablePtr pDrawable, DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pRegion, void *closure);
+typedef void (*DamageScreenCreateFunc) (DamagePtr);
+typedef void (*DamageScreenRegisterFunc) (DrawablePtr, DamagePtr);
+typedef void (*DamageScreenUnregisterFunc) (DrawablePtr, DamagePtr);
+typedef void (*DamageScreenDestroyFunc) (DamagePtr);
+
+typedef struct _damageScreenFuncs {
+ DamageScreenCreateFunc Create;
+ DamageScreenRegisterFunc Register;
+ DamageScreenUnregisterFunc Unregister;
+ DamageScreenDestroyFunc Destroy;
+} DamageScreenFuncsRec, *DamageScreenFuncsPtr;
+
+extern _X_EXPORT void miDamageCreate (DamagePtr);
+extern _X_EXPORT void miDamageRegister (DrawablePtr, DamagePtr);
+extern _X_EXPORT void miDamageUnregister (DrawablePtr, DamagePtr);
+extern _X_EXPORT void miDamageDestroy (DamagePtr);
+
extern _X_EXPORT Bool
DamageSetup (ScreenPtr pScreen);
@@ -105,4 +122,7 @@ extern _X_EXPORT void
DamageSetPostRenderingFunctions(DamagePtr pDamage, DamageReportFunc damageReportPostRendering,
DamageMarkerFunc damageMarker);
+extern _X_EXPORT DamageScreenFuncsPtr
+DamageGetScreenFuncs (ScreenPtr);
+
#endif /* _DAMAGE_H_ */
diff --git a/miext/damage/damagestr.h b/miext/damage/damagestr.h
index 559a13659..812075a15 100644
--- a/miext/damage/damagestr.h
+++ b/miext/damage/damagestr.h
@@ -53,6 +53,7 @@ typedef struct _damage {
Bool reportAfter;
RegionRec pendingDamage; /* will be flushed post submission at the latest */
RegionRec backupDamage; /* for use with damageMarker */
+ ScreenPtr pScreen;
} DamageRec;
typedef struct _damageScrPriv {
@@ -75,6 +76,9 @@ typedef struct _damageScrPriv {
GlyphsProcPtr Glyphs;
AddTrapsProcPtr AddTraps;
#endif
+
+ /* Table of wrappable function pointers */
+ DamageScreenFuncsRec funcs;
} DamageScrPrivRec, *DamageScrPrivPtr;
typedef struct _damageGCPriv {