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

Screen won't turn on after resume from sleep #7228

Open
zsolt-donca opened this issue Oct 20, 2022 · 19 comments
Open

Screen won't turn on after resume from sleep #7228

zsolt-donca opened this issue Oct 20, 2022 · 19 comments
Labels
bug Not working as intended

Comments

@zsolt-donca
Copy link

zsolt-donca commented Oct 20, 2022

  • Sway Version:
$ swaymsg -t get_version
sway version 1.8-dev-9400bd96 (Oct 19 2022, branch 'master')

I am using sway-git along with wlroots-hidpi-xprop-git, which builds the wlroots master branch with a hidpi scaling patch for xwayland (see pull request). My current wlroots build is based on c6d8a11.

  • Debug Log:

  • Debug logs zipped. Sorry, but I could not manage to upload the original unzipped file (72 MB) to GitHub Gist.

  • Configuration File:

    • Since the issue is random, I cannot just willingly reproduce it. The above debug logs were produced with my actual configuration.
  • Description:

Sometimes after my laptop resumes from sleep, the screen just won't turn back on. Most of the time it works, but sometimes it doesn't, and in those cases the only option is for me to restart my computer.

Below are the steps that I followed that correspond to my attached debug logs:

  1. I spent a lot of time working (this includes me using a Dell thunderbolt dock, an external screen, and external USB devices as well)
  2. I disconnected my dock and all USB devices and put my laptop to sleep
  3. Opened it - this time it worked
  4. Spent another hour working, after which I put my laptop to sleep (not sure if manually or by just closing the lid)
  5. Opened it back again several minutes later, and the screen didn't want to turn back on
  6. I switched to a VT (the screen turned on for this), logged in, and restarted the machine.

When the issue happens, switching to some VT and back again to VT1 with sway does not solve the issue. The screen turns on for the VT, but then turns off again when switching to Sway.

I am running Arch Linux with recent updates. I am using a 12th generation Intel Alder Lake CPU (i9-12900HK) and I am using the integrated Intel GPU.

@zsolt-donca zsolt-donca added the bug Not working as intended label Oct 20, 2022
@Ferdi265
Copy link
Contributor

I sometimes have a similar issue, and a workaround for me is to run swaymsg output eDP-1 disable; swaymsg output eDP-1 enable (I have a keybind for it since it happens quite often recently).

@flowHater
Copy link

flowHater commented Nov 6, 2022

I have the same issue. But with sway 1.7 which is out since January 2022. So I think it's something else than Sway itself.

$ sway --version
sway version 1.7

I have a total different setup than the OP. I have two monitor on a desktop computer, AMD GPU + AMD CPU. On Archlinux too. On linux-zen. Sway from repo not AUR.

linux-zen 6.0.7.zen1-1
mesa 22.2.1-1
sway 1:1.7-10
swaybg 1.1.1-1
swayidle 1.7.1-3
swaylock 1.6-2

I suspend my computer with swaylock -f -i DP-1:~/Images/wallpaper.jpg -i DP-2:~/Images/wallpaper3.jpeg && systemctl suspend. When I wake up it, monitor are on but showing black. Each time, it's not random for me.

I can type my password to unlock and after that I switch to TTY2 with CTRL + ALT + F2 and back to CTRL + ALT + F1. Monitors seems to work after that.
Before what I was doing was to turn off then turn on monitors. It works too but some apps gets uggly like VsCode on my HiDPI monitor. Switching of TTY dœsn't cause this issue.

@Ghosthree3
Copy link

Fairly certain this is an amdgpu driver issue introduced in 6.0, at least that's when my issues started. There's several open issues about suspend resume failures, eg. https://gitlab.freedesktop.org/drm/amd/-/issues/2213, but some date prior to 6.0 so I'm not really sure which issues or fixes are related to my problem. But I am sure it's not sway's fault.

@cglogic
Copy link

cglogic commented Nov 12, 2022

I got the same issue after update wlroots to 0.16.0 today, sway is 1.7.
My hardware is Core i5-4210M integrated GPU. I run sway with WLR_DRM_NO_ATOMIC=1.
Sway prints this error: [ERROR] [wlr] [backend/drm/legacy.c:181] connector eDP-1: drmModePageFlip failed: Device busy.
It looks like wlroots 0.16 breaks old code path for WLR_DRM_NO_ATOMIC=1.

@emersion
Copy link
Member

It looks like wlroots 0.16 breaks old code path for WLR_DRM_NO_ATOMIC=1.

Hm, I can't reproduce, that just works for me.

In any case, it's a separate issue. Can you open a wlroots issue about it with full debug logs and ideally https://gitlab.freedesktop.org/wlroots/wlroots/-/wikis/DRM-Debugging?

@cglogic
Copy link

cglogic commented Nov 12, 2022

