The sub-surface protocol was originally committed into Weston on May 10th, 2013, in commit 2396aec6842c709a714f3825dbad9fd88478f2e6. The design for the protocol had started in the beginning of December 2012. I think it is high time to move this into the core now.
This patch copies the sub-surface protocol as it was in Weston on Nov 15th, 2013, into Wayland. Weston gets a patch to remove the protocol from there.
Sub-surface is a wl_surface role. You create a wl_surface as usual, and assign it the sub-surface role and a parent wl_surface. Sub-surfaces are an integral part of the parent surface, and stay glued to the parent. For window management, a window is the union of the top-level wl_surface and all its sub-surfaces. Sub-surfaces are not clipped to the parent, and the union of the surface tree can be larger than the (top-level) wl_surface at its root.
The representative use case for sub-surfaces is a video player window. When the video content is given its own wl_surface, there is no need to modify the video frame contents after decoding or copy them into a whole window sized buffer before submitting it to the compositor. This allows efficient, zero-copy video presentation paths, where video decoding hardware produces a (YUV) buffer, which eventually ends up in a (YUV-capable) hardware overlay and is scanned out directly.
This can also be used for zero-copy presentation of windowed OpenGL content, where the OpenGL rendering engine does not need to draw or avoid window decorations.
Sub-surfaces allow mixing different buffer types into the same window, e.g. software-rendered decorations in wl_shm buffers, and live content in EGL-based buffers.
However, the sub-surface extension does not offer clipping or scaling facilities, or accurate presentation timing. Those are topics for additional extensions.
81c5761 protocol: add sub-surfaces to the core
protocol/wayland.xml | 217 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 217 insertions(+)