Sway Window Manager Logo

A few months ago, I wanted to add in a 10G Ethernet card to my primary development box. Since it’s an ITX build, I only had one PCI-E slot that was occupied with an old AMD RX 550 video card. Even though the Ryzen 2700X processor it held was more than powerful enough for my needs, I switched it out with a Ryzen 5700G so I could free up the PCI-E slot for 10G networking. Unfortunately, X11 started crashing recently with the integrated graphics. Sway/Wayland seems to run stable. I currently use Sway on my personal laptop, so I attempted to take the plunge again and see if I could switch to it on my primary machine. I jumped in with an open mind, and found replacements for many of the i3/X11 tools that do not work with Sway/Wayland. The following is a summary of what worked, what didn’t quite work and what’s still broken. The version of Sway I’m using is 1.7 on Gentoo.

Kernel Panic

I currently use the amdgpu driver with the integrated graphics on my Ryzen 7 5700G. A few weeks ago, I started getting the following kernel panics.

[64558.800527] [drm:amdgpu_cs_ioctl] *ERROR* Failed to initialize parser -125!
[64558.801478] [drm:amdgpu_cs_ioctl] *ERROR* Failed to initialize parser -125!
[64558.801504] [drm:amdgpu_cs_ioctl] *ERROR* Failed to initialize parser -125!
[64561.024538] BUG: kernel NULL pointer dereference, address: 0000000000000010
[64561.024542] #PF: supervisor read access in kernel mode
[64561.024543] #PF: error_code(0x0000) - not-present page
[64561.024544] PGD 0 P4D 0
[64561.024546] Oops: 0000 [#1] PREEMPT SMP NOPTI
[64561.024548] CPU: 12 PID: 5519 Comm: X Tainted: G           O      5.19.9-gentoo #1
[64561.024550] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./B550M Steel Legend, BIOS P1.80 12/01/2020
[64561.024550] RIP: 0010:ttm_bo_swapout+0x45/0x20c
[64561.024555] Code: 8b 04 25 28 00 00 00 48 89 44 24 48 31 c0 4c 8d 74 24 10 4c 89 f7 4c 89 f2 f3 ab 48 8b 85 58 01 00 00 48 8d 4c 24 07 48 89 ef <8b> 40 10 89 44 24 18 e8 f9 f4 ff ff 84 c0 74 3f 48 8b 85 60 01 00
[64561.024557] RSP: 0018:ffffc9000117ba28 EFLAGS: 00010246
[64561.024558] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffc9000117ba2f
[64561.024559] RDX: ffffc9000117ba38 RSI: ffffc9000117bc40 RDI: ffff8881fd1a0858
[64561.024559] RBP: ffff8881fd1a0858 R08: 0000000000000000 R09: 0000000000000000
[64561.024560] R10: ffffc9000117b8b8 R11: 0000000000000000 R12: ffff888104565140
[64561.024561] R13: 0000000000000cc0 R14: ffffc9000117ba38 R15: ffff888104565948
[64561.024562] FS:  00007fea8e7348c0(0000) GS:ffff888fce300000(0000) knlGS:0000000000000000
[64561.024563] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[64561.024564] CR2: 0000000000000010 CR3: 000000010fcee000 CR4: 0000000000750ee0
[64561.024565] PKRU: 55555554
[64561.024565] Call Trace:
[64561.024567]  <TASK>
[64561.024568]  ? slab_pre_alloc_hook.constprop.0+0x3c/0x14d
[64561.024571]  ? __down_read_common+0x83/0x278
[64561.024573]  ttm_device_swapout+0xae/0xf4
[64561.024576]  ttm_global_swapout+0x39/0x8b
[64561.024577]  ttm_tt_populate+0x70/0x12f
[64561.024578]  ttm_bo_handle_move_mem+0xa7/0x11f
[64561.024579]  ttm_bo_validate+0x8d/0x118
[64561.024580]  ttm_bo_init_reserved+0x119/0x145
[64561.024582]  amdgpu_bo_create+0x1fc/0x35c
[64561.024584]  ? amdgpu_bo_vm_destroy+0x67/0x67
[64561.024585]  amdgpu_bo_create_user+0x2f/0x59
[64561.024586]  amdgpu_gem_object_create+0x77/0xb1
[64561.024588]  ? amdgpu_bo_vm_destroy+0x67/0x67
[64561.024589]  amdgpu_gem_create_ioctl+0x114/0x201
[64561.024590]  ? amdgpu_gem_force_release+0x10b/0x10b
[64561.024592]  drm_ioctl_kernel+0xde/0x137
[64561.024594]  ? freezable_schedule+0x16/0x4c
[64561.024596]  drm_ioctl+0x21c/0x30f
[64561.024597]  ? amdgpu_gem_force_release+0x10b/0x10b
[64561.024599]  ? __rseq_handle_notify_resume+0x253/0x41a
[64561.024601]  amdgpu_drm_ioctl+0x45/0x75
[64561.024602]  vfs_ioctl+0x19/0x2a
[64561.024605]  __do_sys_ioctl+0x51/0x78
[64561.024606]  do_syscall_64+0x73/0x8a
[64561.024609]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[64561.024611] RIP: 0033:0x7fea8ec8696b

I tried upgrading to the 6.0.3 kernel, as well as dropping back to previous kernels. In all cases my X11 server would only stay stable for about a day. I’m not sure if the issue lies with the hardware itself, or if there was an update in Mesa or xorg that caused instability.

Kernel Panic stacktrace from amdgpu Driver/Module
Kernel Panic stacktrace from amdgpu Driver/Module

These instabilities do not appear when using Sway/Wayland. I currently use Sway on my Void Linux laptop, and I used that Sway configuration as a base for trying Sway on my Gentoo desktop again. In the past, Wayland has required a significant amount of work and retooling. Although it works fairly well on my laptop, I found some issues when attempting to use it as my daily driver on a 4k/HiDPI monitor.

Scaling

Scaling for X11/XWayland apps looks like garbage. Anything that does not support Wayland natively will have terrible scaling on 4k screens. Electron apps such as Element (a Matrix client) and FreeTube must be started with the command line parameters --enable-features=UseOzonePlatform --ozone-platform=wayland in order to work natively in Wayland. Older applications, such as the code editor Atom, still use versions of Electron that are too old to work with Wayland correct, leaving them with terribly blurry scaling.

Atom Editor with XWayland blurry scaling
Atom Editor with XWayland blurry scaling

JetBrains editors such as IntelliJ and PyCharm do not have Wayland support. They must be launched using the environment variable _JAVA_AWT_WM_NONREPARENTING=1 in order to display any output, and the scaling still looks terrible.

Screenshot of PyCharm with XWayland blurry scaling

It would be nice if Sway could simply disable any scaling for X11/XWayland applications, allowing them to scale themselves. However, that doesn’t seem possible with Sway1 (although it does seem possible with KDE2). Scaling isn’t the end of the world. However, even though Atom seems usable, IntelliJ and PyCharm have several visual bugs making them difficult to use. Even JetBrain’s newest editor, Fleet, does not appear to have native Wayland support, leading to the same scaling issues.

Replacement Apps

The nice thing about X11 is that the vast majority of applications that are meant to interact with other programs in your session (e.g. screen capture, clipboard management, wallpaper changers, docked status bars, screen lockers) will typically work across a variety of desktop environments and window managers. A developer might encounter a bug in KDE they wouldn’t see in Gnome, but they typically wouldn’t need to implement a tool specifically for KDE and then again for Gnome.

In X11, an X server (such as xorg) starts, and then a window manager handles the environment. In Wayland, there is no X11 and the window manager is also the composer. Many window managers use wlroots. If you have tools written for wlroots, they might work across other wlroots based window managers. In any case, the following is a list of tools I had to replace when moving from i3/X11 to Sway:

  • Conky → Waybar (for status information; entirely different configuration)
  • parcellite → clipman (clipboard manager)
  • quickswitch.py → some random script (quick jump to window by title)
  • flameshot → grim/slurp3 (screenshot tools)

Unresolved Issues

  • The command swaymsg -t get_outputs only shows connected outputs. xrandr shows all outputs and their connection status. I could not find an easy way to do this with Sway.
  • Flameshot claims to support Wayland, but I’ve never had it successfully work on Void Linux or Gentoo. I installed all the required dependencies, followed the guide4 and filed a bug report5. I switch to a combination of grim and slurp3, which does work, but has nowhere near the features.
  • Jetbrains code editors (e.g. IntelliJ, PyCharm, etc.) do not natively support Wayland and require the environment variable _JAVA_AWT_WM_NONREPARENTING=1 to be set in order to not get a blank box67. Even with this setting, there are graphical glitches, and an issue for Wayland support has been open with Jetbrains for over three years8.
  • When scaling is enabled in Sway, X11 applications are scaled in such a way as to make them blurry and pixelated. Sway users have asked to disable scaling just for XWayland applications, however due to the way Sway is designed, such an option cannot be easily implemented19. (Although it does appear to be implemented in KDE Plasma 5.26+2)
  • The system tray does not work well for many legacy/X11 tray apps. Megasync will crash if the system tray is enabled.
  • A number of applications that have dialogs windows correctly appear as floating in i3, but do not float in sway. This includes many native Wayland applications such as the Dolphin file browser and it’s moving/copying dialog windows, or Firefox/Librewolf and the popups from taking a screenshot or other notifications. According to Sway developers, Sway can only identify dialogs if a window is set to non-resizable10. Rules must be manually specified in the Sway configuration files for resizable dialog windows to float.
  • Unplugging the only monitor from a system running Sway will often cause Sway to crash. This makes using a KVM Switch impossible.
  • I could never get the Gnome Keyring to consistently unlock. On rare occasions, dbus would successfully launch the password dialog, but most of the time, programs that depended on unlocking the Gnome Keyring would just hang. I tried every solution I could find111213. Despite being a common problem, there doesn’t seem to be a consistent answer.

Conclusions

I do understand the need for Wayland, and I try to give it a fair shot every once in a while. This recent experience has helped me find some tools and options I can port over to my laptop, but I’m afraid I’m still not ready to use Sway as my daily driver on my high resolution display.

Some of the issues I’ve mentioned may not be present in other Wayland compatible window managers and desktop environments, such as Gnome and KDE. I’ve been an i3 user since 2012, and Sway is a (mostly) i3 compatible replacement. I could try other Wayland composers, but hesitate making an even bigger jump to a different tiling window manager.

Some people tout the benefits of Wayland as having a tear-free graphical experience. However, I’ve always used the option xrandr --output DisplayPort-0 --set TearFree with my amdgpu card and haven’t had any issues with screen tearing.

Sway/Wayland has come a long way. If it wasn’t for a few key applications I didn’t want to replace, I’d probably stick with it. I also attempted to switch to a discrete AMD 580 graphics card.

AMD 580 Video Card
AMD 580 Video Card

However, I started getting the same kernel errors, which leads me to believe this may have been due to a software update in a userspace tools (e.g. Mesa), and not a kernel or hardware issue.

[48783.082802] ------------[ cut here ]------------
[48783.082804] WARNING: CPU: 11 PID: 6238 at drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:7737 amdgpu_dm_atomic_commit_tail+0x1594/0x1c75
[48783.082811] Modules linked in: vboxnetadp(O) vboxnetflt(O) vboxdrv(O)
[48783.082815] CPU: 11 PID: 6238 Comm: X Tainted: G        W  O       6.0.3-gentoo #14
[48783.082817] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./B550M Steel Legend, BIOS P1.80 12/01/2020
[48783.082818] RIP: 0010:amdgpu_dm_atomic_commit_tail+0x1594/0x1c75
[48783.082820] Code: 83 00 00 00 4c 89 e7 e8 24 17 e5 ff 49 8b 04 24 48 8d b8 60 01 00 00 e8 e0 8a 98 00 41 83 bc 24 c8 04 00 00 00 48 89 c6 74 02 <0f> 0b 49 8b 04 24 8b 80 60 01 00 00 85 c0 75 02 0f 0b 49 83 bc 24
[48783.082821] RSP: 0018:ffffc90002e33888 EFLAGS: 00010002
[48783.082822] RAX: 0000000000000286 RBX: ffff88835cddf400 RCX: ffff888104444118
[48783.082823] RDX: 0000000000000001 RSI: 0000000000000286 RDI: ffff8881046a0170
[48783.082824] RBP: ffffc90002e33bb8 R08: 0000000000000005 R09: ffffc90002e337ec
[48783.082825] R10: ffff8883c7440000 R11: 0000000000000000 R12: ffff888104444000
[48783.082825] R13: 0000000000016753 R14: ffff88836ae4e800 R15: ffff8881046a0010
[48783.082826] FS:  00007ff2609638c0(0000) GS:ffff888fee2c0000(0000) knlGS:0000000000000000
[48783.082827] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[48783.082828] CR2: 00007f47b7875000 CR3: 0000000123990000 CR4: 0000000000750ee0
[48783.082829] PKRU: 55555554
[48783.082829] Call Trace:
[48783.082831]  <TASK>
[48783.082833]  ? dce112_validate_bandwidth+0x3a/0x64
[48783.082836]  commit_tail+0x8c/0xda
[48783.082839]  drm_atomic_helper_commit+0xdb/0xf6
[48783.082840]  drm_atomic_commit+0xa4/0xc4
[48783.082842]  ? register_serial_portandirq+0xca/0xca
[48783.082844]  ? register_serial_portandirq+0xca/0xca
[48783.082845]  drm_atomic_helper_set_config+0x50/0x6a
[48783.082847]  drm_mode_setcrtc+0x44c/0x580
[48783.082849]  ? drm_mode_getcrtc+0x13e/0x13e
[48783.082850]  drm_ioctl_kernel+0xde/0x137
[48783.082852]  drm_ioctl+0x21c/0x30f
[48783.082854]  ? drm_mode_getcrtc+0x13e/0x13e
[48783.082855]  amdgpu_drm_ioctl+0x45/0x75
[48783.082857]  vfs_ioctl+0x19/0x2a
[48783.082860]  __do_sys_ioctl+0x51/0x78
[48783.082861]  do_syscall_64+0x73/0x8a
[48783.082863]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[48783.082865] RIP: 0033:0x7ff260ec196b
[48783.082866] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 77 1b 48 8b 44 24 18 64 48 2b 04 25 28 00
[48783.082867] RSP: 002b:00007ffd0158e630 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[48783.082868] RAX: ffffffffffffffda RBX: 00007ffd0158e6c0 RCX: 00007ff260ec196b
[48783.082869] RDX: 00007ffd0158e6c0 RSI: 00000000c06864a2 RDI: 000000000000000c
[48783.082870] RBP: 00000000c06864a2 R08: 0000000000000000 R09: 000055c3f07e9880
[48783.082870] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
[48783.082871] R13: 000000000000000c R14: 000055c3eecdab40 R15: 000055c3eee6e2e0
[48783.082872]  </TASK>
[48783.082872] ---[ end trace 0000000000000000 ]---
[48783.082875] ------------[ cut here ]------------

So for now, I’ve picked up a used nVidia 970 video card, and hopefully I’ll have better luck keeping it stable in X11. I hope the next time I make the jump to Sway/Wayland, enough of these issues will be addressed and solved that I won’t feel the need to switch back. The open source developers on these projects are working hard, many in their spare time, to make software other developers enjoy using. It’s good to give them a shot every once in a while, to see what kind of progress has been made. However, even after all these years, it still seems like Sway requires a lot of additional work and compromises, in order to be a functional i3 replacement.

nVidia 970 Video Card
nVidia 970 Video Card
  1. Disable scaling of xwayland applications #5917. 28 December 2020. Hubro. Github.  2

  2. For KDE users: Plasma 5.26 was released recently and got a new option to allow applications to scale themselves instead of Wayland system scaling….. 2 November 2022. Bukhonov. YouTrack/Jetbrains.  2

  3. Screen capture - ArchWiki : Wayland. ArchWiki. Retrieved 9 November 2022.  2

  4. flameshot/Sway and wlroot support.md at master - flameshot-org/flameshot. 24 August 2021. Flameshot. Github. 

  5. Flameshot on sway exists with “Screenshot aborted” using latest edd228b9 and Gentoo package . 28 October 2022. sumdog. Github. 

  6. IntelliJ Idea show weird blank screen Issue #595. 22 April 2016. Sway. Github. 

  7. Editor only showing blank screen - IDEs Support. 22 August 2018. Gary. JetBrains. 

  8. Native Wayland support - JBR-3206. 1 December 0219. Bayer. YouTrack/Jetbrains. 

  9. HiDPI support: add option to only scale Wayland-native programs #2966. 24 October 2018. RuiAlias. Github. 

  10. Displaying pop-ups as floating windows. #3095. 9 November 2018. fredefox. Github. Retrieved 26 November 2022. 

  11. SOLVED gnome-keyring no keychain for Login, DBus-issue, sway, ly. 10 Jan 2022. flyinghelix. ArchLinux Forums. 

  12. Does gnome-keyring work for you?. 1 February 2022. u/eterps r/swaywm. Reddit. 

  13. GNOME-Keyring integration. 29 December 2020. u/fourstepper. r/swaywm. Reddit