Wayland visuals refer to a pixel's bytes in order from
most significant to least significant, while the
one-byte-per-component Cogl formats refer to the order
of increasing memory addresses, so converting between
the two depends on the system's endianness.
The height was being set from the ClutterGeometry in some parts
and from the stage in others. And since both callers of this
function pass &stage_wayland->allocation as the geometry anyway,
the stage argument isn't really even needed.
Adapt to changes from this Wayland commit:
"Update surface.attach and change surface.map to surface.map_toplevel"
(82da52b15b49da3f3c7b4bd85d334ddfaa375ebc)
Always use pageflipping, but avoid full repaint by copying back dirty
regions from front to back. Additionally, we dealy copying back until
we're ready to paint the new frame, so we can avoid copying areas that
will be repainted anyway.
This is the least amount of copying per frame we can get away with at all
and at the same time we don't have to worry about stalling the GPU on
synchronized blits since we always pageflip.