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

Outputs refuse to enable after being disabled #5101

Closed
kennylevinsen opened this issue Mar 13, 2020 · 20 comments
Closed

Outputs refuse to enable after being disabled #5101

kennylevinsen opened this issue Mar 13, 2020 · 20 comments

Comments

@kennylevinsen
Copy link
Member

kennylevinsen commented Mar 13, 2020

To reproduce

  • Have multiple screens. Only some of the active screens will exhibit this issue, and not always.
  • Run swayidle to dpms off/dpms on on idle/wake-up.
  • Wait for idle to disable the screens, and wait for the screens themselves to suspend. Note that machine suspension is not involved.
  • Wake the machine back up by providing input.

Observed to happen on three different computers with each their own dual-screen setup.

Expected output

Everything wakes up.

Actual result

One output remains inactive, and is listed as such by swaymsg -t get_outputs, as well as /sys/class/drm/card0-DP-2/enabled. It cannot be enabled by swaymsg.

Switching to another VT shows that the screen is fine and dandy under the linux console. Switching back will generally still show the display as disabled, but sometimes this will cause it to come back to life.

Workaround

Physically turning the screen off, waiting a moment, and turning it back on seems to do the trick. EDIT: This is rarely the case.

@kennylevinsen
Copy link
Member Author

kennylevinsen commented Mar 13, 2020

Debug logs

These are logs from a reproduction, where I left sway idle for a long time, woke it up, and DP-2 was then dead.

I got the screen back alive by switching to another VT, switching back. This made the screen wake up, say no signal, and shut down again. When it shut down, sway registered it and got it back up correctly.

And the following snippets that I keep in /etc/sway/config.d/:

# /etc/sway/config.d/10-touchscreen
input {
        "1267:9454:ELAN24EE:00_04F3:24EE" {
                map_to_output eDP-1
        }
}

# /etc/sway/config.d/20-max-render-time
output {
    * {
        max_render_time 7
    }
}

# /etc/sway/config.d/30-outputs
output "Goldstar Company Ltd LG Ultra HD 0x00003202" position 0,0
output "Goldstar Company Ltd LG Ultra HD 0x00003200" position 3840,0
output eDP-1 position 7680,0 scale 1

output "Philips Consumer Electronics Company PHL 328P6VU AU51947001282" position 3840,0

@kennylevinsen
Copy link
Member Author

Interesting part from debug log:

