[PATCH wayland-protocols] xdg-output: add logical_transform
Simon Ser
2018-11-10 13:12:05 UTC
Compositors might apply two types of transforms to outputs: a software
transform applied at compositing time, and a hardware transform applied
by the GPU (e.g. via the "rotation" DRM property).

wl_output.geometry already contains a transform hint. Clients use this
info to pre-rotate their buffers so that the compositor doesn't need
to do it (this is especially useful for direct scan-out). For instance,
the Weston clients have this behaviour.

However, in the case of a hardware transform, the compositor doesn't
want clients to rotate their buffers because this is already done after
compositing. So the compositor will send a NORMAL output transform via

Doing so is fine for most clients, but some special clients like
Xwayland use wl_output.geometry's transform to expose it in Xrandr.
This results in invalid modes, causing pointer input coordinates

This commit exposes a "logical transform", which is the sum of the
software and hardware transforms.

Signed-off-by: Simon Ser <***@emersion.fr>
.../xdg-output/xdg-output-unstable-v1.xml | 32 +++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/unstable/xdg-output/xdg-output-unstable-v1.xml b/unstable/xdg-output/xdg-output-unstable-v1.xml
index ccbfe1c..02cc6ef 100644
--- a/unstable/xdg-output/xdg-output-unstable-v1.xml
+++ b/unstable/xdg-output/xdg-output-unstable-v1.xml
@@ -54,7 +54,7 @@

- <interface name="zxdg_output_manager_v1" version="2">
+ <interface name="zxdg_output_manager_v1" version="3">
<description summary="manage xdg_output objects">
A global factory interface for xdg_output objects.
@@ -77,7 +77,7 @@

- <interface name="zxdg_output_v1" version="2">
+ <interface name="zxdg_output_v1" version="3">
<description summary="compositor logical output region">
An xdg_output describes part of the compositor geometry.

@@ -205,5 +205,33 @@
<arg name="description" type="string" summary="output description"/>

+ <!-- Version 3 additions -->
+ <event name="logical_transform" since="3">
+ <description summary="transform of the output in the global compositor space">
+ The logical_transform event describes the transform of the output
+ in the global compositor space.
+ This is different from the transform the compositor advertizes
+ via wl_output.geometry, which is a hint for clients to submit
+ transformed buffers. The compositor might apply both software
+ and hardware transforms, while wl_output.geometry only exposes
+ the software transform this event exposes the combination of
+ both.
+ Most regular Wayland clients should not pay attention to the
+ logical transform and would rather rely on wl_output.geometry.
+ The logical_transform event is sent after creating an xdg_output
+ (see xdg_output_manager.get_xdg_output) and whenever the logical
+ transform of the output changes, either as a result of a change
+ in the applied transform or because of a change in the
+ corresponding output mode (see wl_output.mode) or transform (see
+ wl_output.transform).
+ </description>
+ <arg name="transform" type="uint" enum="wl_output.transform"
+ summary="transform in global compositor space"/>
+ </event>