Bug 448839

Summary: [NVIDIA Wayland] Screen recording and task manager's window thumbnails are black
Product: [Plasma] kwin Reporter: Samuel <sampingu02>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: aleixpol, arnaudfrezet, bugs.kde.org, diegobere32, eli, f1she4rs, james, jgrulich, jsdeckerido, kde, mmbossoni, nate, nicolas.fella, nortexoid, plasma-bugs, postix, supgesu, theivorytower, xnaxdy, zawertun
Priority: NOR Keywords: wayland
Version: 5.24.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.27.4
Sentry Crash Report:
Attachments: Image showcasing the tooltip window thumbnail bug.
(Wrong bug)
Blurry thumbnails

Description Samuel 2022-01-20 17:44:25 UTC
Created attachment 145673 [details]
Image showcasing the tooltip window thumbnail bug.

SUMMARY
The Icons Only Task Manager's tooltip window thumbnail (that popsup when hovering over a running application), is just black and dont show any thumbnail. (All latest packages with merged qt5-wayland fix for NVIDIA GBM)


STEPS TO REPRODUCE
1. Log-in to Plasma Wayland session with NVIDIA GPU.
2. Open some applications.
3. Hover over those application to see the window thumbnail tooltip.
4. See the blacked out thumbnails in tooltip.

OBSERVED RESULT
A blacked out thumbnail appears as shown in the attached image.

EXPECTED RESULT
The window's actual thumbnail should appear in the tooltip.

SOFTWARE/OS VERSIONS
Linux Kernel: 5.16.1-arch1-1
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.90
Qt Version: 5.15.2