00:19:41.951 [backend/drm/drm.c:1503] Requesting modeset for 'DP-1'
00:19:41.952 [sway/desktop/output.c:865] New output 0x5639bd37f670: DP-1
00:19:41.952 [sway/config/output.c:356] Turning on output DP-1
00:19:41.952 [sway/config/output.c:401] Committing output DP-1
00:19:41.952 [backend/drm/drm.c:755] Modesetting 'DP-1' with '3840x2160@59997 mHz'
00:19:41.952 [backend/drm/drm.c:633] Initializing renderer on connector 'DP-1'
00:19:42.096 [backend/drm/drm.c:611] Starting renderer on output 'DP-1'
00:19:42.129 [sway/config/output.c:433] Set Goldstar Company Ltd LG Ultra HD 0x00003202 position to 0, 0
00:19:42.129 [sway/tree/workspace.c:283] Workspace: Generating new workspace name for output DP-1
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: 'next_on_output'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: 'prev_on_output'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '1'
00:19:42.130 [sway/tree/workspace.c:274] Workspace: Found free name 1
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '2'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '3'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '4'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '5'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '6'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '7'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '8'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '9'
00:19:42.130 [sway/tree/workspace.c:218] Got valid workspace command for target: '0'
00:19:42.130 [sway/tree/output.c:127] Creating default workspace 1
00:19:42.130 [sway/tree/workspace.c:63] Adding workspace 1 for output DP-1
00:19:42.130 [sway/desktop/layer_shell.c:178] Usable area changed, rearranging output
00:19:42.130 [sway/tree/arrange.c:263] Usable area for ws: 3840x2160@0,0
00:19:42.130 [sway/tree/arrange.c:293] Arranging workspace '1' at 0.000000, 0.000000
00:19:42.130 [sway/tree/arrange.c:263] Usable area for ws: 3840x2160@0,0
00:19:42.130 [sway/tree/arrange.c:293] Arranging workspace '1' at 0.000000, 0.000000
00:19:42.130 [sway/config/output.c:458] Set Goldstar Company Ltd LG Ultra HD 0x00003202 max render time to 7
00:19:42.130 [sway/desktop/transaction.c:411] Transaction 0x5639bd92a420 committing with 2 instructions
00:19:42.130 [sway/desktop/transaction.c:280] Applying transaction 0x5639bd92a420
00:19:42.130 [backend/drm/drm.c:1503] Requesting modeset for 'DP-2'
00:19:42.130 [sway/desktop/output.c:865] New output 0x5639bd359d20: DP-2
00:19:42.130 [sway/config/output.c:356] Turning on output DP-2
00:19:42.130 [sway/config/output.c:401] Committing output DP-2
00:19:42.130 [backend/drm/drm.c:755] Modesetting 'DP-2' with '3840x2160@59997 mHz'
00:19:42.130 [backend/drm/drm.c:633] Initializing renderer on connector 'DP-2'
00:19:42.154 [backend/drm/atomic.c:56] DP-2: Atomic commit failed (modeset): Invalid argument
00:19:42.154 [backend/drm/drm.c:669] Page-flip failed with primary FB modifiers enabled, retrying without modifiers
00:19:42.169 [backend/drm/atomic.c:56] DP-2: Atomic commit failed (modeset): Invalid argument
00:19:42.169 [backend/drm/drm.c:678] Failed to initialize renderer on connector 'DP-2': initial page-flip failed
00:19:42.169 [backend/drm/drm.c:761] Failed to initialize renderer for plane
00:19:42.169 [sway/config/output.c:406] Failed to modeset output DP-2
00:19:42.185 [backend/drm/drm.c:397] Skipping pageflip on output 'DP-1'

Failed modeset...

@colemickens
Copy link
Contributor

This sounds and nearly identical to my symptoms in swaywm/wlroots#1877 which I still suffer from frequently even with the environment varialble set. (though, I also wonder about this XPS's usb ports, so I have just been dealing with it by un/re-plugging until it comes back)

@emersion
Copy link
Member

EINVAL actually means that the driver doesn't like our atomic commit. Obtaining DRM logs would be useful…

@kennylevinsen
Copy link
Member Author

Hmm, so far my attempts to reproduce with DRM debug enabled has failed. I wonder if it's a race.

@kennylevinsen
Copy link
Member Author

dmesg.log

This DRM log was started after the issue occurred (i.e. dead screen). The screen was turned on/off a few times to no avail (despite having worked previously), but it does appear to populate the log. There's a bunch of failed atomic driver checks in there. A sway reload was also executed under this log recording, as that has helped before.

During the time the log was recorded, 3 4k screens were connected to the machine (which is known to exceed DDB limitations of this system), but only one is operable.

@kennylevinsen
Copy link
Member Author

Fun-but-possibly-unrelated fact: Every time I power toggle the dead monitor, it accumulates available modes in sway:

[kenny@lappy ~]$ swaymsg -t get_outputs
Output DP-1 'Goldstar Company Ltd LG Ultra HD 0x00003200' (focused)
  Current mode: 3840x2160 @ 59.997002 Hz
  Position: 3840,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 3
  Max render time: 7 ms
  Adaptive sync: disabled
  Available modes:
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    800x600 @ 60.317001 Hz
    1024x768 @ 60.004002 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.810001 Hz
    1280x1024 @ 60.020000 Hz
    1600x900 @ 60.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz
    2560x1440 @ 59.951000 Hz
    3840x2160 @ 30.000000 Hz
    3840x2160 @ 59.997002 Hz

