protocol: Add wl_surface.damage_buffer

wl_surface.damage uses surface local co-ordinates.

Buffer scale and buffer transforms came along, and EGL surfaces
have no understanding of them.

Theoretically, clients pass damage rectangles - in Y-inverted surface
co-ordinates) to EGLSwapBuffersWithDamage, and the EGL implementation
passed them on to wayland.  However, for this to work the EGL
implementation must be able to flip those rectangles into the space
the compositor is expecting, but it's unable to do so because it
doesn't know the height of the transformed buffer.

So, currently, EGLSwapBuffersWithDamage is unusable and EGLSwapBuffers
has to pass (0,0) - (INT32_MAX, INT32_MAX) damage to function.

wl_surface.damage_buffer allows damage to be registered on a surface
in buffer co-ordinates, avoiding this problem.

Credit where it's due, these ideas are not entirely my own:
Over a year ago the idea of changing damage co-ordinates to buffer
co-ordinates was suggested (by Jason Ekstrand), and it was at least
partially rejected and abandoned.  At the time it was also suggested
(by Pekka Paalanen) that adding a new wl_surface.damage_buffer request
was another option.

This will eventually resolve:
by making the problem irrelevant.

Reviewed-by: Pekka Paalanen <>
Reviewed-by: Jason Ekstrand <>
Signed-off-by: Derek Foreman <>
Reviewed-by: Jonas Ã…dahl <>
1 file changed