New output configuration design for the frontend
I started this as a comment to !1476 (merged), but soon exploded in scope. In short, the output configuration code in the frontend is difficult to reason with and modify.
Output positions are dictated by the frontend. That's good and clear.
Output sizes are modified by both the frontend and the backends, arbitrarily. This makes output configuration confusing and difficult.
Output enabling order dictates the desktop layout, because newly enabled outputs are positioned on the right of the most recently enabled output. This order is arbitrary and cannot be controlled, which is not good.
I fear we may need to take a step back and re-think how this works, so that the frontend will know what the output size will be once it is enabled. Once the frontend knows that, it can create the desktop layout before it enables any outputs, and it can do this in a predictable order unlike today. This is a requirement for any kind of atomic output configuration that we might want to have in the future (#341). I suspect this would help greatly with configuring layouts in weston.ini
(#165).
Perhaps on Weston start-up, the frontend will:
- Create a
weston_output
for each available connected head, takingclone-of
into account. - Query each
weston_output
for its default size if any, or decide the size. - Configure all
weston_output
s, giving them positions etc.
On heads-changed, the frontend will do essentially the same, except most weston_output
s already exists in enabled state.
The new API of querying a weston_output
for its default size, with heads already attached, will allow:
- X11 and Wayland backends to negotiate initial window size with the host window system, and return that.
- DRM backend to read the initial KMS state to figure out current and preferred video modes.
Nested outputs can be resized by the parent window system. Maybe that could trigger a heads-changed signal, so that the frontend could query the new size and set that. This would get rid of backends changing outputs sizes without the frontend knowing.
I feel that we need to get away from the back-and-forth between the frontend and the backends in configuring outputs. Backends should make information available without the need to enable a weston_output
, and the frontend must be responsible and do all the setting. With the multi-backend support, the frontend division into DRM and "simple" output configuration algorithms is no longer appropriate.