Implement core protocol backing store exclusively in terms of Composite.

Composite's automatic redirection is a more general mechanism than the
ad-hoc BS machinery, so it's much prettier to implement the one in terms
of the other.  Composite now wraps ChangeWindowAttributes and activates
automatic redirection for windows with backing store requested.  The old
backing store infrastructure is completely gutted: ABI-visible structures
retain the function pointers, but they never get called, and all the
open-coded conditionals throughout the DIX layer to implement BS are gone.

Note that this is still not a strictly complete implementation of backing
store, since Composite will throw the bits away on unmap and therefore
WhenMapped and Always hints are equivalent.
This commit is contained in:
Adam Jackson 2007-08-25 15:08:20 -04:00
commit ae7f71a8b3
67 changed files with 80 additions and 5959 deletions

View file

@ -1025,8 +1025,6 @@ miOverlayWindowExposures(
RegionPtr exposures = prgn;
ScreenPtr pScreen = pWin->drawable.pScreen;
if (pWin->backStorage && prgn)
exposures = (*pScreen->RestoreAreas)(pWin, prgn);
if ((prgn && !REGION_NIL(prgn)) ||
(exposures && !REGION_NIL(exposures)) || other_exposed)
{
@ -1066,16 +1064,6 @@ miOverlayWindowExposures(
REGION_INTERSECT(pScreen, prgn, prgn, &pTree->clipList);
} else
REGION_INTERSECT(pScreen, prgn, prgn, &pWin->clipList);
/* need to clear out new areas of backing store, too */
if (pWin->backStorage)
(void) (*pScreen->ClearBackingStore)(
pWin,
box.x1 - pWin->drawable.x,
box.y1 - pWin->drawable.y,
box.x2 - box.x1,
box.y2 - box.y1,
FALSE);
}
if (prgn && !REGION_NIL(prgn))
(*pScreen->PaintWindowBackground)(
@ -1172,7 +1160,6 @@ miOverlayResizeWindow(
RegionPtr oldWinClip = NULL, oldWinClip2 = NULL;
RegionPtr borderVisible = NullRegion;
RegionPtr borderVisible2 = NullRegion;
RegionPtr bsExposed = NullRegion; /* backing store exposures */
Bool shrunk = FALSE; /* shrunk in an inner dimension */
Bool moved = FALSE; /* window position changed */
#ifdef DO_SAVE_UNDERS
@ -1299,8 +1286,6 @@ miOverlayResizeWindow(
if (WasViewable) {
pRegion = REGION_CREATE(pScreen, NullBox, 1);
if (pWin->backStorage)
REGION_COPY(pScreen, pRegion, &pWin->clipList);
(*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, NULL);
@ -1326,17 +1311,6 @@ miOverlayResizeWindow(
GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny);
if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) {
if (!WasViewable)
pRegion = &pWin->clipList; /* a convenient empty region */
if (pWin->bitGravity == ForgetGravity)
bsExposed = (*pScreen->TranslateBackingStore)
(pWin, 0, 0, NullRegion, oldx, oldy);
else
bsExposed = (*pScreen->TranslateBackingStore)
(pWin, nx - x, ny - y, pRegion, oldx, oldy);
}
if (WasViewable) {
miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
miOverlayTwoRegions TwoRegions;
@ -1544,16 +1518,6 @@ miOverlayResizeWindow(
REGION_DESTROY(pScreen, destClip);
if (destClip2)
REGION_DESTROY(pScreen, destClip2);
if (bsExposed) {
RegionPtr valExposed = NullRegion;
if (pWin->valdata)
valExposed = &pWin->valdata->after.exposed;
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
if (valExposed)
REGION_EMPTY(pScreen, valExposed);
REGION_DESTROY(pScreen, bsExposed);
}
(*pScreen->HandleExposures)(pWin->parent);
#ifdef DO_SAVE_UNDERS
if (dosave)
@ -1562,10 +1526,6 @@ miOverlayResizeWindow(
if (pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pWin->parent, pFirstChange, VTOther);
}
else if (bsExposed) {
(*pScreen->WindowExposures) (pWin, NullRegion, bsExposed);
REGION_DESTROY(pScreen, bsExposed);
}
if (pWin->realized)
WindowsRestructured ();
}
@ -1577,7 +1537,7 @@ miOverlaySetShape(WindowPtr pWin)
{
Bool WasViewable = (Bool)(pWin->viewable);
ScreenPtr pScreen = pWin->drawable.pScreen;
RegionPtr pOldClip = NULL, bsExposed;
RegionPtr pOldClip = NULL;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
@ -1611,11 +1571,6 @@ miOverlaySetShape(WindowPtr pWin)
ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
if (WasViewable) {
if (pWin->backStorage) {
pOldClip = REGION_CREATE(pScreen, NullBox, 1);
REGION_COPY(pScreen, pOldClip, &pWin->clipList);
}
(*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
#ifdef DO_SAVE_UNDERS
@ -1626,26 +1581,6 @@ miOverlaySetShape(WindowPtr pWin)
(*pScreen->ValidateTree)(pWin->parent, NullWindow, VTOther);
}
if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) {
if (!WasViewable)
pOldClip = &pWin->clipList; /* a convenient empty region */
bsExposed = (*pScreen->TranslateBackingStore)
(pWin, 0, 0, pOldClip,
pWin->drawable.x, pWin->drawable.y);
if (WasViewable)
REGION_DESTROY(pScreen, pOldClip);
if (bsExposed)
{
RegionPtr valExposed = NullRegion;
if (pWin->valdata)
valExposed = &pWin->valdata->after.exposed;
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
if (valExposed)
REGION_EMPTY(pScreen, valExposed);
REGION_DESTROY(pScreen, bsExposed);
}
}
if (WasViewable) {
(*pScreen->HandleExposures)(pWin->parent);
#ifdef DO_SAVE_UNDERS
@ -1798,10 +1733,6 @@ miOverlayClearToBackground(
box.y1 = y1; box.y2 = y2;
REGION_INIT(pScreen, &reg, &box, 1);
if (pWin->backStorage) {
pBSReg = (* pScreen->ClearBackingStore)(pWin, x, y, w, h,
generateExposures);
}
REGION_INTERSECT(pScreen, &reg, &reg, clipList);
if (generateExposures)