Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot-plugging a disabled head sends an additional "phantom" mode through the zwlr_output_head_v1 protocol #8420

Open
andriyDev opened this issue Oct 31, 2024 · 3 comments
Labels
bug Not working as intended

Comments

@andriyDev
Copy link

andriyDev commented Oct 31, 2024

Please fill out the following:

  • Sway Version:

    • sway 1.10
  • Debug Log:

  • Configuration File:

    • Used the default config (except switched to term=alacritty, menu=wofi)
  • Description:

    • Connect to sway with any app that supports the zwlr_output_management_v1 protocol and just listen to the events (Here's my tiny Rust example, you need the wayland-client and wayland-protocols-wlr dependencies).
    • Connect an external monitor (I am using a monitor connected through HDMI)
    • Disable the monitor (I did this using wdisplays which itself uses the output management protocol).
    • Disconnect the monitor
    • Reconnect the monitor
    • See that the new head sends a mode event, but this mode is never populated (its size and refresh rate are never sent).
    • Bonus: Adjust any monitor (e.g., change the position of another monitor, re-enable the disabled monitor), and a finished event will be sent for the "phantom" mode.
  • Other details:

    • I tried this on river and dwl which both use wlroots 0.18. They do not seem to report this phantom mode, but they also have different behavior: Sway will keep the monitor disabled after hotplugging. river and dwl on the other hand will re-enable the monitor on hotplug (I suspect they are just treating the monitor as a brand new monitor). This is also why I've filed this issue against Sway and not wlroots.
@andriyDev andriyDev added the bug Not working as intended label Oct 31, 2024
@andriyDev
Copy link
Author

andriyDev commented Oct 31, 2024

TL;DR even more reasons for why this is a Sway issue and not necessarily a wlroots issue.

Ok perhaps I'm misinterpreting the relationship with river and dwl. Something I didn't notice before (running two desktops at once and sharing a monitor): the "bonus" part seems to always re-enable the disabled monitor. That is, if you have two monitors eDP-1 and HDMI-A-1, apply the above steps to the HDMI-A-1 monitor, and then move eDP-1 (e.g., through wl-displays), HDMI-A-1 enables itself. So maybe river and dwl are doing something correctly that Sway isn't, resulting in this weird buggy behavior.

I assumed Sway was trying to be "smart" and keeping the monitor disabled since it was previously disabled, but maybe instead its a race condition of some kind. That could explain why after changing any other head, the "phantom" mode gets a finished event: the mode gets created accidentally which is sent before this phantom gets cleared server-side. Only later when another "done" batch is sent does the mode realize it doesn't exist and it "finishes" itself.

andriyDev added a commit to andriyDev/wl-distore that referenced this issue Oct 31, 2024
@emersion
Copy link
Member

emersion commented Nov 1, 2024

Do you have a WAYLAND_DEBUG=1 log of your client?

@andriyDev
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests

2 participants