Sway: Garbled external display on second connect

Created on 25 Apr 2020  路  10Comments  路  Source: swaywm/sway

Connecting an external display for a second time causes image on that display to be garbled. See the "before and after" picure.

picture

The display is attached with a USB-C to DisplayPort adapter because I have no other option of attaching external displays to my Dell 7390 2-in-1 than USB-C. Same thing happens when I connect the display to a Thunderbolt dock and the laptop to the dock.

  • Steps:
  1. Boot
  2. Run sway
  3. Connect external display
  4. Disconnect external display
  5. Connect external display

It would be amazing if someone could help me to find a solution. Thanks in advance.

All 10 comments

Can you reproduce with Weston?

I kind of can, but it is different.

Booting, running weston and connecting the display (even for the first time) causes weston to freeze (can't move mouse cursor) UNLESS I move the cursor while connecting the display. This seems weird but I can connect and disconnect the display many times and as long as I move the cursor while connecting, everything seems fine.

While experimenting I also found out that after performing the steps from the first post and quitting sway, I cannot run sway again. It immediately quits with the following log:

2020-04-25 19:59:39 - [sway/main.c:152] Linux userpc 5.6.6-arch1-1 #1 SMP PREEMPT Tue, 21 Apr 2020 10:35:16 +0000 x86_64 GNU/Linux
2020-04-25 19:59:39 - [sway/main.c:168] Contents of /etc/os-release:
2020-04-25 19:59:39 - [sway/main.c:152] NAME="Arch Linux"
2020-04-25 19:59:39 - [sway/main.c:152] PRETTY_NAME="Arch Linux"
2020-04-25 19:59:39 - [sway/main.c:152] ID=arch
2020-04-25 19:59:39 - [sway/main.c:152] BUILD_ID=rolling
2020-04-25 19:59:39 - [sway/main.c:152] ANSI_COLOR="0;36"
2020-04-25 19:59:39 - [sway/main.c:152] HOME_URL="https://www.archlinux.org/"
2020-04-25 19:59:39 - [sway/main.c:152] DOCUMENTATION_URL="https://wiki.archlinux.org/"
2020-04-25 19:59:39 - [sway/main.c:152] SUPPORT_URL="https://bbs.archlinux.org/"
2020-04-25 19:59:39 - [sway/main.c:152] BUG_REPORT_URL="https://bugs.archlinux.org/"
2020-04-25 19:59:39 - [sway/main.c:152] LOGO=archlinux
2020-04-25 19:59:39 - [sway/main.c:140] LD_LIBRARY_PATH=/home/user/.local/lib:
2020-04-25 19:59:39 - [sway/main.c:140] LD_PRELOAD=(null)
2020-04-25 19:59:39 - [sway/main.c:140] PATH=/home/user/.local/bin:/usr/local/bin:/usr/bin
2020-04-25 19:59:39 - [sway/main.c:140] SWAYSOCK=/run/user/1000/sway-ipc.1000.958.sock
2020-04-25 19:59:39 - [sway/server.c:40] Preparing Wayland server initialization
2020-04-25 19:59:39 - [backend/wayland/backend.c:255] Creating wayland backend
2020-04-25 19:59:39 - [backend/wayland/backend.c:271] Could not connect to remote display: No such file or directory
2020-04-25 19:59:39 - [backend/noop/backend.c:51] Creating noop backend
2020-04-25 19:59:39 - [sway/server.c:47] Unable to create backend

No such issues in GNOME on Wayland or GNOME on X.

This happens because WAYLAND_DISPLAY is set in your environment.

Ok, you were right. I can now exit and run sway again, but rerunning sway doesn't fix the external display.

Looks like I'm not the only one having this issue. Yesterday this was posted on Arch Linux forums.

I ran into this issue on 1.4 as well, but I wasn't able to reproduce it on the master branch (currently running commit https://github.com/swaywm/sway/commits/7251df94).

I'm not sure if it's the same issue or not, but I found I was able to consistently cause garbled colors on my laptop (not even using an external display) by exiting sway while running an application (Firefox or Alacritty) on Sway 1.4. Those issues also went away when I switched to the master branch.

I cannot reproduce exactly the same issue (garbled colors) on master branch (5e5e5f2e).

Now reconnecting the display causes it to stay completely black. It's consistent.

Config: default

Log: sway.log

Steps:

  1. Boot, enter username and password.
  2. Run sway --debug 2> sway.log.
  3. Connect external display through USB-C: DisplayPort / HDMI, dongle / dock.
  4. Disconnect the display.
  5. Connect again.

The external screen is now black.

I think this part of the log may be interesting. I diffed first connect with second connect of the external display. (- or red is first successful connect, + or green is failed second)

It seems that there are some errors during renderer initialization.

 [DEBUG] [backend/drm/drm.c:1215]   'DP-6' crtc=-1 state=0 desired_enabled=0
 [DEBUG] [backend/drm/drm.c:1215]   'DP-7' crtc=2 state=1 desired_enabled=1
 [INFO] [backend/drm/drm.c:1518] Requesting modeset for 'DP-7'
-[sway/desktop/output.c:923] New output 0x55b3eb4cb830: DP-7
+[sway/desktop/output.c:923] New output 0x55b3eb5a4260: DP-7
 [sway/config/output.c:348] Turning on output DP-7
 [sway/config/output.c:379] Auto-detected output scale: 1.000000
 [sway/config/output.c:418] Committing output DP-7
 [INFO] [backend/drm/drm.c:829] Modesetting 'DP-7' with '1920x1080@60000 mHz'
 [DEBUG] [backend/drm/drm.c:709] Initializing renderer on connector 'DP-7'
-[DEBUG] [backend/drm/drm.c:690] Starting renderer on output 'DP-7'
-[ERROR] [backend/drm/drm.c:344] Failed to page-flip output 'DP-7': a page-flip is already pending
-[sway/tree/arrange.c:263] Usable area for ws: 1920x1180@0,20
-[sway/tree/arrange.c:293] Arranging workspace '1' at 1920.000000, 20.000000
-[sway/desktop/transaction.c:411] Transaction 0x55b3eb5a4bc0 committing with 1 instructions
-[sway/desktop/transaction.c:280] Applying transaction 0x55b3eb5a4bc0
-[sway/tree/workspace.c:283] Workspace: Generating new workspace name for output DP-7
-[sway/tree/workspace.c:218] Got valid workspace command for target: '1'
-[sway/tree/workspace.c:218] Got valid workspace command for target: '2'
-[sway/tree/workspace.c:274] Workspace: Found free name 2
-[sway/tree/workspace.c:218] Got valid workspace command for target: '3'
-[sway/tree/workspace.c:218] Got valid workspace command for target: '4'
-[sway/tree/workspace.c:218] Got valid workspace command for target: '5'
-[sway/tree/workspace.c:218] Got valid workspace command for target: '6'
-[sway/tree/workspace.c:218] Got valid workspace command for target: '7'
-[sway/tree/workspace.c:218] Got valid workspace command for target: '8'
-[sway/tree/workspace.c:218] Got valid workspace command for target: '9'
-[sway/tree/workspace.c:218] Got valid workspace command for target: '10'
-[sway/tree/output.c:127] Creating default workspace 2
-[sway/tree/workspace.c:63] Adding workspace 2 for output DP-7
-[sway/ipc-server.c:308] Sending workspace::init event
-[sway/ipc-server.c:951] Added IPC reply of type 0x80000000 to client 55 queue: { "change": "init", "old": null, "current": { "id": 6, "name": "2", "rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "focused": false, "focus": [ ], "border": "none", "current_border_width": 0, "layout": "splith", "orientation": "horizontal", "percent": null, "window_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 0, "height": 0 }, "window": null, "urgent": false, "marks": [ ], "fullscreen_mode": 1, "nodes": [ ], "floating_nodes": [ ], "sticky": false, "num": 2, "output": "DP-7", "type": "workspace", "representation": null } }
-[sway/ipc-server.c:308] Sending workspace::init event
-[sway/ipc-server.c:951] Added IPC reply of type 0x80000000 to client 55 queue: { "change": "init", "old": null, "current": { "id": 6, "name": "2", "rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "focused": false, "focus": [ ], "border": "none", "current_border_width": 0, "layout": "splith", "orientation": "horizontal", "percent": null, "window_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 0, "height": 0 }, "window": null, "urgent": false, "marks": [ ], "fullscreen_mode": 1, "nodes": [ ], "floating_nodes": [ ], "sticky": false, "num": 2, "output": "DP-7", "type": "workspace", "representation": null } }
-[sway/input/seat.c:930] Cannot load xcursor theme for output 'eDP-1' with scale 1.000000
-[sway/input/seat.c:930] Cannot load xcursor theme for output 'DP-7' with scale 1.000000
-[DEBUG] [backend/drm/drm.c:1012] SET_CURSOR 0x55b3eb5a4bc0 0x55b3eb5a4bc0
-[DEBUG] [backend/drm/drm.c:1012] SET_CURSOR 0x55b3eb4cf5b0 0x55b3eb4cf5b0
-[sway/desktop/layer_shell.c:189] Usable area changed, rearranging output
-[sway/tree/arrange.c:263] Usable area for ws: 1920x1080@0,0
-[sway/tree/arrange.c:293] Arranging workspace '2' at 0.000000, 0.000000
-[sway/tree/arrange.c:263] Usable area for ws: 1920x1180@0,20
-[sway/tree/arrange.c:293] Arranging workspace '1' at 1920.000000, 20.000000
-[sway/tree/arrange.c:263] Usable area for ws: 1920x1080@0,0
-[sway/tree/arrange.c:293] Arranging workspace '2' at 0.000000, 0.000000
-[sway/input/switch.c:95] Configured switch for device
-[sway/desktop/transaction.c:411] Transaction 0x55b3eb5a8190 committing with 3 instructions
-[sway/desktop/transaction.c:280] Applying transaction 0x55b3eb5a8190
-[INFO] [backend/drm/drm.c:1098] DP-7: Retrying pageflip
-[DEBUG] [backend/drm/drm.c:690] Starting renderer on output 'DP-7'
-[ERROR] [backend/drm/drm.c:344] Failed to page-flip output 'DP-7': a page-flip is already pending
+[ERROR] [backend/drm/renderer.c:379] Tried to acquire an FB with a NULL BO
+[INFO] [backend/drm/drm.c:743] Page-flip failed with primary FB modifiers enabled, retrying without modifiers
+[ERROR] [backend/drm/renderer.c:379] Tried to acquire an FB with a NULL BO
+[ERROR] [backend/drm/drm.c:752] Failed to initialize renderer on connector 'DP-7': initial page-flip failed
+[ERROR] [backend/drm/drm.c:835] Failed to initialize renderer for plane
+[sway/config/output.c:423] Failed to commit output DP-7
 [DEBUG] [backend/session/session.c:40] udev event for card0 (change)
 [DEBUG] [backend/drm/backend.c:138] /dev/dri/card0 invalidated
 [INFO] [backend/drm/drm.c:1307] Scanning DRM connectors

Yes. These are a separate issue, see https://github.com/swaywm/wlroots/issues/2150

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mcmfb picture mcmfb  路  3Comments

StephenBrown2 picture StephenBrown2  路  4Comments

RyanDwyer picture RyanDwyer  路  3Comments

ghost picture ghost  路  4Comments

J0nnyMak0 picture J0nnyMak0  路  3Comments