swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.72k stars 1.11k forks source link

DP/HDMI Monitors do not resume from Power Off state. #8262

Open iDigitalFlame opened 4 months ago

iDigitalFlame commented 4 months ago

Background:

I used SwayFx and after the upgrade from 0.3.2 to 0.4, two of my displays (out of three, 1 HDMI, 1 DP, 1 VGA), the DP and HDMI, would not return after a swaymsg "output * power off" command. Only the VGA display would come back up (as well as the built-in display, but that's disabled 99% of the time).

Debugging this issue, I uninstalled SwayFx and installed Sway, and with Sway 1.9 the issue exists and does NOT exist in 1.8 (which makes sense, SwayFX 0.32 is 1.8 and 0.4 is 1.9).

Reverting to the older version (1.8) solves the issue completely, but once on 1.9 it happens 100% of the time when the displays are powered off.

I've tried every display config (one off, two off, each display at a time) with the same results. In order to get the displays to work, I have to disable and re-enable all the displays using a command like the one below. (Which honestly does not work 100% of the time either).

swaymsg "output 'Microstep MSI MP243X PB5H403A00291' enable pos 0 0 res --custom 1920x1080@30Hz" # DP
swaymsg "output 'Microstep MSI MP243X PB5H403A00098' enable pos 1920 0 res --custom 1920x1080@30Hz" # HDMI
swaymsg "output 'LG Electronics LG FULL HD 208NTHM8S705' enable pos 3840 0 res --custom 1920x1080@60Hz" # VGA

(I'm using custom resolutions as the docking station I use won't allow two monitors over 30Hz, it's weird, that's a hardware not a sway issue tho, and worked fine in 1.8 anyway)

Doing some debugging myself and parsing through the log files, I noticed these snippets that may help in figuring out what's going on.

DP-6 is the VGA, DP-4 is the DP and DP-5 is the HDMI.

[..snip..]
Swapchain for output 'DP-5' failed test # I see this alot in the logs.
[..snip..]
00:00:19.374 [DEBUG] [wlr] [backend/drm/drm.c:652] connector DP-5: Can't enable an output without a mode
00:00:19.374 [ERROR] [wlr] [types/output/swapchain.c:109] Swapchain for output 'DP-5' failed test
[..snip..]
00:00:19.379 [DEBUG] [wlr] [backend/drm/drm.c:652] connector DP-4: Can't enable an output without a mode
00:00:19.379 [DEBUG] [wlr] [types/output/swapchain.c:98] Output test failed on 'DP-4', retrying without modifiers
00:00:19.379 [DEBUG] [wlr] [types/output/swapchain.c:27] Choosing primary buffer format XR24 (0x34325258) for output 'DP-4'
00:00:19.379 [DEBUG] [wlr] [types/output/swapchain.c:107] Testing modifier-less swapchain for output 'DP-4'
00:00:19.379 [DEBUG] [wlr] [render/swapchain.c:106] Allocating new swapchain buffer
00:00:19.380 [DEBUG] [wlr] [render/allocator/gbm.c:145] Allocated 1920x1080 GBM buffer with format XR24 (0x34325258), modifier INVALID (0x00FFFFFFFFFFFFFF)
00:00:19.380 [DEBUG] [wlr] [backend/drm/drm.c:652] connector DP-4: Can't enable an output without a mode
00:00:19.380 [ERROR] [wlr] [types/output/swapchain.c:109] Swapchain for output 'DP-4' failed test

Also went through the issues list to see if anyone else had something similar. Tried the fix WLR_DRM_NO_MODIFIERS=1, and installed wlroots-git but no luck.

Links to Gists of the logs (sway -d/dmesg -w) below and my config also.

Thanks in advance for the help and thanks for making and maintaining Sway <3

Please fill out the following:

pixelherodev commented 3 months ago

I can reproduce this issue. I've taken to switching to an unused TTY before turning the monitor off, and switching back to sway after turning the monitor on

pixelherodev commented 3 months ago

I'm heading out to a friend's wedding tomorrow; I'll do a git bisect when I get back if nobody's taken a closer look by then :)

pixelherodev commented 1 month ago

I don't think I can reproduce this anymore I misremembered the repro steps, can repro still with 1.9.

iDigitalFlame commented 1 month ago

