Bug 408634

Summary: [Wayland] Nvidia Black Screen
Product: [Plasma] kwin Reporter: Wyatt Childers <kdebugs.81do7>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: afifkamarulimran98, andihartmann, argymeg, bizyaev, kde, kdebugs, makk50, me, miltonh26, mutasik170300, nate, plops-05budgets, proteus5, scott.ashford, tiagomariano, wengxt, xaver.hugl
Priority: NOR Flags: vlad.zahorodnii: NVIDIA+
Version: 5.16.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=426944
https://bugs.kde.org/show_bug.cgi?id=428088
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: text log of text before initial screen rendering
output after initial screen
wayland-session.log
KWin support info when running egl stream
wayland session log

Description Wyatt Childers 2019-06-13 04:51:26 UTC
SUMMARY
I've got an nvidia 2080 running on the nvidia 430 driver. When I attempt to use the recently released kwin 5.16 I still get a black screen. It seems if I run kwin_wayland --xwayland it hangs, then after some time it will render the screen. If it sits long enough, I can enter my password, and login, however, that seems to return to a black screen. 

This behavior occurs with `KWIN_DRM_USE_EGL_STREAMS=2` in the environment, without nvidia-drm.modeset=1 explicitly set in the boot params.

When I try via SDDM, if I have nvidia-drm.modeset=1 set, when I login, I get a mouse cursor, that's frozen and can't move on a black screen. If the nvidia-drm.modeset=1 is not present, I instead get a black screen, normally with an _ in the top right, or some seemingly random message. I'm assuming this is related to tty1's dmesg text.
Comment 1 Wyatt Childers 2019-06-13 04:53:49 UTC
Created attachment 120835 [details]
text log of text before initial screen rendering

This is the output when running kwin_wayland --xwayland before it renders an initial screen.
Comment 2 Wyatt Childers 2019-06-13 04:54:55 UTC
Created attachment 120836 [details]
output after initial screen

This is the output including both the initial output, and the output presented whenever the screen unfreezes, and renders something meaningful. It always begins with "lock called" and ends with "Grab Released".
Comment 3 Wyatt Childers 2019-06-13 05:04:28 UTC
Also just to rule it out, tried creating a completely new user, and seeing if I could reproduce using that user. The behavior was effectively the same with login through SDDM, and presumably though kwin_wayland --xwayland -- I did not wait for it to become responsive, but the initial error set shown in attachment 120835 [details] was the same.
Comment 4 Nate Graham 2019-06-13 20:31:49 UTC
Does anything here help?

