Bug 478700

Summary: kwin_wayland + NVIDIA modesetting - Atomic commits failed (and crash)
Product: [Plasma] kwin Reporter: thibaulltt <thibaulltt>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: nate, stephane.treboux, ua_bugz_kde, xaver.hugl
Priority: NOR    
Version First Reported In: 5.27.9   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=478865
Latest Commit: Version Fixed/Implemented In: 6.0.1
Sentry Crash Report:

Description thibaulltt 2023-12-18 21:02:04 UTC
SUMMARY
When using ``kwin_wayland`` along with NVIDIA modesetting and a powered on AV HDMI Receiver with the target display turned off, the kwin_wayland session becomes laggy and grinds to a halt, and sometimes even crashes. A full backtrace will be provided in the first comment under this bug report.

My computer has a NVIDIA 2080 Super, and it's connected to two powered video outputs, and an unpowered one:
- powered: an ASUS VG27AQ monitor. Connected using DisplayPort.
- powered (kinda): a DENON HDMI AV Receiver, plugged using HDMI. The receiver is then in turn connected to my TV via HDMI.
- unpowered: a Valve Index cable without the headset plugged in. Connected via DisplayPort.

The system functions as intended on Windows : turning on and off the receiver repeatedly does not incur any issues. However on Arch Linux with the latest-ish KDE Plasma session and KDE Frameworks, whenever the receiver is connected, two outputs are recognized: one named "DENON, Ltd. DENON-AVR" with the options to use 4k@60Hz, 2160p@60Hz, 1080p@120Hz or below (60Hz maximum). And another one with only 1440p@60Hz (???) with the name "Unknown 1". Whenever this output is enabled, the problem happens.

STEPS TO REPRODUCE
1. Enable your system to use the NVIDIA modesetting driver
2. Have a HDMI receiver plugged in and turned on, but the target display turned off.
3. Start the Plasma session under Wayland with NVIDIA modesetting enabled