Yea, I just tried with the latest (on Arch it's 1.9-5), and I can get the same issue.

Oddly enough it was working a little, but 90% of the time one or two displays would fail to power on with the same error. It only worked when changing the freq to 60Hz.

Got similar error messages when attempting to run with debug logging.

It seems to fail mode-setting and defaults to INVALID 0x00FFFFFFFFFFFFFF

00:00:00.602 [DEBUG] [sway/config/output.c:481] Set DP-4 adaptive sync to 1
00:00:00.602 [DEBUG] [wlr] [types/output/render.c:168] Attaching empty buffer to output for modeset
00:00:00.602 [DEBUG] [wlr] [types/output/swapchain.c:27] Choosing primary buffer format XR24 (0x34325258) for output 'DP-4'
00:00:00.602 [DEBUG] [wlr] [types/output/swapchain.c:96] Testing swapchain for output 'DP-4'
00:00:00.602 [DEBUG] [wlr] [render/swapchain.c:106] Allocating new swapchain buffer
00:00:00.603 [DEBUG] [wlr] [render/allocator/gbm.c:145] Allocated 1920x1080 GBM buffer with format XR24 (0x34325258), modifier Y_TILED_GEN12_RC_CCS_CC (0x0100000000000008)
00:00:00.603 [DEBUG] [wlr] [backend/drm/drm.c:733] connector DP-4: Failed to enable adaptive sync: connector doesn't support VRR
00:00:00.603 [DEBUG] [wlr] [types/output/swapchain.c:98] Output test failed on 'DP-4', retrying without modifiers
00:00:00.603 [DEBUG] [wlr] [types/output/swapchain.c:27] Choosing primary buffer format XR24 (0x34325258) for output 'DP-4'
00:00:00.603 [DEBUG] [wlr] [types/output/swapchain.c:107] Testing modifier-less swapchain for output 'DP-4'
00:00:00.603 [DEBUG] [wlr] [render/swapchain.c:106] Allocating new swapchain buffer
00:00:00.604 [DEBUG] [wlr] [render/allocator/gbm.c:145] Allocated 1920x1080 GBM buffer with format XR24 (0x34325258), modifier INVALID (0x00FFFFFFFFFFFFFF)
00:00:00.604 [DEBUG] [wlr] [backend/drm/drm.c:733] connector DP-4: Failed to enable adaptive sync: connector doesn't support VRR
00:00:00.604 [ERROR] [wlr] [types/output/swapchain.c:109] Swapchain for output 'DP-4' failed test
00:00:00.604 [DEBUG] [sway/config/output.c:485] Adaptive sync failed, ignoring
00:00:00.604 [DEBUG] [sway/config/output.c:520] Committing output DP-4
00:00:00.604 [DEBUG] [wlr] [types/output/render.c:168] Attaching empty buffer to output for modeset
00:00:00.604 [DEBUG] [wlr] [types/output/swapchain.c:27] Choosing primary buffer format XR24 (0x34325258) for output 'DP-4'
00:00:00.604 [DEBUG] [wlr] [types/output/swapchain.c:96] Testing swapchain for output 'DP-4'
00:00:00.605 [DEBUG] [wlr] [render/swapchain.c:106] Allocating new swapchain buffer
00:00:00.606 [DEBUG] [wlr] [render/allocator/gbm.c:145] Allocated 1920x1080 GBM buffer with format XR24 (0x34325258), modifier Y_TILED_GEN12_RC_CCS_CC (0x0100000000000008)
00:00:00.606 [DEBUG] [wlr] [render/fx_renderer/fx_framebuffer.c:127] Created GL FBO for buffer 1920x1080
00:00:00.606 [INFO] [wlr] [backend/drm/drm.c:786] connector DP-4: Modesetting with 1920x1080 @ 60.000 Hz
00:00:00.614 [DEBUG] [sway/config/output.c:566] Set Microstep MSI MP243X PB5H403A00098 position to 1920, 0
00:00:00.614 [DEBUG] [sway/tree/arrange.c:263] Usable area for ws: 1920x1080@0,0
00:00:00.614 [DEBUG] [sway/tree/arrange.c:297] Arranging workspace '0' at 5.000000, 1925.000000
00:00:00.614 [DEBUG] [sway/desktop/transaction.c:398] Transaction 0x5bb07a9fa780 committing with 1 instructions
00:00:00.614 [DEBUG] [sway/desktop/transaction.c:294] Applying transaction 0x5bb07a9fa780
00:00:00.614 [DEBUG] [wlr] [render/swapchain.c:106] Allocating new swapchain buffer
00:00:00.614 [DEBUG] [wlr] [render/allocator/gbm.c:145] Allocated 256x256 GBM buffer with format AR24 (0x34325241), modifier LINEAR (0x0000000000000000)
00:00:00.614 [DEBUG] [wlr] [render/fx_renderer/fx_framebuffer.c:127] Created GL FBO for buffer 256x256
00:00:00.614 [DEBUG] [sway/tree/workspace.c:279] Workspace: Generating new workspace name for output DP-4
Nefsen402 commented 1 month ago

Sway 1.9 will not see any more bugfix releases. It would be nice to know if the current 1.10 release candidates improve this as all modeset logic was basically rewritten.