Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Remove outputs when switching away from VT #2370

Open
emersion opened this issue Aug 16, 2020 · 5 comments
Open

Remove outputs when switching away from VT #2370

emersion opened this issue Aug 16, 2020 · 5 comments

Comments

@emersion
Copy link
Member

emersion commented Aug 16, 2020

When switching away from VT, remove the wlr_outputs (same as unplug). When switching back, re-add them (same as hotplug).

This would avoid connector/CRTC state inconsistencies (e.g. how to modeset when DRM FD is paused). This would be consistent with input devices.


wlroots has migrated to gitlab.freedesktop.org. This issue has been moved to:

https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2370

@ammen99
Copy link
Member

ammen99 commented Aug 17, 2020

This would require the compositor to keep track of which output each view is on and restore that. Wayfire currently doesn't do it :/
How would it work in Sway (if it works at all)?

@emersion
Copy link
Member Author

Ah, yes, that is correct. I just assumed everybody does it.

Sway migrates workspaces from one output to the other, and keeps a list of "output priorities": https://github.com/swaywm/sway/blob/6991ac8c70869ca19a87cfc173e280cab7ff20d0/include/sway/tree/workspace.h#L42

@agx
Copy link
Contributor

agx commented Aug 17, 2020

just for the record: phoc doesn't (yet) keep a list either but that's on the todo list.

@ammen99
Copy link
Member

ammen99 commented Aug 17, 2020

One naive question: Why can't the DRM backend just reinitialize the outputs without unplugging and replugging them?

@emersion
Copy link
Member Author

The problem I'm trying to fix is that things are weird when switching VTs:

  • All operations on the output are invalid: can't page-flip, can't modeset, can't enable/disable, etc. IIRC right now the DRM backend fakes success (and defers till next VT switch) and that's not great (maybe the deferred operation will fail and put the output in a bad state).
  • I don't want the DRM backend to change output state behind the compositor's back
  • Outputs can be unplugged and hotplugged, but the compositor won't notice it
  • Other compositors might change the output state

emersion added a commit to emersion/wlroots that referenced this issue Dec 26, 2020
When the session is inactive, we can't change the KMS state. Ignore
hotplug events so that compositors don't try to perform a modeset when
a connector is plugged in. We already re-scan connectors when the
session becomes active.

To test, run a wlroots compositor on VT 1, switch to VT 2, unplug a
connector, re-plug it, switch back to VT 1. Without this patch the
screen is black on VT 1.

References: swaywm#2370
emersion added a commit that referenced this issue Jan 3, 2021
When the session is inactive, we can't change the KMS state. Ignore
hotplug events so that compositors don't try to perform a modeset when
a connector is plugged in. We already re-scan connectors when the
session becomes active.

To test, run a wlroots compositor on VT 1, switch to VT 2, unplug a
connector, re-plug it, switch back to VT 1. Without this patch the
screen is black on VT 1.

References: #2370
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants