compositor: Clear only the the damage that was actually repainted
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Wed, 15 Aug 2012 18:02:05 +0000 (14:02 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 16 Aug 2012 14:25:23 +0000 (10:25 -0400)
commit4f5217313e7b7aaed22bf796cee7f4bc9c57db1b
tree9e13aec0239221f46865432b3c83268c0ec6b09c
parent243f59f5bb91f50caaf6828bafeee74fa397d433
compositor: Clear only the the damage that was actually repainted

Instead of clearing the whole output region after a repaint, clear
only the regions that were actually painted. This way, the damage
added when a surface moves from the primary plane to another one is
kept while this region is obscured by the opaque region. This allows
the contents below an overlaid surface to be culled, but to make this
work properly, it is also necessary to change the way previous damage
is drawn.

Consider the following scenario: a surface is moved to an overlay plane
leaving some damage in the primary plane. On the following frame, the
surface on the overlay moves, revealing part of the damaged region on
the primary plane. On the frame after that, the overlaid surface moves
back to its previous position obscuring the region of the primary plane
repainted before. At this point, the repainted region was added to the
output's previous damage so that it is draw to both buffers. But since
this region is now obscured, the redrawing is skipped. If the overlaid
surface moves again revealing this region, one of the buffers actually
contains the wrong content.

To fix this problem, this patch ensures that any previous damage that
would be lost is actually preserved by folding it back into the
primary plane damage just before repainting.
src/compositor.c