Output DP-2 'Goldstar Company Ltd LG Ultra HD 0x00003202' (inactive)
  Available modes:
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    800x600 @ 60.317001 Hz
    1024x768 @ 60.004002 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.810001 Hz
    1280x1024 @ 60.020000 Hz
    1600x900 @ 60.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz
    2560x1440 @ 59.951000 Hz
    3840x2160 @ 30.000000 Hz
    3840x2160 @ 59.997002 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    800x600 @ 60.317001 Hz
    1024x768 @ 60.004002 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.810001 Hz
    1280x1024 @ 60.020000 Hz
    1600x900 @ 60.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz
    2560x1440 @ 59.951000 Hz
    3840x2160 @ 30.000000 Hz
    3840x2160 @ 59.997002 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    800x600 @ 60.317001 Hz
    1024x768 @ 60.004002 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.810001 Hz
    1280x1024 @ 60.020000 Hz
    1600x900 @ 60.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz
    2560x1440 @ 59.951000 Hz
    3840x2160 @ 30.000000 Hz
    3840x2160 @ 59.997002 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    800x600 @ 60.317001 Hz
    1024x768 @ 60.004002 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.810001 Hz
    1280x1024 @ 60.020000 Hz
    1600x900 @ 60.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz
    2560x1440 @ 59.951000 Hz
    3840x2160 @ 30.000000 Hz
    3840x2160 @ 59.997002 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    800x600 @ 60.317001 Hz
    1024x768 @ 60.004002 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.810001 Hz
    1280x1024 @ 60.020000 Hz
    1600x900 @ 60.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz
    2560x1440 @ 59.951000 Hz
    3840x2160 @ 30.000000 Hz
    3840x2160 @ 59.997002 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    800x600 @ 60.317001 Hz
    1024x768 @ 60.004002 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.810001 Hz
    1280x1024 @ 60.020000 Hz
    1600x900 @ 60.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz
    2560x1440 @ 59.951000 Hz
    3840x2160 @ 30.000000 Hz
    3840x2160 @ 59.997002 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    800x600 @ 60.317001 Hz
    1024x768 @ 60.004002 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.810001 Hz
    1280x1024 @ 60.020000 Hz
    1600x900 @ 60.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz
    2560x1440 @ 59.951000 Hz
    3840x2160 @ 30.000000 Hz
    3840x2160 @ 59.997002 Hz

Output eDP-1 'Sharp Corporation 0x148B 0x00000000' (inactive)

@ammgws
Copy link
Contributor

ammgws commented Mar 23, 2020

About your fun observation, sounds like this: #5044
Welcome to the club. I thought it would be an easy fix but haven't been able to pin where in the code it starts to append them.

@kennylevinsen
Copy link
Member Author

kennylevinsen commented Apr 21, 2020

Using WLR_DRM_NO_MODIFIERS=1 seems to fix it. This seems to line up with the logs stating that DDB limitations have been exceeded.

I do find this rather weird, as the device can drive all 3 displays without a hitch (although attempts to direct scan-out can lead to DDB limitation warnings), and yet a configuration with only two of these displays fail to resume. :|

@kennylevinsen
Copy link
Member Author

kennylevinsen commented Apr 29, 2020

So, I have a few reproductions with debug:

Reproduction one:
dmesg.log
sway.log

Reproduction two, where there is also some i915 debugfs stuff:
dmesg.log
sway.log
after_display_info.txt
after_state.txt
before_display_info.txt
before_state.txt

Reproduction three, drm_info:
after_drm_info.txt
before_drm_info.txt

@kennylevinsen
Copy link
Member Author

It just happened with WLR_DRM_NO_MODIFIERS. :/

@emersion
Copy link
Member

emersion commented May 1, 2020

00:01:19.138 [backend/drm/drm.c:828] Modesetting 'DP-2' with '3840x2160@59997 mHz'
00:01:19.138 [backend/drm/drm.c:708] Initializing renderer on connector 'DP-2'
00:01:19.145 [backend/drm/drm.c:344] Skipping pageflip on output 'DP-2'
00:01:19.145 [backend/drm/drm.c:742] Page-flip failed with primary FB modifiers enabled, retrying without modifiers
00:01:19.152 [backend/drm/drm.c:344] Skipping pageflip on output 'DP-2'
00:01:19.153 [backend/drm/drm.c:751] Failed to initialize renderer on connector 'DP-2': initial page-flip failed
00:01:19.153 [backend/drm/drm.c:834] Failed to initialize renderer for plane

This one is fixed by swaywm/wlroots#2147.

@emersion
Copy link
Member

Can you still reproduce?

@kennylevinsen
Copy link
Member Author