ADDITIONAL INFORMATION
NVIDIA GeForce GTX 1060 6 GB.
NVIDIA Proprietary Driver 495.46-2.
Latest qt5-wayland with the merged patch for NVIDIA GBM panels updation (https://invent.kde.org/qt/qt/qtwayland/-/merge_requests/24).
Comment 1 Samuel 2022-02-11 17:50:58 UTC
Is anyone working on fixing this bug? Is this issue complex or easy to fix?
Comment 2 Marcelo Bossoni 2022-02-14 20:15:27 UTC
Created attachment 146739 [details]
(Wrong bug)
Comment 3 Marcelo Bossoni 2022-02-14 20:17:07 UTC
(In reply to Marcelo Bossoni from comment #2)
> Created attachment 146739 [details]
> heaptrack (400+ MB being used after closing all windows/apps)

Wrong bug.. how can I delete the attachment?
Comment 4 Samuel 2022-02-15 14:54:25 UTC
> Wrong bug.. how can I delete the attachment?

Done :)
Comment 5 Samuel 2022-02-17 13:35:36 UTC
The issue still occurs in latest stable plasma release 5.24.1 with latest NVIDIA driver, 510.54.
Comment 6 Michael D 2022-03-01 10:58:43 UTC
My issue looks somewhat different, as you can see from the attachment. I'm on AMDGPU (Ryzen 4500U).
Comment 7 Michael D 2022-03-01 10:59:07 UTC
Created attachment 147215 [details]
Blurry thumbnails
Comment 8 Michael D 2022-03-01 10:59:50 UTC
Restarting plasmashell fixes the issue for me.
Comment 9 Samuel 2022-03-02 13:04:33 UTC
(In reply to Michael D from comment #6)
> My issue looks somewhat different, as you can see from the attachment. I'm
> on AMDGPU (Ryzen 4500U).

Is this issue affecting all Plasma users then?
Comment 10 Michael D 2022-03-02 13:14:48 UTC
Seems it may not be nvidia-specific, if that's what you mean. Maybe Intel's unaffected.

I notice it is rare that I get black, blurry thumbnails--it's only happened to me once so far. Are yours always like that?
Comment 11 Samuel 2022-03-03 05:53:04 UTC
(In reply to Michael D from comment #10)

> to me once so far. Are yours always like that?

Yup. Its always like that, no matter what application I open or how many times I restart plasmashell.
Comment 12 Nicolas Fella 2022-03-07 13:58:05 UTC
Same thing for screen recording, which uses the same codepath under the hood
Comment 13 Nicolas Fella 2022-04-08 16:27:24 UTC
*** Bug 448944 has been marked as a duplicate of this bug. ***
Comment 14 Eli T. Drumm 2022-05-17 14:08:17 UTC
Is the screen recording problem definitely the same as the thumbnails problem? I've never had blurry or black thumbnails but screen recording has never worked for me under Wayland.
Comment 15 Nicolas Fella 2022-05-17 14:12:25 UTC
(In reply to Eli T. Drumm from comment #14)
> Is the screen recording problem definitely the same as the thumbnails problem? 

Sort of. Window thumbnails and *window* recording are the same. This is fixed by https://invent.kde.org/plasma/kwin/-/merge_requests/2387

*screen* recording is still broken with nvidia
Comment 16 Samuel 2022-05-18 03:18:43 UTC
(In reply to Nicolas Fella from comment #15)
> (In reply to Eli T. Drumm from comment #14)

>This is fixed by https://invent.kde.org/plasma/kwin/-/merge_requests/2387
So, will this be back-ported to 5.24 or will we have to wait for Plasma 5.25?

> *screen* recording is still broken with nvidia
Any extra info on this? Any open merge requests for fixing screen recording in NVIDIA?
Comment 17 Amine Hassane 2022-09-16 09:36:24 UTC
Window thumbnails, window capture and screen capture all now work with no issues on Plasma 5.25.90 using OBS Studio 28.0.1.
However with Firefox only window capture works, screen capture shows a black screen with a cursor (tested from https://mozilla.github.io/webrtc-landing/gum_test.html).
Comment 18 Vlad Zahorodnii 2022-09-16 09:54:08 UTC
(In reply to sporif from comment #17)
> Window thumbnails, window capture and screen capture all now work with no
> issues on Plasma 5.25.90 using OBS Studio 28.0.1.
> However with Firefox only window capture works, screen capture shows a black
> screen with a cursor (tested from
> https://mozilla.github.io/webrtc-landing/gum_test.html).

I can confirm that output screencasting doesn't work with nvidia driver, but I'm not sure that it's a kwin bug. At the moment, kwin renders a frame in a gbm_bo, then imports that gbm_bo and copies its contents in pipewire's dmabuf. It works with amdgpu, but that doesn't work for some reason with nvidia driver
Comment 19 Marc Deop 2023-03-13 22:01:01 UTC
I cannot share neither windows nor screens on Firefox or Chromium. I only get a black screen (although with a cursor).

OBS Recording *does* work as well as thumbnails.

System:
Plasma 5.27.2
Frameworks 5.104.0
Fedora RPMs
Nvidia 1070
Nvidia Drivers: 525.89.02
Comment 20 postix 2023-03-15 15:19:09 UTC
There's a MR, which somehow didn't get linked here automatically: https://invent.kde.org/plasma/kwin/-/merge_requests/3827
Comment 21 Jan Grulich 2023-03-15 15:25:56 UTC
(In reply to postix from comment #20)
> There's a MR, which somehow didn't get linked here automatically:
> https://invent.kde.org/plasma/kwin/-/merge_requests/3827

Yes, I would appreciate some testing. 

Note: This change above also needs https://invent.kde.org/plasma/kwin/-/merge_requests/3821 to be complete and work properly.
Comment 22 Bug Janitor Service 2023-03-16 11:19:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kpipewire/-/merge_requests/41
Comment 23 Jan Grulich 2023-03-16 14:11:35 UTC
Git commit c325f8269a36694867938394af57af5500e87c71 by Jan Grulich.
Committed on 16/03/2023 at 11:28.
Pushed by grulich into branch 'master'.

Use a different API call to make importing DmaBufs work on Nvidia

Use glReadPixels() instead of glGetTexImage() to import DmaBufs into
memory. This makes Nvidia happy and it no longer gives us just black
screen.

M  +14   -1    src/dmabufhandler.cpp

https://invent.kde.org/plasma/kpipewire/commit/c325f8269a36694867938394af57af5500e87c71
Comment 24 Aleix Pol 2023-03-16 17:28:18 UTC
Git commit 6a6438e681ac60d8ec4670b075ce77de0fdd2e11 by Aleix Pol Gonzalez, on behalf of Jan Grulich.
Committed on 16/03/2023 at 17:22.
Pushed by apol into branch 'Plasma/5.27'.

Use a different API call to make importing DmaBufs work on Nvidia

Use glReadPixels() instead of glGetTexImage() to import DmaBufs into
memory. This makes Nvidia happy and it no longer gives us just black
screen.


(cherry picked from commit c325f8269a36694867938394af57af5500e87c71)

M  +14   -1    src/dmabufhandler.cpp

https://invent.kde.org/plasma/kpipewire/commit/6a6438e681ac60d8ec4670b075ce77de0fdd2e11
Comment 25 Jan Grulich 2023-03-31 12:58:52 UTC
Git commit 75c7689f678409b594e3f4ed0161aa12f2baf1ec by Jan Grulich.
Committed on 31/03/2023 at 12:31.
Pushed by grulich into branch 'master'.

Screencast: fix renegotiation when client fails to use DMABuf modifiers

When client fails to import a DMABuf with a certain modifier, it will
remove it from offerings on his side and offer a new set of modifiers
for us to use. In case the list ends up being small enough that even we
won't be able to use any of the modifiers, we would still keep these
modifiers on our list and offering them to the client. With this we
would end up in a loop renegotiating and never actually fallback to use
MemFD buffers instead. We should also offer modifier-less DMABufs as
in the past. Using these we just need to avoid offering them as they
should be used as the last option.

M  +25   -1    src/plugins/screencast/screencaststream.cpp

https://invent.kde.org/plasma/kwin/commit/75c7689f678409b594e3f4ed0161aa12f2baf1ec