Improve stage view damage tracking
This merge request does two things:
- It fixes using damage and paint regions when monitors are transformed
When there was a monitor transform, e.g. monitor configured to be in portrait mode, we always first paint to an offscreen, then copy that content to the framebuffer to be scanned out. When this was the case, we'd fail to find out the buffer age, as we'd be checking on the offscreen. Offscreen framebuffers are single buffered, thus doesn't have buffer age.
We also didn't try to copy only the newly painted parts of the offscreen to the onscreen, so that had to be added as well.
- When shadow buffers are used, find out what part actually changed.
This works by making the shadow buffer double buffered DMA buffer based offscreen framebuffers, then keeping track of actual changes over time. This is done by mmap:ing both framebuffers, then comparing pixels grouped in "tiles" whether anything changed, and marking only tiles that actually changed for copying.
The motivation for this is that reading and comparing the memory of the shadow buffer is significantly much faster than writing to the onscreen framebuffer, so any lowering of amount of copying in the last step is likely to be an overall gain. This might for example be the case on Matrox GPUs and similar hardware.