loki-47-6F-64 / sunshine

Host for Moonlight Streaming Client
GNU General Public License v3.0
1.78k stars 152 forks source link

Black flickering at the top of the screen while streaming #306

Open PowerMeep opened 2 years ago

PowerMeep commented 2 years ago

Relevant info grabbed from Neofetch: OS: Manjaro Linux x86_64 Kernel: 5.13.19-2-MANJARO Terminal: /dev/pts/2 CPU: Intel i5-2400 (4) @ 3.400GHz GPU: NVIDIA GeForce GTX 1050 Ti Memory: 1311MiB / 7919MiB

Installed Sunshine package via AUR

When I stream to any Moonlight client (tested a Windows 10, an Android, and a Pop OS client), there is a persistent black flickering at the top of the screen. Toggling Vsync, changing resolution, and changing framerate don't have any affect. This happens in a number of games tested, but not all of them. I don't get any black flickering when using Gamestream on my Windows PC as the host.

Can this be resolved with settings tweaks?

I'm also unable to use controllers client side much of the time, though this might be a separate issue.

Jturnxd commented 2 years ago

Same issue here on Arch Linux, GTX 970, also installed through AUR.

arifwn commented 2 years ago

After updating my computer, which includes gpu driver updates (Ubuntu 20.04) I saw flickering / tearing on top part of the screen when using the software encoder. Maybe it's similar with your issue on Arch/Manjaro? This issue is gone after turning on hardware encoder. Pretty weird because previously software encoder is pretty smooth, although it's quite heavy on the cpu.

Maybe you can check if you're using hardware of software encoder? Did you see a line that says Info: Found encoder nvenc: [h264_nvenc, hevc_nvenc] when starting sunshine? If not, maybe you might need to patch you gpu driver using nvidia-patch. I got the hardware encoding working patching the driver using using both ./patch.sh and ./patch-fbc.sh on nvidia-patch repo.

The discussion on #232 might also help

PowerMeep commented 2 years ago

I installed nvidia-utils-nvlax from the AUR and rebuilt sunshine with the 'cuda' 'libdrm' and 'libcap' dependencies as per KuleRucket's comment in that thread, and it seems to have resolved the flickering I was experiencing. Apparently, sunshine was using software encoding before, and those changes enabled it to use nvenc.

Edit: I would also like to add that adding the dependencies alone was not enough to enable nvenc. I did have to install nvidia-utils-nvlax. (Though, I did not try nvlax without the extra dependencies.)

h0m3 commented 2 years ago

I've installed nvidia-utils-nvlax, cuda, libdrm and libcap to try the fix from @powermeep but after recompiling sunshine i've ended up with an error everytime i try to stream

[2022:03:23:14:02:36]: Error: Couldn't destroy session handle: Unable to cleanup NvFBC
[2022:03:23:14:02:36]: Info: Screencasting with NvFBC
[2022:03:23:14:02:36]: Info: Color coding [Rec. 601]
[2022:03:23:14:02:36]: Info: Color range: [MPEG]
[2022:03:23:14:02:37]: Error: Failed to start capture session: Invalid external buffer capabilities
[2022:03:23:14:02:37]: Error: Couldn't destroy session handle: Unable to cleanup NvFBC
[2022:03:23:14:02:37]: Error: Couldn't release NvFBC context from current thread: Unable to cleanup NvFBC

Looks like sunshine is unable to cleanup NvFBC (which i guess is the nvidia framebuffer capture 'device').

arifwn commented 2 years ago

@h0m3 are you on Arch? Seems to be a recent problem: https://github.com/keylase/nvidia-patch/issues/511

loisgomez commented 2 years ago

I am also affected by this issue. Trying some of the workarounds mentioned in this issue.

h0m3 commented 2 years ago

@h0m3 are you on Arch? Seems to be a recent problem: keylase/nvidia-patch#511

Thanks, that solved. Its a regression on vulkan-icd-load still without a fix. Perfect 4K streaming now ;)

So, the steps to solve on Arch Linux are. Downgrade vulkan-icd-loader to 1.2.203. Download and install nvidia-utils-nvlax, cuda, libdrm and libcap. Recompile sunshine (if you've installed like me using AUR just install again ;)

cinnamonmatexfce commented 2 years ago

6 months have passed, packages have been uogrqded and this issue still persist?

I'm too affected by the top flickering. Are there still some bugs in nvidia drivers and / or vulkan?

You guys suggest me to try some of the above workarounds?

Or do I need to investigate further?

Client:

Host:

mattbell87 commented 2 years ago

I tried Sunshine for the first time on Fedora yesterday. Not sure if it's related to this but there was a blacked out part of what looked like a single frame every ~30sec.

Host: RTX3080, NV Drivers 515.57, X11 KDE, Sunshine from RPM package, Fedora 36 Client: Lenovo Chromebook Duet, Moonlight Android App

FreshLem0n commented 1 year ago

January 11 and the issue still persists. Using Arch Linux, had the same on openSUSE.

tsawhill commented 1 year ago

January 11 and the issue still persists. Using Arch Linux, had the same on openSUSE.

I think this repo is abandoned. I believe https://github.com/LizardByte/Sunshine has been updated and is actively worked on.

FreshLem0n commented 1 year ago

January 11 and the issue still persists. Using Arch Linux, had the same on openSUSE.

I think this repo is abandoned. I believe https://github.com/LizardByte/Sunshine has been updated and is actively worked on.

Thanks for your reply. I'm using the latest version of sunshine though, so the issue really persists. But I will check out the other repo for more information.

Thank you again!