OBSERVED RESULT
The system experiences horrible lag and slowdowns (the FPS plasma applet says 9FPS, but I suspect it's even lower than that) with 1+ second of delay to my inputs, and the journal is filled with error messages of one of three kinds, each one reported below:

```
kwin_wayland[PID]: kwin_wayland_drm: Atomic commit failed! Cannot allocate memory
kwin_wayland[PID]: kwin_wayland_drm: Presentation failed! Cannot allocate memory
kernel: [drm:__nv_drm_gem_nvkms_map [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00002d00] Failed to map NvKmsKapiMemory <address>
```

EXPECTED RESULT
It should work as intended: a.k.a. not induce this kind of lag/unresponsiveness.

SOFTWARE/OS VERSIONS (copied from Settings > "About this system")

Operating System: Arch Linux 
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.112.0
Qt Version: 5.15.11
Kernel Version: 6.6.3-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 2080 SUPER/PCIe/SSE2
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C37
System Version: 1.0

ADDITIONAL INFORMATION

It seems the first launch of kwin_wayland (before crashing) expects some extensions from the EGL context that cannot be provided. See :

```
kwin_wayland_wrapper[PID]: No provider of eglCreateImageKHR found.  Requires one of:
kwin_wayland_wrapper[PID]:     EGL_KHR_image
kwin_wayland_wrapper[PID]:     EGL_KHR_image_base
```

This may be connected to the crash, or not...
Comment 1 thibaulltt 2023-12-18 21:03:50 UTC
Here is the full backtrace (well. as full as I could make it) of the last kwin crash that happened while writing this bug report:

```
Thread 7 (Thread 0x7f8b04ad66c0 (LWP 1128)):
#0  0x00007f8b35dba4ae in __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x7f8b04ad5c20, op=137, expected=0, futex_word=0x562c2915a3d0) at futex-internal.c:57
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
        err = <optimized out>
        clockbit = 0
        op = 137
#1  __futex_abstimed_wait_common (futex_word=futex_word@entry=0x562c2915a3d0, expected=expected@entry=0, clockid=clockid@entry=1, abstime=abstime@entry=0x7f8b04ad5c20, private=private@entry=0, cancel=cancel@entry=true) at futex-internal.c:87
        err = <optimized out>
        clockbit = 0
        op = 137
#2  0x00007f8b35dba52f in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x562c2915a3d0, expected=expected@entry=0, clockid=clockid@entry=1, abstime=abstime@entry=0x7f8b04ad5c20, private=private@entry=0) at futex-internal.c:139
#3  0x00007f8b35dbd055 in __pthread_cond_wait_common (abstime=0x7f8b04ad5c20, clockid=1, mutex=0x562c2915a380, cond=0x562c2915a3a8) at pthread_cond_wait.c:503
        spin = 0
        buffer = {__routine = 0x7f8b35dbcab0 <__condvar_cleanup_waiting>, __arg = 0x7f8b04ad5b90, __canceltype = 919528192, __prev = 0x0}
        cbuffer = {wseq = 0, cond = 0x562c2915a3a8, mutex = 0x562c2915a380, private = 0}
        err = <optimized out>
        g = 0
        flags = <optimized out>
        g1_start = <optimized out>
        maxspin = 0
        signals = <optimized out>
        result = 0
        wseq = 0
        seq = 0
        private = 0
        flags = <optimized out>
        clockid = 1
#4  ___pthread_cond_timedwait64 (cond=0x562c2915a3a8, mutex=0x562c2915a380, abstime=0x7f8b04ad5c20) at pthread_cond_wait.c:643
        flags = <optimized out>
        clockid = 1
#5  0x00007f8b36cfb434 in QWaitCondition::wait(QMutex*, QDeadlineTimer) () at /usr/lib/libQt5Core.so.5
#6  0x00007f8b36cf856a in  () at /usr/lib/libQt5Core.so.5
#7  0x00007f8b36cf371a in  () at /usr/lib/libQt5Core.so.5
#8  0x00007f8b35dbd9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140235880781584, 6660325875311194616, -264, 2, 140726386999584, 140235047264256, -6667523985975791112, -6667490532251389448}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#9  0x00007f8b35e417cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Thread 6 (Thread 0x7f8b30fff6c0 (LWP 1080)):
#0  0x00007f8b35e33f6f in __GI___poll (fds=0x7f8b2c0015c0, nfds=3, timeout=22069) at ../sysdeps/unix/sysv/linux/poll.c:29
        sc_ret = 1
        sc_cancel_oldtype = 0
#1  0x00007f8b3476c276 in  () at /usr/lib/libglib-2.0.so.0
#2  0x00007f8b3470c162 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#3  0x00007f8b36eeaf7c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#4  0x00007f8b36e9ae74 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#5  0x00007f8b36cf74f6 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#6  0x00007f8b38c6ea9a in QDBusConnectionManager::run() (this=0x7f8b38cd6660 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at /usr/src/debug/qt5-base/qtbase/src/dbus/qdbusconnection.cpp:179
#7  0x00007f8b36cf371a in  () at /usr/lib/libQt5Core.so.5
#8  0x00007f8b35dbd9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140235880781584, 6660325875311194616, -264, 2, 140726386999808, 140235790872576, -6667479297377947144, -6667490532251389448}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#9  0x00007f8b35e417cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Thread 5 (Thread 0x7f8b0d1406c0 (LWP 1125)):
#0  0x00007f8b35e33f6f in __GI___poll (fds=0x7f8b000013d0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
        sc_ret = -516
        sc_cancel_oldtype = 0
#1  0x00007f8b3476c276 in  () at /usr/lib/libglib-2.0.so.0
#2  0x00007f8b3470c162 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#3  0x00007f8b36eeaf7c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#4  0x00007f8b36e9ae74 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#5  0x00007f8b36cf74f6 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#6  0x00007f8b37cc5880 in QQmlThreadPrivate::run() (this=0x562c28f6eb00) at /usr/src/debug/qt5-declarative/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:155
#7  0x00007f8b36cf371a in  () at /usr/lib/libQt5Core.so.5
#8  0x00007f8b35dbd9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140235880781584, 6660325875311194616, -264, 22, 140726386998896, 140235188207616, -6667542691632107016, -6667490532251389448}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#9  0x00007f8b35e417cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Thread 4 (Thread 0x7f8b2bbff6c0 (LWP 1105)):
#0  0x00007f8b35e33f6f in __GI___poll (fds=0x7f8b180013f0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
        sc_ret = -516
        sc_cancel_oldtype = 0
#1  0x00007f8b3476c276 in  () at /usr/lib/libglib-2.0.so.0
#2  0x00007f8b3470c162 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#3  0x00007f8b36eeaf7c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#4  0x00007f8b36e9ae74 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#5  0x00007f8b36cf74f6 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#6  0x00007f8b36cf371a in  () at /usr/lib/libQt5Core.so.5
#7  0x00007f8b35dbd9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140235880781584, 6660325875311194616, -264, 2, 140726387000576, 140235702792192, -6667460055924461064, -6667490532251389448}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#8  0x00007f8b35e417cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Thread 3 (Thread 0x7f8b149ff6c0 (LWP 1121)):
#0  0x00007f8b35e33f6f in __GI___poll (fds=0x7f8b080013d0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
        sc_ret = -516
        sc_cancel_oldtype = 0
#1  0x00007f8b3476c276 in  () at /usr/lib/libglib-2.0.so.0
#2  0x00007f8b3470c162 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#3  0x00007f8b36eeaf7c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#4  0x00007f8b36e9ae74 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#5  0x00007f8b36cf74f6 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#6  0x00007f8b37cc5880 in QQmlThreadPrivate::run() (this=0x562c28ecd970) at /usr/src/debug/qt5-declarative/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:155
#7  0x00007f8b36cf371a in  () at /usr/lib/libQt5Core.so.5
#8  0x00007f8b35dbd9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140235880781584, 6660325875311194616, -264, 22, 140726386998640, 140235314819072, -6667559286848867848, -6667490532251389448}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#9  0x00007f8b35e417cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Thread 2 (Thread 0x7f8b155ff6c0 (LWP 1120)):
#0  0x00007f8b35dba4ae in __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x7f8b155fec20, op=137, expected=0, futex_word=0x562c28dffc90) at futex-internal.c:57
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
        err = <optimized out>
        clockbit = 0
        op = 137
#1  __futex_abstimed_wait_common (futex_word=futex_word@entry=0x562c28dffc90, expected=expected@entry=0, clockid=clockid@entry=1, abstime=abstime@entry=0x7f8b155fec20, private=private@entry=0, cancel=cancel@entry=true) at futex-internal.c:87
        err = <optimized out>
        clockbit = 0
        op = 137
#2  0x00007f8b35dba52f in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x562c28dffc90, expected=expected@entry=0, clockid=clockid@entry=1, abstime=abstime@entry=0x7f8b155fec20, private=private@entry=0) at futex-internal.c:139
#3  0x00007f8b35dbd055 in __pthread_cond_wait_common (abstime=0x7f8b155fec20, clockid=1, mutex=0x562c28dffc40, cond=0x562c28dffc68) at pthread_cond_wait.c:503
        spin = 0
        buffer = {__routine = 0x7f8b35dbcab0 <__condvar_cleanup_waiting>, __arg = 0x7f8b155feb90, __canceltype = 0, __prev = 0x0}
        cbuffer = {wseq = 4, cond = 0x562c28dffc68, mutex = 0x562c28dffc40, private = 0}
        err = <optimized out>
        g = 0
        flags = <optimized out>
        g1_start = <optimized out>
        maxspin = 0
        signals = <optimized out>
        result = 0
        wseq = 4
        seq = 2
        private = 0
        flags = <optimized out>
        clockid = 1
#4  ___pthread_cond_timedwait64 (cond=0x562c28dffc68, mutex=0x562c28dffc40, abstime=0x7f8b155fec20) at pthread_cond_wait.c:643
        flags = <optimized out>
        clockid = 1
#5  0x00007f8b36cfb434 in QWaitCondition::wait(QMutex*, QDeadlineTimer) () at /usr/lib/libQt5Core.so.5
#6  0x00007f8b36cf856a in  () at /usr/lib/libQt5Core.so.5
#7  0x00007f8b36cf371a in  () at /usr/lib/libQt5Core.so.5
#8  0x00007f8b35dbd9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140235880781584, 6660325875311194616, -264, 22, 140726386998928, 140235327401984, -6667559836604681736, -6667490532251389448}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#9  0x00007f8b35e417cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Thread 1 (Thread 0x7f8b313158c0 (LWP 1063)):
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
        tid = <optimized out>
        ret = 0
        pd = <optimized out>
        old_mask = {__val = {140235915833568}}
        ret = <optimized out>
#1  0x00007f8b35dbf8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007f8b35d6f668 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
        ret = <optimized out>
#3  0x00007f8b35d574b8 in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x20, sa_sigaction = 0x20}, sa_mask = {__val = {0, 0, 140235915834213, 0, 1, 0, 0, 5, 216172782113786368, 140235915834213, 5601757287903862016, 140235915834836, 94747663097344, 140235915834213, 18, 140235915834836}}, sa_flags = 1, sa_restorer = 0x7f8b37f2b365}
#4  0x00007f8b37f04fee in egl_provider_resolver (name=name@entry=0x7f8b37f2b9ce <entrypoint_strings+430> "eglCreateImageKHR", providers=providers@entry=0x7f8b37f2b7f0 <providers.33.lto_priv>, entrypoints=entrypoints@entry=0x7f8b37f2b7e8 <entrypoints.32.lto_priv>) at src/egl_generated_dispatch.c:3911
        i = <optimized out>
#5  0x00007f8b37f087ab in epoxy_eglCreateImageKHR_resolver () at src/egl_generated_dispatch.c:4078
#6  epoxy_eglCreateImageKHR_global_rewrite_ptr (dpy=0x562c28cd6760, ctx=0x0, target=12912, buffer=0x0, attrib_list=0x7f8b2c0177f8) at src/egl_generated_dispatch.c:5037
#7  0x00007f8b38a35271 in KWin::AbstractEglBackend::importDmaBufAsImage(KWin::DmaBufAttributes const&) const () at /usr/lib/libkwin.so.5
#8  0x00007f8b38a36287 in KWin::EglDmabuf::importBuffer(KWin::DmaBufAttributes&&, unsigned int) () at /usr/lib/libkwin.so.5
#9  0x00007f8b389d5217 in  () at /usr/lib/libkwin.so.5
#10 0x00007f8b342184f6 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#11 0x00007f8b34214f5e in ffi_call_int (cif=cif@entry=0x7ffd6a4ebfe0, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=closure@entry=0x0) at ../src/x86/ffi64.c:673
        classes = {X86_64_INTEGERSI_CLASS, 32765, 874591932, 32651}
        stack = <optimized out>
        argp = 0x7ffd6a4ebe34 ""
        arg_types = <optimized out>
        gprcount = 6
        ssecount = <optimized out>
        ngpr = 1
        nsse = 0
        i = <optimized out>
        avn = <optimized out>
        flags = <optimized out>
        reg_args = <optimized out>
#12 0x00007f8b34217b73 in ffi_call (cif=cif@entry=0x7ffd6a4ebfe0, fn=<optimized out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7ffd6a4ec0b0) at ../src/x86/ffi64.c:710
        arg_types = 0x7ffd6a4ec000
        i = <optimized out>
        nargs = 7
        max_reg_struct_size = <optimized out>
#13 0x00007f8b357faada in wl_closure_invoke (closure=closure@entry=0x562c2b72abf0, target=<optimized out>, target@entry=0x562c2b7da020, opcode=opcode@entry=3, data=<optimized out>, data@entry=0x562c29075e40, flags=2) at ../wayland-1.22.0/src/connection.c:1025
        count = <optimized out>
        cif = {abi = FFI_UNIX64, nargs = 7, arg_types = 0x7ffd6a4ec000, rtype = 0x7f8b342191a0 <ffi_type_void>, bytes = 8, flags = 0}
        ffi_types = {0x7f8b342192a0 <ffi_type_pointer>, 0x7f8b342192a0 <ffi_type_pointer>, 0x7f8b34219240 <ffi_type_uint32>, 0x7f8b34219330 <ffi_type_sint32>, 0x7f8b34219330 <ffi_type_sint32>, 0x7f8b34219240 <ffi_type_uint32>, 0x7f8b34219240 <ffi_type_uint32>, 0x7f8b34219240 <ffi_type_uint32>, 0x200000003, 0x4, 0x7ffd6a4ec100, 0x562c2b7d8a70, 0x7f8b2c003fc0, 0x7ffd6a4ec2e0, 0x562c2b7d8a50, 0x7f8b36ecc615, 0x562c289e72c0, 0x538cbaa13, 0x7f8b37136f00, 0x4, 0x562c2b7e4da0, 0x0}
        ffi_args = {0x7ffd6a4ebfc0, 0x7ffd6a4ebfc8, 0x562c2b72ac08, 0x562c2b72ac10, 0x562c2b72ac18, 0x562c2b72ac20, 0x562c2b72ac28, 0x562c2b74b970, 0x7f8b35f09ac0 <main_arena>, 0x7f8b357fc531 <log_closure+81>, 0x562c2b7e5f40, 0x562c28a19ae0, 0x7f8b35f09ac0 <main_arena>, 0x5, 0x7f8b38bc0f98, 0x7f8b35dced08 <__libc_calloc+216>, 0x8, 0x7f8b35dcbb29 <_int_free+697>, 0x7f8b38b01f8c, 0x7f8b38bc0fc8, 0x0, 0x64}
        implementation = <optimized out>
#14 0x00007f8b357ff180 in wl_client_connection_data (fd=<optimized out>, mask=<optimized out>, data=<optimized out>) at ../wayland-1.22.0/src/wayland-server.c:438
        client = <optimized out>
        connection = <optimized out>
        resource = 0x562c2b7da020
        object = 0x562c2b7da020
        closure = <optimized out>
        message = 0x7f8b38bc0fc8
        p = {43, 1835011}
        resource_flags = 0
        opcode = 3
        size = <optimized out>
        since = <optimized out>
        len = <optimized out>
#15 0x00007f8b357fdae2 in wl_event_loop_dispatch (loop=0x562c28a19bd0, timeout=<optimized out>) at ../wayland-1.22.0/src/event-loop.c:1027
        ep = {{events = 1, data = {ptr = 0x562c29074190, fd = 688341392, u32 = 688341392, u64 = 94747666891152}}, {events = 1, data = {ptr = 0x562c2b72c4d0, fd = 728941776, u32 = 728941776, u64 = 94747707491536}}, {events = 1, data = {ptr = 0x562c29075f20, fd = 688348960, u32 = 688348960, u64 = 94747666898720}}, {events = 0, data = {ptr = 0x7f8b2c001620, fd = 738203168, u32 = 738203168, u64 = 140235715384864}}, {events = 729658304, data = {ptr = 0x2c0082600000562c, fd = 22060, u32 = 22060, u64 = 3170677486497322540}}, {events = 32651, data = {ptr = 0x11, fd = 17, u32 = 17, u64 = 17}}, {events = 4017560832, data = {ptr = 0xa4dbd7092, fd = 1304260754, u32 = 1304260754, u64 = 44253933714}}, {events = 4, data = {ptr = 0x7ffd6a4ec410, fd = 1783546896, u32 = 1783546896, u64 = 140726387000336}}, {events = 727302768, data = {ptr = 0x2b7d85f00000562c, fd = 22060, u32 = 22060, u64 = 3133808181558400556}}, {events = 22060, data = {ptr = 0x562c2b7013c0, fd = 728765376, u32 = 728765376, u64 = 94747707315136}}, {events = 738257904, data = {ptr = 0x6a4ec4f800007f8b, fd = 32651, u32 = 32651, u64 = 7660276585634758539}}, {events = 32765, data = {ptr = 0x43d, fd = 1085, u32 = 1085, u64 = 1085}}, {events = 25, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x8, fd = 8, u32 = 8, u64 = 8}}, {events = 919578228, data = {ptr = 0xfffffef800007f8b, fd = 32651, u32 = 32651, u64 = 18446742939838218123}}, {events = 4294967295, data = {ptr = 0xc, fd = 12, u32 = 12, u64 = 12}}, {events = 1783547168, data = {ptr = 0x35dce35300007ffd, fd = 32765, u32 = 32765, u64 = 3881226924508348413}}, {events = 32651, data = {ptr = 0xf0, fd = 240, u32 = 240, u64 = 240}}, {events = 1783547168, data = {ptr = 0x2c00826000007ffd, fd = 32765, u32 = 32765, u64 = 3170677486497333245}}, {events = 32651, data = {ptr = 0x7ffd6a4ec4f8, fd = 1783547128, u32 = 1783547128, u64 = 140726387000568}}, {events = 240, data = {ptr = 0x38c8542b00000000, fd = 0, u32 = 0, u64 = 4091612805126422528}}, {events = 32651, data = {ptr = 0xd, fd = 13, u32 = 13, u64 = 13}}, {events = 1783547136, data = {ptr = 0x385c507e00007ffd, fd = 32765, u32 = 32765, u64 = 4061209466077478909}}, {events = 32651, data = {ptr = 0x7f8b38c9a701 <qDBusCheckAsyncTag(char const*)+81>, fd = 952739585, u32 = 952739585, u64 = 140235929921281}}, {events = 1783547120, data = {ptr = 0x2c00162000007ffd, fd = 32765, u32 = 32765, u64 = 3170558464363626493}}, {events = 32651, data = {ptr = 0x7f8b385cb300 <KGlobalAccelD::staticMetaObject>, fd = 945599232, u32 = 945599232, u64 = 140235922780928}}, {events = 14, data = {ptr = 0x2c00fc3000000000, fd = 0, u32 = 0, u64 = 3170811420757458944}}, {events = 32651, data = {ptr = 0x7f8b2c014e30, fd = 738283056, u32 = 738283056, u64 = 140235715464752}}, {events = 687834352, data = {ptr = 0x35dce3530000562c, fd = 22060, u32 = 22060, u64 = 3881226924508337708}}, {events = 32651, data = {ptr = 0xd, fd = 13, u32 = 13, u64 = 13}}, {events = 1783547200, data = {ptr = 0x28ff84f000007ffd, fd = 32765, u32 = 32765, u64 = 2954226046905384957}}, {events = 22060, data = {ptr = 0x7f8b0000043d, fd = 1085, u32 = 1085, u64 = 140234977182781}}}
        source = <optimized out>
        i = 2
        count = <optimized out>
        has_timers = <optimized out>
#16 0x00007f8b389c5c87 in KWaylandServer::Display::dispatchEvents() () at /usr/lib/libkwin.so.5
#17 0x00007f8b36ed1097 in  () at /usr/lib/libQt5Core.so.5
#18 0x00007f8b36ed2894 in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#19 0x00007f8b36ed29d8 in QSocketNotifier::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#20 0x00007f8b365788ff in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#21 0x00007f8b36e9c168 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#22 0x00007f8b36ee9b3c in QEventDispatcherUNIXPrivate::activateSocketNotifiers() () at /usr/lib/libQt5Core.so.5
#23 0x00007f8b36eead09 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#24 0x0000562c27065ce2 in  ()
#25 0x00007f8b36e9ae74 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#26 0x00007f8b36e9c313 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#27 0x0000562c26f8140b in  ()
#28 0x00007f8b35d58cd0 in __libc_start_call_main (main=main@entry=0x562c26f7fda0, argc=argc@entry=14, argv=argv@entry=0x7ffd6a4ece58) at ../sysdeps/nptl/libc_start_call_main.h:58
        self = <optimized out>
        result = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140726387002968, 6660325875312505336, 0, 140726387003088, 140235932635136, 94747633841592, -6659434590624271880, -6667490516859604488}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x7ffd6a4ece58, 0xe}, data = {prev = 0x0, cleanup = 0x0, canceltype = 1783549528}}}
        not_first_call = <optimized out>
#29 0x00007f8b35d58d8a in __libc_start_main_impl (main=0x562c26f7fda0, argc=14, argv=0x7ffd6a4ece58, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd6a4ece48) at ../csu/libc-start.c:360
#30 0x0000562c26f83015 in  ()
```
Comment 2 Zamundaaa 2023-12-21 17:14:46 UTC
> kwin_wayland[PID]: kwin_wayland_drm: Atomic commit failed! Cannot allocate memory
> kwin_wayland[PID]: kwin_wayland_drm: Presentation failed! Cannot allocate memory
> kernel: [drm:__nv_drm_gem_nvkms_map [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00002d00] Failed to map NvKmsKapiMemory
That's a NVidia driver bug. Please report it at https://github.com/NVIDIA/open-gpu-kernel-modules/issues

The EGL warnings and crash might be a bug in KWin though.
Comment 3 thibaulltt 2023-12-21 17:22:08 UTC
(In reply to Zamundaaa from comment #2)
> That's a NVidia driver bug. Please report it at
> https://github.com/NVIDIA/open-gpu-kernel-modules/issues

Ah, sorry for the noise then. Since it did not happen on Windows and I'm using the proprietary NVIDIA driver (yes I know, I know) I thought this would only be related to the software stack I'm using on Linux.

I'm going to send them a link to this page, so they can also have access to the backtrace. Does Bugzilla archive/hide closed bugs ?
Comment 4 Zamundaaa 2023-12-21 18:26:50 UTC
> Does Bugzilla archive/hide closed bugs ?
No, but I'd keep this bug open to track the EGL issue anyways, as it's not clear where that comes from yet.
Comment 5 Stéphane Tréboux 2024-04-17 02:29:57 UTC
I am facing the same issue with the beta of Kubuntu 24.04 with all the available updates, KDE 23.08.5, Wayland and the proprietary NVIDIA driver, 545.29.06 and then 550.67 (both versions showing the same issue).

> That's a NVidia driver bug. Please report it at
> https://github.com/NVIDIA/open-gpu-kernel-modules/issues

Is the NVIDIA bug related to this issue https://github.com/NVIDIA/open-gpu-kernel-modules/issues/622?
I don't see the error message "Atomic commit failed" in my logs but this was mentioned by the OP.
Comment 6 Stéphane Tréboux 2024-04-17 02:36:52 UTC
I forgot to mention that I use kwin version 5.27.11, slightly newer than OP.
See https://packages.ubuntu.com/noble/kwin-wayland, the exact version is 4:5.27.11-0ubuntu3.
Comment 7 Zamundaaa 2024-04-17 21:25:36 UTC
thanks for reminding me about this bug. It turns out the egl bit is the same issue as bug 470980, which is fixed in 6.0.1.

> Is the NVIDIA bug related to this issue https://github.com/NVIDIA/open-gpu-kernel-modules/issues/622?
No, KWin only supports that API since Plasma 6, and it's not used on NVidia because of that issue
Comment 8 Stéphane Tréboux 2024-04-17 23:48:38 UTC
> thanks for reminding me about this bug. It turns out the egl bit is the same issue as bug 470980, which is fixed in 6.0.1.

I forgot to mention that this is a regression from kwin 5.27.8 which ships Kubuntu 23.10.
In fact I have been using Wayland with the NVIDIA proprietary driver without major issues  for a year or more now, with Kubuntu 23.04 and Kubuntu 23.10, see https://packages.ubuntu.com/lunar/kwin-wayland and https://packages.ubuntu.com/noble/kwin-wayland.

Is there plan to fix the 5.27.x branch or to revert the recent change which breaks Wayland with the NVIDIA proprietary driver?
That would be great for the distributions which will not update to the 6.x branch.
It would be especially welcomed for Kubuntu 24.04 which is a long term support release and will be around for a long time, although KDE and Plasma are "only" community supported, but this is true for a lot of packages in Ubuntu.
Comment 9 Stéphane Tréboux 2024-04-18 00:54:53 UTC
Sorry, I meant https://packages.ubuntu.com/lunar/kwin-wayland (Ubuntu 23.04) and https://packages.ubuntu.com/mantic/kwin-wayland  (Ubuntu 23.10) were working for me.