It looks like wlroots 0.16 breaks old code path for WLR_DRM_NO_ATOMIC=1.

Hm, I can't reproduce, that just works for me.

In any case, it's a separate issue. Can you open a wlroots issue about it with full debug logs and ideally https://gitlab.freedesktop.org/wlroots/wlroots/-/wikis/DRM-Debugging?

Looks like you are right.
I can reproduce it by running swaymsg "output * dpms off" ; sleep 5 ; swaymsg "output * dpms on".
With WLR_DRM_NO_ATOMIC=1 it does not turn on the screen and produce the error message, without WLR_DRM_NO_ATOMIC=1 screen goes off for 5 seconds and then turns on.
I will create an issue for wlroots on freedesktop.org.
Thanks.

@jstdk
Copy link

jstdk commented Nov 29, 2022

This feels like a generic Linux 6 series bug. Also reported in the Fedora community (for Intel, AMD and systems without dedicated GPU like mine).

@zsolt-donca
Copy link
Author

I figured out that this issue is related to the following lines in my sway config, and commenting them out mitigates the issue:

bindswitch lid:on exec swaymsg output eDP-1 disable
bindswitch lid:off exec swaymsg output eDP-1 enable

Where eDP-1 is (usually) my laptop's built-in screen.

Since I removed this, I entered sleep by closing the laptop's lid many times and did not have the issue. However, this is obviously not ideal since I won't be able to close the lid of the laptop and have the laptops screen turn off when docked. I guess I could resolve the issue with some kind of advanced scripting, but still, I believe the above should work as it did on my previous laptop (with 9th gen Intel GPU).

Is there something that I could do to gather further logs from when reproducing this issue? Would recent debug (or trace?) logs help, with the default sway configuration (with the above lines added)?

@fishman
Copy link

fishman commented Jan 8, 2023

I figured out that this issue is related to the following lines in my sway config, and commenting them out mitigates the issue:

bindswitch lid:on exec swaymsg output eDP-1 disable
bindswitch lid:off exec swaymsg output eDP-1 enable

I can confirm that this solves the issue for me.

@aqxa1
Copy link

aqxa1 commented Jan 11, 2023

I have a possibly related issue. If I suspend my PC then physically turn off one of the monitors (because the standby light is annoying) if I then resume, the other display will be blank but the physically turned off one will show an output (if I then turn it back on). The enable/disable trick works as a workaround.

@budimanjojo
Copy link

I can type my password to unlock and after that I switch to TTY2 with CTRL + ALT + F2 and back to CTRL + ALT + F1. Monitors seems to work after that.

I have this same issue after updating my system. Is there any workaround? The enable/disable trick doesn't work on me. I can reproduce it all the time with this command and wait 5 seconds: swayidle -w timeout 5 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'.

@budimanjojo
Copy link

Seems like there's a fix already https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3528

@emersion
Copy link
Member

That fix is included in wlroots 0.16.1.

@languitar
Copy link

Even with that version of wlroots, something similar still happens on my system.

@emersion
Copy link
Member

emersion commented Feb 7, 2023

Please open a new issue if you can reproduce with wlroots+Sway latest commits.

@dbowring
Copy link

dbowring commented Aug 9, 2023

I'm seeing this on sway 1.8.1 and wlroots 0.16.2.

For the sake of people coming in from google, I'm currently fixing it by swapping to another tty and running the following and then quickly switching back to tty1:

$ cat wake-up-display.sh
#!/bin/bash
sleep 2 && find "${XDG_RUNTIME_DIR}" -name 'sway-ipc.*.*.sock' -exec swaymsg -s {} output '*' enable \;

$ ./wake-up-display.sh

I do also have the bindswitch lid:on/off section in my config, though, so I'll remove that and make a new issue if it persists.

@hughobrien
Copy link

bindswitch might need --locked.

I also had success with 'sleep; dpms off; dpms on` where I switch back to the sway display prior to the first sleep finishing, letting the dpms commands run while I am on the 'dead' VT.

@WhyNotHugo
Copy link
Contributor

A few times my system has woken up from sleep but the screen won't turn on. Unlike op, I cannot switch to another tty (nothing happens when I press the key combination). I also have in my settings:

bindsym --locked XF86PowerOff  exec powerctl mem

But pressing the power key does nothing. I'm not entirely sure if it's just the screen that remains off, or if sway has frozen completely.

@pSchwietzer
Copy link

I have the same issue, I always turned off my displays at night and turned them on in the morning. Somewhere in the last month this started happening.

After a few times of happening I started to lock my screen with swaylock and the Issue seemed to have gone away. However after 7 days working it happened again just now.

What would happen essentially is after unlocking swaylock I would get a flash of my sway session and then screens would turn off. Since I was reencoding stuff I let the computer on and locked the screen again.

After 1 hour I tried to unlock again and it sudddenly worked, I was able to access other tty's.

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