Unfortunately, yes. I get the new and improved error message in the debug log. Not much else, though. Haven't tried to get new DRM logs though.

@kennylevinsen
Copy link
Member Author

kennylevinsen commented May 14, 2020

dmesg.log

May 15 00:58:40 lappy sway[6405]: 02:45:28.101 [DEBUG] [backend/drm/drm.c:727] Initializing renderer on connector 'DP-1'
May 15 00:58:40 lappy sway[6405]: 02:45:28.111 [ERROR] [backend/drm/atomic.c:36] DP-1: Atomic commit failed (modeset): Invalid argument
May 15 00:58:40 lappy sway[6405]: 02:45:28.111 [INFO] [backend/drm/drm.c:765] Page-flip failed with primary FB modifiers enabled, retrying without modifiers
May 15 00:58:40 lappy sway[6405]: 02:45:28.118 [ERROR] [backend/drm/atomic.c:36] DP-1: Atomic commit failed (pageflip): Invalid argument
May 15 00:58:40 lappy sway[6405]: 02:45:28.118 [ERROR] [backend/drm/drm.c:774] Failed to initialize renderer on connector 'DP-1': initial page-flip failed
May 15 00:58:40 lappy sway[6405]: 02:45:28.118 [ERROR] [backend/drm/drm.c:863] Failed to initialize renderer for plane
May 15 00:58:40 lappy sway[6405]: 02:45:28.118 [sway/config/output.c:423] Failed to commit output DP-1

@kennylevinsen
Copy link
Member Author

Interestingly, the behavior seems to have changed after the atomic commit rework. The way a display fails to enable has changed (it is now just black, but is part of the layout and reports as enabled), and it seems to now be fixable by simply disabling and re-enabling the display.

It still seems to happen pretty consistently, though, so the problem is still there - just different. I'll take a look at the debug logs again soon.

emersion added a commit to emersion/wlroots that referenced this issue Jun 3, 2020
This patch fixes this failure:

    01:57:16.642 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending
    01:57:16.684 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending
    01:57:16.684 [ERROR] [backend/drm/drm.c:732] Failed to initialize renderer on connector 'eDP-1': initial page-flip failed
    01:57:16.684 [ERROR] [backend/drm/drm.c:805] Failed to initialize renderer for plane
    01:57:16.684 [sway/config/output.c:423] Failed to commit output eDP-1

References: swaywm/sway#5101
emersion added a commit to emersion/wlroots that referenced this issue Jun 3, 2020
This patch fixes this failure:

    01:57:16.642 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending
    01:57:16.684 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending
    01:57:16.684 [ERROR] [backend/drm/drm.c:732] Failed to initialize renderer on connector 'eDP-1': initial page-flip failed
    01:57:16.684 [ERROR] [backend/drm/drm.c:805] Failed to initialize renderer for plane
    01:57:16.684 [sway/config/output.c:423] Failed to commit output eDP-1

References: swaywm/sway#5101
ddevault pushed a commit to swaywm/wlroots that referenced this issue Jun 3, 2020
This patch fixes this failure:

    01:57:16.642 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending
    01:57:16.684 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending
    01:57:16.684 [ERROR] [backend/drm/drm.c:732] Failed to initialize renderer on connector 'eDP-1': initial page-flip failed
    01:57:16.684 [ERROR] [backend/drm/drm.c:805] Failed to initialize renderer for plane
    01:57:16.684 [sway/config/output.c:423] Failed to commit output eDP-1

References: swaywm/sway#5101
@kennylevinsen
Copy link
Member Author

I can happily say that I have not seen this since swaywm/wlroots@8f28f5b was merged!

It also appears to have fixed the situation I had where a monitor after being disabled occasionally would re-enable at a wrong mode, being stuck at e.g. 2k for a 4k display.

@ammgws
Copy link
Contributor

ammgws commented Jun 12, 2020

Do you still come across the issue mentioned above and in #5044?

@Nomeji
Copy link
Contributor

Nomeji commented Jul 10, 2020

Issue is still present for me in sway 1.5, anybody else tried the fix?

@emersion
Copy link
Member

Outputs can refuse to enable for a number of reasons. Please open a separate bug report with debug logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants