Handling overlapping outputs and cloning
There's already #78 for the lower-level drm backend details, this one is for higher level stuff.
Overlapping outputs can be problematic in many cases:
- with tiling, you get a configuration window per screen, so those will overlap and not work correctly
- overview, present windows and desktop grid create a fullscreen window per screen, which breaks everything
- with !3614 (merged) the blur effect uses a texture per output, the result will look weird
- "send to output" in the window menu and shortcuts are more complicated than needed or even broken (https://bugs.kde.org/show_bug.cgi?id=466202)
- KWin renders cloned outputs twice even when it doesn't need to, which is bad for performance and battery life
There's some additional complications to think about as well:
- even once the drm backend supports proper cloning for only rendering once, we still need to be able to render outputs separately because of color management
- that means we need one effect window for cloned outputs, but still two outputs to render to
- Wayland clients may want two
wl_outputs
for two cloned outputs to make decisions about scaling, color management and presentation timing - upstream, folks want to move away from that though so maybe it's not a problem we need to care about either - on Xorg, other clients can force some output placement on us, including partial overlaps without actual cloning. As we're very slowly but surely moving towards deprecating the Xorg session, maybe we can just ignore that by saying that this is not a supported configuration and the problem will eventually go away completely
Ignoring the Xorg problem, I think the best way to fix this is to split rendering and window management logic better. To do this, I'd split Output
into
- some sort of backend output, which represents the physical and virtual outputs that the backends 'detect'
- a
RenderOutput
(related: !2558) which represents a target to render to. So for two cloned outputs there can either be oneRenderOutput
(proper cloning), or two (different colors, refresh rate, scaling, whatever) - a logical output, which represents what we expose to Wayland clients, and which effects create windows for. For two cloned outputs there'd be only one logical output
To start with the transition, imo we should only split out the logical output, and leave backend and render outputs combined for now. Once that's completed, !2558 and !1174 should be simpler to do as well.