[PATCH 5/5] mioverlay: Rewrite miOverlayMarkWindow

Aaron Plattner aplattner at nvidia.com
Mon Feb 23 12:36:16 PST 2015


On 02/17/2015 03:59 PM, Adam Jackson wrote:
> At this point, there is only one path where the shadow valdata being
> UnmapValData does anything: in miOverlayValidateTree, if the window is
> not viewable but marked, we clear valdata.  Thus it's wasted work to
> explicitly flag every shadow clip as invalidated, because UnrealizeTree
> has already clobbered those clips for us by the time we get around to
> ValidateTree, and we're not doing anything with the marked shadow clip
> besides unmarking it.
>
> We do still need to check for UnmapValData in the mi valdata, since
> MarkWindow isn't called with a VTKind, and due to the assymetry between
> UnmapWindow and UnmapSubwindows you can't inspect anything else in the
> window state to learn what's about to happen (UW marks the parent of the
> unmapping window before UnrealizeTree, US marks the parent of the
> unmapping windows after UnrealizeTree).
>
> So: scan immediate children for the unmap marker.  If we find exactly
> one, and it has no underlay children, we can bail out.  Otherwise mark
> the parent of the unmapping window(s) so miOverlayValidateTree doesn't
> skip the shadow clip rebuild.
>
> Having done this we can drop the shadow valdata clear in miOVT since
> we're no longer out-of-banding the unmap signal there.
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>   mi/mioverlay.c | 53 ++++++++---------------------------------------------
>   1 file changed, 8 insertions(+), 45 deletions(-)

I tested this with a Quadro and our driver, and something about it 
breaks unmapping of underlay windows.  Pixels from the unmapped window 
get left around in the main plane and continue to clip other windows.

> diff --git a/mi/mioverlay.c b/mi/mioverlay.c
> index 743aa84..d79c62c 100644
> --- a/mi/mioverlay.c
> +++ b/mi/mioverlay.c
> @@ -643,54 +643,20 @@ miOverlayComputeClips(WindowPtr pParent,
>   static void
>   miOverlayMarkWindow(WindowPtr pWin)
>   {
> -    miOverlayTreePtr pTree = NULL;
> -    WindowPtr pChild, pGrandChild;
> +    WindowPtr pChild;
> +    int i = 0;
>
>       miMarkWindow(pWin);
>
> -    /* look for UnmapValdata among immediate children */
> +    for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
> +        if (pChild->valdata == UnmapValData)
> +            i++;
>
> -    if (!(pChild = pWin->firstChild))
> +    if (i == 1 && !HasUnderlayChildren(pWin))
>           return;
>
> -    for (; pChild; pChild = pChild->nextSib) {
> -        if (pChild->valdata == UnmapValData) {
> -            if (IN_UNDERLAY(pChild)) {
> -                pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
> -                pTree->valdata = (miOverlayValDataPtr) UnmapValData;
> -                continue;
> -            }
> -            else {
> -                if (!(pGrandChild = pChild->firstChild))
> -                    continue;
> -
> -                while (1) {
> -                    if (IN_UNDERLAY(pGrandChild)) {
> -                        pTree = MIOVERLAY_GET_WINDOW_TREE(pGrandChild);
> -                        pTree->valdata = (miOverlayValDataPtr) UnmapValData;
> -                    }
> -                    else if (pGrandChild->firstChild) {
> -                        pGrandChild = pGrandChild->firstChild;
> -                        continue;
> -                    }
> -
> -                    while (!pGrandChild->nextSib && (pGrandChild != pChild))
> -                        pGrandChild = pGrandChild->parent;
> -
> -                    if (pChild == pGrandChild)
> -                        break;
> -
> -                    pGrandChild = pGrandChild->nextSib;
> -                }
> -            }
> -        }
> -    }
> -
> -    if (pTree) {
> -        MARK_UNDERLAY(pTree->parent->pWin);
> -        MIOVERLAY_GET_SCREEN_PRIVATE(pWin->drawable.pScreen)->underlayMarked =
> -            TRUE;
> -    }
> +    MARK_UNDERLAY(pWin);
> +    MIOVERLAY_GET_SCREEN_PRIVATE(pWin->drawable.pScreen)->underlayMarked = TRUE;
>   }
>
>   static void
> @@ -774,9 +740,6 @@ miOverlayValidateTree(WindowPtr pParent, WindowPtr pChild,      /* first child e
>                   miOverlayComputeClips(tWin->pWin, &childClip, kind, &exposed);
>                   RegionSubtract(&totalClip, &totalClip, &tWin->pWin->borderSize);
>               }
> -            else {              /* Means we are unmapping */
> -                tWin->valdata = NULL;
> -            }
>           }
>       }
>
>


-- 
Aaron


More information about the xorg-devel mailing list