[PATCH 8/8] composite: Implement backing store's Always mode

Keith Packard keithp at keithp.com
Sat Nov 22 00:31:18 PST 2014


Adam Jackson <ajax at redhat.com> writes:

> Keep the pixmap at unmap, always try to realize backing store, always
> mark them when marking, and update paintable when backed.

Reading this reminded me of how Xt applications used backing store 'back
in the day'. Because of the (broken) backing store implementation in the
server, to save the contents of an entire application window, you'd
actually have to set backing store on every single window in the tree.

I think that's going to cause a lot of extra allocations in this code,
but I can't think of a great way to avoid that.

>  static void
> +compCheckPaintable(WindowPtr pWin)
> +{
> +    pWin->paintable = pWin->viewable || pWin->backingStore == Always;
> +}
> +

What happens when the pixmap allocation fails? Do we handle this case at
all anymore?

> +static void
>  compCheckBackingStore(WindowPtr pWin)
>  {
> -    if (pWin->backingStore != NotUseful && !pWin->backStorage) {
> +    Bool should =
> +        (pWin->backingStore == Always) ||
> +        (pWin->backingStore == WhenMapped && pWin->viewable);
> +
> +    if (should && !pWin->backStorage) {
> +        compCheckPaintable(pWin);
>          compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
>          pWin->backStorage = TRUE;
>      }
> -    else if (pWin->backingStore == NotUseful && pWin->backStorage) {
> +    else if (!should && pWin->backStorage) {
> +        compCheckPaintable(pWin);
>          compUnredirectWindow(serverClient, pWin,
>                               CompositeRedirectAutomatic);
>          pWin->backStorage = FALSE;

Were you going to hack this code to avoid redirecting when the window
was Unobscured? Is this code called after the visibility value has been
computed so we could just use that?

> +
> +    /* UnrealizeTree walks from root to leaves, so only need to check parent */
> +    if (backed(pWin) && pWin->parent->paintable)
> +        pWin->paintable = TRUE;
> +

What happens when the child is redirected and doesn't have backing store
selected? Does the window pixmap still get allocated?

> @@ -594,6 +643,14 @@ compDestroyWindow(WindowPtr pWin)
>      CompSubwindowsPtr csw;
>      Bool ret;
>  
> +    /*
> +     * Take down bs explicitly, to get ->backStorage cleared
> +     */
> +    if (pWin->backingStore != NotUseful) {
> +        pWin->backingStore = NotUseful;
> +        pScreen->ChangeWindowAttributes(pWin, CWBackingStore);
> +    }
> +

That's kinda ugly; any reason you can't just go clear it directly? Avoid
a whole trip through the ChangeWindowAttributes call list?

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20141122/e7d64729/attachment.sig>


More information about the xorg-devel mailing list