moonlight-stream / moonlight-chrome

GameStream client for ChromeOS
GNU General Public License v3.0
746 stars 165 forks source link

HW decoding not working properly #418

Closed makedir closed 5 years ago

makedir commented 6 years ago

Chrome Moonlight is stated as supporting HW decoding on client side. This doesn't seem to be true, or is not working properly. If opening a game stream with Chrome Moonlight, my laptop goes to full fan mode and 80°c after a few minutes. Task manager show Chrome uses 55-66% CPU, which is not normal for proper GPU decoding for a simple 1080@60 video. If I use Steam In-Home streaming for example, CPU/GPU usage is about 1/3 of the usage Moonlight uses with same 1080@60 and 25mbit. Client is a Laptop with Intel HD4000 GPU.

jorys-paulin commented 6 years ago

@makedir Have you enabled hardware acceleration under chrome://settings? What does appear under chrome://gpu?

makedir commented 6 years ago

@Jorys-Paulin Yes "Use hardware acceleration when available" is enabled of course in Chrome.

https://www.dropbox.com/s/uf4ma2xky8m0v6d/gpu.pdf?dl=0

jorys-paulin commented 6 years ago

@makedir Moonlight should then use your hardware to decode the h264 stream. Maybe Moonlight's bitrate is higher than Steam's, causing this issue.

makedir commented 6 years ago

@Jorys-Paulin nope. both set to 25mbit, checked via task manager lan/wlan usage.

makedir commented 6 years ago

https://i.imgur.com/e58u3bz.png

jorys-paulin commented 6 years ago

@makedir Chrome is well known for this, what about when Chrome is at idle (when nothing runs)?

makedir commented 6 years ago

@Jorys-Paulin Just when I open a Moonlight stream. It doesnt use GPU acceleration properly it seems and uses CPU decoding.

jorys-paulin commented 6 years ago

@makedir Well, I'm not a C++ developer so I won't be able to dig into the code to confirm or deny, you'll have to ask someone like @cgutman for that.

bottleneckblaster commented 6 years ago

@makedir is correct -- he's not using HW acceleration.

There are couple possible reasons that come to mind:

1) The Gamestream is actually encoded in h265 -- which his Chrome GPU page does not list as HW compatible.

2) The stream is encoded with a h264 profile such as high444p or high422 etc. Since he only lists compatiblity with main/baseline/high this would revert to CPU decoding.

3) He needs to enable specific HW acceleration options within the chrome://flags regarding video decoding. Moonlight is especially sensitive to flag settings, as they change the basic behavior of Blink and Chromium's rendering engine's code pathways.

makedir commented 6 years ago

And why is it encoded in h265 and not h264!? Thats a terrible design chose... terrible terrible. 99% of PC hardware, especially these clients in this specific user land cant HW decode h265. Why is there no option to chose h264? At bandwidth around 10-25mbit you dont need an agressive compression like h265, and h264 would work flawless and is totally more wide open for clients.

bottleneckblaster commented 6 years ago

@makedir To clarify: I'm not at all sure that it is h265 in your case. I've only brought up the possibility because the Android port of Moonlight does allow the option for h265 encoding. You (and/or the Chrome version of Moonlight) may not be using h265 at all.

jorys-paulin commented 6 years ago

@makedir Have you checked under the chrome://gpu page to see if WebGL was hardware accelerated btw?

CarloDePieri commented 6 years ago

I'm having the same problem, as in no hardware acceleration seems to kick in.

Chrome has HW acc enabled in settings and chrome://gpu reports this:

Graphics Feature Status Canvas: Hardware accelerated CheckerImaging: Disabled Flash: Hardware accelerated Flash Stage3D: Hardware accelerated Flash Stage3D Baseline profile: Hardware accelerated Compositing: Hardware accelerated Multiple Raster Threads: Enabled Native GpuMemoryBuffers: Software only. Hardware acceleration disabled Rasterization: Software only. Hardware acceleration disabled Surface Synchronization: Enabled Video Decode: Hardware accelerated WebGL: Hardware accelerated WebGL2: Hardware accelerated

The relevant plugin log is:

[messages.js, handleMessage] Message data: TransientMsg: Hardware decoding is unavailable. Falling back to CPU decoding [index.js, snackbarLog] Hardware decoding is unavailable. Falling back to CPU decoding

jorys-paulin commented 6 years ago

@CarloDePieri Well, there's a problem there. Your GPU settings seem correct

Video Decode: Hardware accelerated
WebGL: Hardware accelerated
WebGL2: Hardware accelerated

But your logs says it can't access the hardware. Maybe there's something blocking chrome from accessing the hardware...

CarloDePieri commented 6 years ago

Investigating this further led me to better understand my problem. I'm running Chrome on Linux, and while hardware acceleration does work (as per chrome://gpu), hardware video decoding does not (there's a flag indicating this, like @bottleneckblaster said above).

On Linux Chrome does not support hardware decoding, and chromium (that would support it) does not support Native Client anymore, which means that moonlight won't work (as per #312 and #323). Let's add all of this to the fact that the Java client has been discontinued and we get a really grim picture for linux user that wish to use moonlight (stuck on chrome with slow cpu decoding). I really hope that the port to WebAssembly (#446) will come soon to fix this.

Maybe you should consider updating your documentation in the meantime, since as of now moonlight on linux only works on chrome on cpu (it seems worth noting, to me), and there simply is no way to run it on chromium (despite what this page on the wiki says).

jorys-paulin commented 6 years ago

@CarloDePieri Yes, wasm seems to be the solution to save the project, however as said in #446 we'll need a forwarder to make it work, so it won't be a one program solution (except if we make our own server)

mzernetsch commented 6 years ago

@CarloDePieri As a linux user myself, i strumbled across this problem a while ago. You can use moonlight-embedded to achieve hardware decoding. You can install it from the AUR if you use some kind of Arch Linux. Currently, it doesn't work within a wayland session though.

I use a simple .desktop file and script to wake the pc and start a desktop streaming session.

[Desktop Entry]
Type=Application
Version=1.0
Name=Windows
Comment=Remote session on Windows desktop.
Exec=/home/user/Tools/StartWindowsStream.sh
Icon=microsoft
Terminal=true
Categories=Network;RemoteAccess;ConsoleOnly;
MAC=<HOST_MAC>
IP=<HOST_IP>
TIMEOUT=40000

ping -c 1 $IP &> /dev/null
if [ $? -eq 0 ] 
then
  echo Remote system already running.
else
  wol --wait=$TIMEOUT $MAC
fi

moonlight stream

Setting up game streaming with a linux client isn't really a smooth experience right now.

cgutman commented 5 years ago

Moonlight Qt supports proper hardware acceleration on Linux.

Allekssanderr commented 4 months ago

It's 2024 guys and Moonlight uses my CPU ( 0 % GPU load) to decode HVEC on HIGH END snapdragon 860 ( Xiaomi Pad 5 Device ) 1721735033324_074357 !!! It makes my games laggy and unplayable Look at the photo