[PATCH xserver] composite: Inhibit window background paint with manual subwindow redirection

Ville Syrjälä syrjala at sci.fi
Tue Jul 19 16:54:22 PDT 2011


On Tue, Jul 19, 2011 at 06:01:21PM -0400, Owen Taylor wrote:
> On Fri, 2011-05-06 at 18:19 +0300, ville.syrjala at nokia.com wrote:
> > From: Ville Syrjälä <ville.syrjala at nokia.com>
> > 
> > The composite extension spec says that window background painting
> > should be inhibited when the subwindow redirection mode is set to
> > manual.
> > 
> > This eliminates the ugly flashing effect when compiz unredirects a
> > fullscreen window.
> 
> Being able to do no-flash unredirection is something I'd definitely like
> to be able to do for Mutter!

BTW I noticed afterwards that this doesn't help all apps. Evince, for
example, still blinks whenever I bring up the popup menu while in
fullscreen mode, whereas Firefox doesn't blink. I did some quick
protocol tracing and I saw some window background mode changes from
the client. A quick look at gdk-x11 code revealed that it does some
tricks with the window background. I never got around to testing if
removing that code would make Evince blink-free (tm).

> Hmm, OK, so what you are doing is:
> 
>  - Unmap or reshape COW, leaving root window contents, which you
>    don't want to be repainted. (And you can't get this by changing
>    the background to None because: "Changing the background of a root
>    window to None or ParentRelative restores the  default background
>    pixmap.")
>  - Unredirect fullscreen window
> 
> it took me a moment to see why this isn't backwards ordering: if you
> unredirected the fullscreen window first it wouldn't have preserved
> contents, so the X server would have to expose it from scratch.

Yeah. One workaround would be to keep one bg=None window always just
above the root window.

> This patch does look like it makes the behavior agree with the composite
> protocol extension; it's not clear at this point whether there was
> always a mismatch or whether it was changed at some point:
> 
> History in the compositeproto repo shows:
> 
> commit 35a9c80252b35720c1afc5dc53153228e2084b10
> Author: Keith Packard <keithp at keithp.com>
> Date:   Sun Nov 9 07:07:21 2003 +0000
> 
>     Note that Manual Subwindows mode disables background painting.
> 
> but the X server code from that date wasn't easily discoverable for me. 

Yeah tracking down the old code is difficult. I _think_ I did track down
the original CVS commits for some composite code. Ah now I remember. It
was related to the initial damage in ProcCreateDamage(), but the
original commit message didn't provide much rationale for the change.
Same story with some Xv code I was trying to figure out :(

> Patch looks correct - it makes windows with manual subwindow
> redirection go through the same codepath as background none windows.
> 
> It seems pretty safe - very little application painting code *depends*
> on clearing to the background color, and breakage from this change would
> require that plus an application that was doing something pretty unusual
> with the composite extension.
> 
> Would be definitely good to get Keith to check this as well if possible.
> 
> - Owen
> 
> Reviewed-by: Owen Taylor <otaylor at fishsoup.net>

Thanks.

-- 
Ville Syrjälä
syrjala at sci.fi
http://www.sci.fi/~syrjala/


More information about the xorg-devel mailing list