From: Ville Syrjälä <[email protected]> Rename compScreenUpdate to compChildrenUpdate, and pass a window as the parameter. This allows an arbitrary subtree to be updated, instead of having to update all the windows. This will be used to make sure all the children have been updated when the parent window contents need to be accessed in IncludeInferios sub-window mode.
WindowRec has a new member 'damagedDescendants' that is used to keep track of which subtrees need updating. When a window is damaged, 'damagedDescendants' will be set for all the ancestors, and when a subtree is updated, the tree walk can be stopped early if no damaged descendants are present. CompScreenRec no longer needs the 'damaged' member since the root window's 'damagedDescendants' provides the same information. Signed-off-by: Ville Syrjälä <[email protected]> --- composite/compalloc.c | 12 +++++++++--- composite/compinit.c | 21 +++++++++++---------- composite/compint.h | 1 - composite/compwindow.c | 8 ++++++-- dix/window.c | 4 ++++ include/windowstr.h | 3 +++ 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/composite/compalloc.c b/composite/compalloc.c index 93571ee..df79010 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -51,12 +51,18 @@ static void compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) { WindowPtr pWin = (WindowPtr) closure; - ScreenPtr pScreen = pWin->drawable.pScreen; - CompScreenPtr cs = GetCompScreen (pScreen); CompWindowPtr cw = GetCompWindow (pWin); - cs->damaged = TRUE; cw->damaged = TRUE; + + /* Mark the ancestors */ + pWin = pWin->parent; + while (pWin) { + if (pWin->damagedDescendants) + break; + pWin->damagedDescendants = TRUE; + pWin = pWin->parent; + } } static void diff --git a/composite/compinit.c b/composite/compinit.c index 80b9ddc..f5b134e 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -134,15 +134,17 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask) } static void -compScreenUpdate (ScreenPtr pScreen) +compChildrenUpdate (WindowPtr pWin) { - CompScreenPtr cs = GetCompScreen (pScreen); + ScreenPtr pScreen = pWin->drawable.pScreen; + WindowPtr pChild; compCheckTree (pScreen); - if (cs->damaged) - { - compWindowUpdate (pScreen->root); - cs->damaged = FALSE; + + if (pWin->damagedDescendants) { + for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) + compWindowUpdate (pChild); + pWin->damagedDescendants = FALSE; } } @@ -156,7 +158,7 @@ compBlockHandler (int i, CompScreenPtr cs = GetCompScreen (pScreen); pScreen->BlockHandler = cs->BlockHandler; - compScreenUpdate (pScreen); + compChildrenUpdate (pScreen->root); (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); cs->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = compBlockHandler; @@ -175,7 +177,7 @@ compGetImage (DrawablePtr pDrawable, pScreen->GetImage = cs->GetImage; if (pDrawable->type == DRAWABLE_WINDOW) - compScreenUpdate (pScreen); + compChildrenUpdate ((WindowPtr) pDrawable); (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); cs->GetImage = pScreen->GetImage; pScreen->GetImage = compGetImage; @@ -191,7 +193,7 @@ static void compSourceValidate(DrawablePtr pDrawable, pScreen->SourceValidate = cs->SourceValidate; if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors) - compScreenUpdate (pScreen); + compChildrenUpdate ((WindowPtr) pDrawable); if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode); @@ -371,7 +373,6 @@ compScreenInit (ScreenPtr pScreen) if (!cs) return FALSE; - cs->damaged = FALSE; cs->overlayWid = FakeClientID(0); cs->pOverlayWin = NULL; cs->pOverlayClients = NULL; diff --git a/composite/compint.h b/composite/compint.h index 99d27f6..177965d 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -152,7 +152,6 @@ typedef struct _CompScreen { ScreenBlockHandlerProcPtr BlockHandler; CloseScreenProcPtr CloseScreen; - Bool damaged; int numAlternateVisuals; VisualID *alternateVisuals; diff --git a/composite/compwindow.c b/composite/compwindow.c index 22d2374..df54e96 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -725,8 +725,12 @@ compWindowUpdate (WindowPtr pWin) { WindowPtr pChild; - for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) - compWindowUpdate (pChild); + if (pWin->damagedDescendants) { + for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) + compWindowUpdate (pChild); + pWin->damagedDescendants = FALSE; + } + if (pWin->redirectDraw != RedirectDrawNone) { CompWindowPtr cw = GetCompWindow(pWin); diff --git a/dix/window.c b/dix/window.c index d140dda..9be7064 100644 --- a/dix/window.c +++ b/dix/window.c @@ -298,6 +298,10 @@ SetWindowToDefaults(WindowPtr pWin) #ifdef ROOTLESS pWin->rootlessUnhittable = FALSE; #endif + +#ifdef COMPOSITE + pWin->damagedDescendants = FALSE; +#endif } static void diff --git a/include/windowstr.h b/include/windowstr.h index 0b66ebb..4a7a0f4 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -167,6 +167,9 @@ typedef struct _Window { #ifdef ROOTLESS unsigned rootlessUnhittable:1; /* doesn't hit-test */ #endif +#ifdef COMPOSITE + unsigned damagedDescendants:1; /* some descendants are damaged */ +#endif } WindowRec; /* -- 1.7.2.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