https://www.reddit.com/r/kde/comments/bzs8xn/kde_plasma_516_wayland_on_nvidia/
Comment 5 Wyatt Childers 2019-06-14 00:11:09 UTC
(In reply to Nate Graham from comment #4)
> Does anything here help?
> 
> https://www.reddit.com/r/kde/comments/bzs8xn/
> kde_plasma_516_wayland_on_nvidia/

Sadly, no.
Comment 6 Nate Graham 2019-06-26 13:15:37 UTC
*** Bug 409194 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2019-06-30 14:05:40 UTC
*** Bug 409329 has been marked as a duplicate of this bug. ***
Comment 8 marco martinez 2019-09-30 17:36:41 UTC
Created attachment 122957 [details]
wayland-session.log
Comment 9 marco martinez 2019-09-30 17:38:55 UTC
I think I'm facing the same issue. I'm running plasma 5.17 beta and have set the env variable and nvidia modeset. Running on an optimus laptop
Comment 10 Wyatt Childers 2019-12-01 07:18:22 UTC
Full system reinstall later, and a new processor, this still remains an issue. This would suggest it's either the specific GPU, or some more intricate hardware interaction provided this is working for other users on KDE Neon.
Comment 11 Wyatt Childers 2020-06-08 20:38:36 UTC
Confirming I have followed the setup on the wiki per:

https://www.reddit.com/r/kde/comments/gz40tv/david_edmundson_busts_some_myths_of_nvidia_plasma/ftemb2f/

Also worth noting the wiki instructions are not compatible with fish shell -- I swapped back to bash to test, as the /etc/profile.d/kwin.sh script isn't executed with fish as your user shell.
Comment 12 Wyatt Childers 2020-06-08 20:46:01 UTC
Actually I did miss something, the Qt version note. I'm on 5.14.2. This seems to be the latest build available on neon?
Comment 13 David Edmundson 2020-06-08 21:02:42 UTC
The Qt version thing is very important. The bug fixed there matches the symptoms you're seeing. 

I don't know when Neon will upgrade. Potentially I could patch Neon.
Comment 14 scott ashford 2020-06-08 21:33:16 UTC
I am still experiencing a black screen and frozen cursor. This is with meeting all prerequisites mapped out in David's blog post. Granted I am using an optimus laptop. If any specific log files would be helpful please let me know. Thanks.
Comment 15 David Edmundson 2020-06-08 21:56:03 UTC
Optimus potentially makes things interesting.


You can try with exporting KWIN_COMPOSE=Q 

Things will be super slow, but it will be good data point to see what happens.
Comment 16 scott ashford 2020-06-08 22:28:52 UTC
KWIN_COMPOSE=Q does not appear to have an effect. I still get the black screen + frozen cursor.
Comment 17 Weng Xuetian 2020-06-09 17:26:38 UTC
I'm running archlinux with a intel+nvidia system and with KWIN_DRM_USE_EGL_STREAMS=1 I will also get a cursor in the middle of black screen.

Without KWIN_DRM_USE_EGL_STREAMS being set, I can log into the wayland session without any problem (not so sure what's using). gdb attach to kwin doesn't seems to have a deadlock or sth.

My Qt was already 5.15.0 and Plasma just updated to 5.19.0.
Comment 18 Weng Xuetian 2020-06-09 17:45:15 UTC
Created attachment 129164 [details]
KWin support info when running egl stream

And actually only the graphics freezes. Things like keyboard input doesn't seem to have a problem. I tried to blindly use krunner to start kwrite via keyboard and kwrite does start.
Comment 19 proteus5 2020-07-23 06:46:18 UTC
Any news about this issue?
Comment 20 Afif 2020-08-01 09:15:03 UTC
(In reply to Weng Xuetian from comment #17)
> I'm running archlinux with a intel+nvidia system and with
> KWIN_DRM_USE_EGL_STREAMS=1 I will also get a cursor in the middle of black
> screen.
> 
> Without KWIN_DRM_USE_EGL_STREAMS being set, I can log into the wayland
> session without any problem (not so sure what's using). gdb attach to kwin
> doesn't seems to have a deadlock or sth.
> 
> My Qt was already 5.15.0 and Plasma just updated to 5.19.0.

Hardware:
- CPU: Intel i7-6700HQ
- GPU: NVIDIA GeForce GTX 950M

Software:
- KDE Plasma Version: 5.19.4
- KDE Frameworks Version: 5.72.0
- Qt Version: 5.15.0
- Kernel Version: 5.8.0-1-MANJARO

GPU Driver: video-hybrid-intel-nvidia-440xx-prime

I can confirm this. 

My laptop is currently using the Intel-NVIDIA GPU hybrid hardware configuration. Even after following the guide on KDE's community wiki, it would work until the login screen (SDDM). After logging in, everything froze; the screen went black and the mouse cursor went unresponsive. 

Upon checking the "Info Center" application, and in the "Graphics" section; the driver used was the Mesa driver (for Intel). Optimus did not work with Wayland, but I ran it anyway in the terminal; it gave the error "the active card is Intel, but it should be NVIDIA".

Could this issue be isolated with only the Intel-NVIDIA GPU hybrid configuration?
Comment 21 Oliver Jõgar 2020-08-01 20:33:47 UTC
For me, when nvidia-drm.modeset=1 and KWIN_DRM_USE_EGL_STREAMS=1 are used, the Wayland session freezes on my BIOS boot logo and there is no cursor. When I switch to a tty and back, I get a moving cursor and black screen.

When I don't use KWIN_DRM_USE_EGL_STREAMS, I can log in and get a desktop, but it runs at a completely unusable framerate.

The screen is black and you can't see anything, but programs launch fine and input devices work, as I can hear Discord launch after login.

My computer is using the "video-nvidia-440xx" proprietary driver, more specifically 440.100, no hybrid or Optimus used, meaning this isn't limited to hybrid graphics solutions.

CPU: Intel i5-9600K
GPU: NVIDIA GeForce GTX 1660

Manjaro 20.0.3 Stable
KDE Plasma 5.19.3
KDE Frameworks 5.72.0
Qt 5.15.0
Kernel: 5.7.9-1-MANJARO
Comment 22 plops-05budgets 2020-09-28 15:39:52 UTC
If you look at ur system settings running without gel stream it uses the intel
(In reply to Weng Xuetian from comment #17)
> I'm running archlinux with a intel+nvidia system and with
> KWIN_DRM_USE_EGL_STREAMS=1 I will also get a cursor in the middle of black
> screen.
> 
> Without KWIN_DRM_USE_EGL_STREAMS being set, I can log into the wayland
> session without any problem (not so sure what's using). gdb attach to kwin
> doesn't seems to have a deadlock or sth.
> 
> My Qt was already 5.15.0 and Plasma just updated to 5.19.0.
Comment 23 Nate Graham 2020-09-29 15:16:19 UTC
*** Bug 426944 has been marked as a duplicate of this bug. ***
Comment 24 plops-05budgets 2020-09-30 00:25:06 UTC
No backend specified through command line argument, trying auto resolution
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
glamor: 'wl_drm' not supported
Missing Wayland requirements for glamor GBM backend
glamor: 'wl_eglstream_display' not supported
Missing Wayland requirements for glamor EGLStream backend
Failed to initialize glamor, falling back to sw
kdeinit5: preparing to launch '/usr/lib/kf5/klauncher'

i think this might be w/e is wrong but i dont exactly understand what it means
Comment 25 plops-05budgets 2020-09-30 02:52:58 UTC
No backend specified through command line argument, trying auto resolution
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
glamor: 'wl_drm' not supported
Missing Wayland requirements for glamor GBM backend
glamor: 'wl_eglstream_display' not supported
Missing Wayland requirements for glamor EGLStream backend
Failed to initialize glamor, falling back to sw
kdeinit5: preparing to launch '/usr/lib/kf5/klauncher'

i think this might be w/e is wrong but i dont exactly understand what it means
Comment 26 plops-05budgets 2020-10-14 14:06:18 UTC
Created attachment 132349 [details]
wayland session log

kde 20.08-1, plasma 5.20, qt 5.15.1-3, libnvidia-egl-wayland1 1.1.5-1, arch linux
Comment 27 Vlad Zahorodnii 2020-10-26 08:43:31 UTC
*** Bug 427948 has been marked as a duplicate of this bug. ***
Comment 28 Wyatt Childers 2020-10-28 18:20:37 UTC
(In reply to Wyatt Childers from comment #12)
> Actually I did miss something, the Qt version note. I'm on 5.14.2. This
> seems to be the latest build available on neon?

An update on this from me, I switched to Fedora, and as of Fedora 33 (KDE 5.19.5, Qt 5.15.1, Kernel 5.8.16, Nvidia 455.28), following the steps outlined here does result in a correctly rendered desktop: http://blog.davidedmundson.co.uk/blog/running-kwin-wayland-on-nvidia/

I do now however, experience symptoms that appear to be similar to those of bug 428195 while running a wayland session -- eating 16 out of 32 threads of a 3950X.
Comment 29 plops-05budgets 2020-10-28 18:40:46 UTC
There are people who have the correct versions of everything still get the black desktop with stuck cursor. I think it is an issue with kde detection of optimus.

(In reply to Wyatt Childers from comment #28)
> (In reply to Wyatt Childers from comment #12)
> > Actually I did miss something, the Qt version note. I'm on 5.14.2. This
> > seems to be the latest build available on neon?
> 
> An update on this from me, I switched to Fedora, and as of Fedora 33 (KDE
> 5.19.5, Qt 5.15.1, Kernel 5.8.16, Nvidia 455.28), following the steps
> outlined here does result in a correctly rendered desktop:
> http://blog.davidedmundson.co.uk/blog/running-kwin-wayland-on-nvidia/
> 
> I do now however, experience symptoms that appear to be similar to those of
> bug 428195 while running a wayland session -- eating 16 out of 32 threads of
> a 3950X.
Comment 30 Andreas Hartmann 2020-11-02 13:32:59 UTC
I've got black screen and a frozen mouse cursor in the middle of the screen, two, with plasma 5.20.2 / qt 5.15.1. No Optimus system. It's just an easy discrete card (GeForce GT 1030).
I tried using weston (it's much more easy) - but the same problem. Screen stays black. Using kwin_wayland or weston in a running X11 KDE session works just fine.
Yes, I used the description here: http://blog.davidedmundson.co.uk/blog/running-kwin-wayland-on-nvidia/

On an Ryzen 7 AMD internal VGA device, kwin_wayland is running (but it's not really usable).

I couldn't find any usable way of debugging the problem. Maybe here is a person which is interested to find the problem by providing ways to debug the problem?
Comment 31 Andreas Hartmann 2020-11-02 19:32:52 UTC
Meanwhile I was able to start a wayland plasmashell via sddm (weston doesn't work yet). 
I did another update of the KDE packages - after this update, the wayland plasmashell is now "working":

The versions I'm using at the moment:
Framework 5.20.2
QT: 5.15.1
Nvidia: 450.80
SDDM: 0.18.1
It's even not necessary to use the environment variable KWIN_DRM_USE_EGL_STREAMS.

But:
It's massively unstable:
Starting another session or switching to a console (CTRL-ALT-Fx) breaks the previous session - when coming back, the screen is black again. I have to kill it completely with killall -u user.
Next problem: krunner is broken - crashes massively.
More problems:
The complete session crashes (plasmashell?) if there are e.g. two konsole programs are running and you're pointing to the preview of each window in the taskbar.
If the theme is changed, the plasmashell crashes, too.
=> All in all: pretty unusable.
Comment 32 Vlad Zahorodnii 2020-11-03 08:09:47 UTC
(In reply to Andreas Hartmann from comment #31)
> The versions I'm using at the moment:
> Framework 5.20.2
> QT: 5.15.1
> Nvidia: 450.80
> SDDM: 0.18.1
> It's even not necessary to use the environment variable
> KWIN_DRM_USE_EGL_STREAMS.
If you don't set in KDE Plasma < 5.20.3, kwin will use the software renderer.

> But:
> It's massively unstable:
> Starting another session or switching to a console (CTRL-ALT-Fx) breaks the
> previous session - when coming back, the screen is black again. I have to
> kill it completely with killall -u user.
Sounds like bug https://bugs.kde.org/show_bug.cgi?id=428088
Comment 33 Vlad Zahorodnii 2020-11-03 08:10:04 UTC
If you don't set it*
Comment 34 Andreas Hartmann 2020-11-03 17:48:36 UTC
Good point regarding KWIN_DRM_USE_EGL_STREAMS:

If KWIN_DRM_USE_EGL_STREAMS is set, the following crash disappeared:
"The complete session crashes (plasmashell?) if there are e.g. two konsole programs running and you're pointing to the preview of each window in the taskbar."

=> so this seems to be a software renderer problem.

The problem with black screens doesn't disappear using KWIN_DRM_USE_EGL_STREAMS.
Comment 35 plops-05budgets 2020-11-03 18:10:59 UTC
Expect for people with optimus laptops. I have kde streams enabled and still get black screen with unmovable mouse as long as Im using nvidia gpu. If I use intel with kde streams disabled it loads wayland just fine and have had no issues with waylands performace. I have a secondary laptop that only has an intel gpu and it has been using wayland for last three months straight with no issue
Comment 36 plops-05budgets 2020-11-03 18:15:49 UTC
Oh and on optimus if kde streams is removed it defaults to Intel gpu. Oh and optimus manager is unsure why it failed to load nvidia. Oh and trying to force nvidia to run by making prime can’t use Sddm and still gets stuck on black screen with Unmovable mouse if I set auto log to log into plasma wayland wayland by default I have yet to see it boot into wayland successfully on the nvidia.
Comment 37 MaxProPlus 2020-11-16 11:38:45 UTC
I have the same problem with the nvidia GTX 1050 Ti. This error is not related to intel optimus.
KDE neon 5.20 User Edition
Plasma: 5.20.3
KDE Framework: 5.75.0
Qt: 5.15.1
Kernel: 5.4.0-53-generic
Driver: nvidia-driver-455
cat /sys/module/nvidia_drm/parameters/modeset
Y
echo $KWIN_DRM_USE_EGL_STREAMS
1
Comment 38 Argy M 2021-01-27 10:22:38 UTC
Having the same (I think) issue here, on an Optimus laptop, configured correctly with NVIDIA for the X11 session. Without KWIN_DRM_USE_EGL_STREAMS, the Wayland session uses the Intel card. With it, I get a black screen with an immovable cursor, and I can't even get a tty (with Ctrl+Alt+F2-12) until I force shutdown.

Operating System: Fedora 33
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel Version: 5.10.9-201.fc33.x86_64
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-4910MQ CPU @ 2.90GHz
Memory: 15.2 GiB of RAM
Graphics Processor: Quadro K2100M/PCIe/SSE2
Comment 39 Zamundaaa 2023-01-17 13:06:40 UTC
We're no longer using EGLStreams to support NVidia. If there's still issues with NVidia, please open new bug reports for those