[PATCH 1/3] composite: Don't backfill non-bg-None windows

Aaron Plattner aplattner at nvidia.com
Mon Oct 4 13:13:10 PDT 2010


On Mon, Oct 04, 2010 at 12:33:40PM -0700, Adam Jackson wrote:
> If there's a defined background then backfilling is a waste of effort,
> since exposure processing will paint that in for us.  But note that we
> have to backfill if any children are bg=None to preserve semantics with
> non-composited servers.
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  composite/compalloc.c |   24 +++++++++++++++++++++++-
>  1 files changed, 23 insertions(+), 1 deletions(-)
> 
> diff --git a/composite/compalloc.c b/composite/compalloc.c
> index d8ccc11..19f5896 100644
> --- a/composite/compalloc.c
> +++ b/composite/compalloc.c
> @@ -472,6 +472,17 @@ compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
>      return Success;
>  }
>  
> +static int
> +bgNoneVisitWindow(WindowPtr pWin, void *null)
> +{
> +    if (pWin->backgroundState != BackgroundPixmap)
> +        return WT_WALKCHILDREN;
> +    if (pWin->background.pixmap != None)
> +        return WT_WALKCHILDREN;
> +
> +    return WT_STOPWALKING;
> +}
> +
>  static PixmapPtr
>  compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
>  {
> @@ -487,7 +498,18 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
>      
>      pPixmap->screen_x = x;
>      pPixmap->screen_y = y;
> -    
> +
> +    /*
> +     * If there's no bg=None in the tree, we're done.
> +     *
> +     * We could optimize this more by collecting the regions of all the
> +     * bg=None subwindows and feeding that in as the clip for the
> +     * CopyArea below, but since window trees are shallow these days it
> +     * might not be worth the effort.
> +     */
> +    if (TraverseTree(pWin, bgNoneVisitWindow, NULL) == WT_NOMATCH)
> +	return pPixmap;

I know it makes the diff smaller to do it this way, but the early return
bugs me since this is directly related to the code below.  It seems like it
would be cleaner to do this:

/*
 * If there are bg=None windows in the tree, then we need to backfill the
 * window pixmap from the parent window to match the behavior of
 * non-composited desktops.
 *
 * We could optimize [...]
 */
if (TraverseTree(pWin, bgNoneVisitWindow, NULL) != WT_NOMATCH) {
    // backfill the window
}
return pPixmap;

>      if (pParent->drawable.depth == pWin->drawable.depth)
>      {
>  	GCPtr	pGC = GetScratchGC (pWin->drawable.depth, pScreen);
> -- 
> 1.7.2.2


More information about the xorg-devel mailing list