Fedora+Sway+NVidia card: reboots frequently

I have used Fedora + Sway for years on an old laptop with no significant problems. So on a new laptop, I have installed Fedora 39 Sway Spin. And I have a big problem now. The Sway is restarting frequently. journalctl says that sway fails with core dump with error messages like

May 01 12:50:05 andrew-hp sway[174944]: sway: …/nouveau/pushbuf.c:730: nouveau_pushbuf_data: Assertion `kref’ failed.

So, as I understand, there is a problem with the interaction between sway and nouveau drivers.
Upgrade to Fedora 40 does not solve a problem. Disabling Nouveau drivers fixes the problem, but, unfortunately, my big external monitor is not detected anymore and I need to work on the laptop screen only.
So I have two questions:

  1. How to make sway work properly with nouveau drivers?
  2. How to detect an external monitor without nouveau drivers?

There is my system description by inxi:

System:
Kernel: 6.8.7-300.fc40.x86_64 arch: x86_64 bits: 64 compiler: gcc
v: 2.41-34.fc40
Desktop: Sway v: 1.9 dm: SDDM Distro: Fedora Linux 40 (Sway)
Machine:
Type: Laptop System: HP product: HP ZBook Fury 16 G10 Mobile Workstation PC
v: N/A serial: Chassis: type: 10
serial:
Mobo: HP model: 8B92 v: KBC Version 55.24.00 serial:
part-nu: 7B632AV UEFI: HP v: 96 Ver. 01.02.03 date: 09/12/2023
Battery:
ID-1: BAT0 charge: 75.8 Wh (99.7%) condition: 76.0/95.0 Wh (80.0%)
volts: 16.7 min: 15.4 model: Hewlett-Packard Primary serial:
status: not charging
CPU:
Info: 24-core (8-mt/16-st) model: 13th Gen Intel Core i9-13950HX bits: 64
type: MST AMCP arch: Raptor Lake rev: 1 cache: L1: 2.1 MiB L2: 32 MiB
L3: 36 MiB
Speed (MHz): avg: 800 high: 804 min/max: 800/5300:5500:4000 cores: 1: 804
2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800
12: 800 13: 800 14: 800 15: 800 16: 800 17: 800 18: 800 19: 800 20: 800
21: 800 22: 800 23: 800 24: 800 25: 800 26: 800 27: 800 28: 800 29: 800
30: 800 31: 800 32: 800 bogomips: 154828
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
Device-1: Intel Raptor Lake-S UHD Graphics vendor: Hewlett-Packard
driver: i915 v: kernel arch: Gen-13 ports: active: eDP-1 empty: DP-1, DP-2,
DP-3, HDMI-A-1, HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:a788
Device-2: NVIDIA GA107GLM [RTX A1000 6GB Laptop GPU]
vendor: Hewlett-Packard driver: N/A arch: Ampere pcie: speed: 16 GT/s
lanes: 8 bus-ID: 01:00.0 chip-ID: 10de:25bc
Device-3: Cheng Uei Precision Industry (Foxlink) HP 5MP Camera
driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 bus-ID: 1-8:5
chip-ID: 05c8:082f
Display: wayland server: Xwayland v: 23.2.6 compositor: Sway v: 1.9
driver: gpu: i915 display-ID: 1
Monitor-1: eDP-1 model: AU Optronics 0xab9b res: 1920x1200 dpi: 142
diag: 406mm (16")
API: OpenGL v: 4.6 vendor: intel mesa v: 24.0.6 glx-v: 1.4 es-v: 3.2
direct-render: yes renderer: Mesa Intel Graphics (RPL-S)
device-ID: 8086:a788
API: EGL Message: EGL data requires eglinfo. Check --recommends.
Audio:
Device-1: Intel Raptor Lake High Definition Audio vendor: Hewlett-Packard
driver: sof-audio-pci-intel-tgl bus-ID: 00:1f.3 chip-ID: 8086:7a50
Device-2: NVIDIA vendor: Hewlett-Packard driver: snd_hda_intel v: kernel
pcie: speed: 16 GT/s lanes: 8 bus-ID: 01:00.1 chip-ID: 10de:2291
API: ALSA v: k6.8.7-300.fc40.x86_64 status: kernel-api
Server-1: JACK v: 1.9.22 status: off
Server-2: PipeWire v: 1.0.5 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
Network:
Device-1: Intel Raptor Lake-S PCH CNVi WiFi driver: iwlwifi v: kernel
bus-ID: 00:14.3 chip-ID: 8086:7a70
IF: wlp0s20f3 state: up mac:
Device-2: Intel vendor: Hewlett-Packard driver: e1000e v: kernel port: N/A
bus-ID: 00:1f.6 chip-ID: 8086:0dc7
IF: eno1 state: down mac:
Device-3: Realtek RTL8153 Gigabit Ethernet Adapter driver: r8152 type: USB
rev: 2.1 speed: 480 Mb/s lanes: 1 bus-ID: 1-6.3.3:13 chip-ID: 0bda:8153
IF: enp0s20f0u6u3u3 state: down mac:
IF-ID-1: docker0 state: down mac:
IF-ID-2: tap0 state: unknown speed: 10000 Mbps duplex: full mac:
Bluetooth:
Device-1: Intel AX211 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
speed: 12 Mb/s lanes: 1 bus-ID: 1-14:8 chip-ID: 8087:0033
Report: btmgmt ID: hci0 rfk-id: 0 state: down bt-service: enabled,running
rfk-block: hardware: no software: yes address: bt-v: 5.3 lmp-v: 12
Drives:
Local Storage: total: 1.22 TiB used: 518.99 GiB (41.5%)
ID-1: /dev/nvme0n1 vendor: KIOXIA model: N/A size: 953.87 GiB
speed: 63.2 Gb/s lanes: 4 serial: temp: 31.9 C
ID-2: /dev/nvme1n1 vendor: Patriot model: M.2 P300 256GB size: 238.47 GiB
speed: 31.6 Gb/s lanes: 4 serial: temp: 30.9 C
ID-3: /dev/sda model: N/A size: 58.59 GiB type: USB rev: 2.0 spd: 480 Mb/s
lanes: 1 serial:
Partition:
ID-1: / size: 942.52 GiB used: 497.39 GiB (52.8%) fs: btrfs
dev: /dev/nvme0n1p3
ID-2: /boot size: 973.4 MiB used: 474.2 MiB (48.7%) fs: ext4
dev: /dev/nvme0n1p2
ID-3: /boot/efi size: 598.8 MiB used: 19 MiB (3.2%) fs: vfat
dev: /dev/nvme0n1p1
ID-4: /home size: 942.52 GiB used: 497.39 GiB (52.8%) fs: btrfs
dev: /dev/nvme0n1p3
Swap:
ID-1: swap-1 type: zram size: 8 GiB used: 0 KiB (0.0%) priority: 100
dev: /dev/zram0
Sensors:
System Temperatures: cpu: 45.0 C mobo: N/A
Fan Speeds (rpm): N/A
Info:
Memory: total: 32 GiB note: est. available: 30.52 GiB used: 3.89 GiB (12.8%)
Processes: 540 Power: uptime: 56m wakeups: 0 Init: systemd v: 255
target: graphical (5) default: graphical
Packages: pm: flatpak pkgs: 18 Compilers: clang: 18.1.1 gcc: 14.0.1
Shell: fish v: 3.7.0 running-in: foot inxi: 3.3.34

your GPU is Ampere architecture, which don’t have a great support in nouveau: FeatureMatrix · freedesktop.org (see NV170)

I recommend switching to the nvidia proprietary driver unfortunately.
Ublue images are a great and simple way to have everything properly setup for nvidia : Package sericea-nvidia · GitHub