[PATCH v2 5/6] composite: Support updating an arbitrary subtree

Ville Syrjälä ville.syrjala at nokia.com
Mon Jan 3 05:54:54 PST 2011


On Fri, Dec 31, 2010 at 02:00:43PM -0800, ext Keith Packard wrote:
> On Fri, 31 Dec 2010 16:49:38 +0200, ville.syrjala at nokia.com wrote:
> 
> > 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.
> 
> I think this raises an interesting general topic - how much of the
> current extension private stuff should get folded into the various DIX
> structures?? We've got a bunch of non-optional extensions these days and
> it might be a nice cleanup job to take their privates and move them.
> 
> > CompScreenRec no longer needs the 'damaged' member since the root
> > window's 'damagedDescendants' provides the same information.
> 
> > Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
> 
> This seems like a reasonable optimization to me, reducing the cost of
> having any CompositeRedirectAutomatic windows on the screen.
> 
> I'm not entirely happy with the name compChildrenUpdate, but given that
> compWindowUpdate paints a window into its parent, I don't have a great
> suggestion for an alternative name. One option might be to move the
> painting code inside the loop:
> 
> compPaintWindowToParent(pWin)
> {
>         if (pWin->damaged)
>                 ...
>                 pWin->damaged = FALSE;
> }
> 
> compChildrenUpdate(pWin)
> {
>         if (!pWin->damagedDescendents)
>                 return;
>         for (pChild = pWin->lastChild ...)
>                 compChildrenUpdate(pChild);
>                 compPaintWindowToParent(pChild);
>         }
>         pWin->damagedDescendents = FALSE;
> }
> 
> Or some such. Having two functions looping over the child list seems
> ugly...

How about this? Stills leaves the compChildrenUpdate name there though.

void
compChildrenUpdate (WindowPtr pWin)
{
    WindowPtr pChild;

    if (!pWin->damagedDescendants)
        return;

    for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
        compWindowUpdate (pChild);

    pWin->damagedDescendants = FALSE;
}

void
compWindowUpdate (WindowPtr pWin)
{
    compChildrenUpdate (pWin);

    if (pWin->redirectDraw != RedirectDrawNone)
    {
        CompWindowPtr   cw = GetCompWindow(pWin);

        if (cw->damaged)
        {
            compWindowUpdateAutomatic (pWin);
            cw->damaged = FALSE;
        }
    }
}

-- 
Ville Syrjälä


More information about the xorg-devel mailing list