Closed SchwingMC closed 3 years ago
Hi there,
libreelec already uses dtoverlay=rpivid-v4l2
so I don't think that causes it. But you may need to add some gpu memory: https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Raspberry-Pi-4#decoder-errors-with-a-4k-60-hz-monitor
In libreelec you can edit your config.txt with the following commands:
mount -o remount -o rw /flash
nano /flash/config.txt
mount -o remount -o ro /flash
In nano change the gpu_mem=76
to gpu_mem=128
. After editing the file you must reboot the Pi.
The plugin could change this but i'm not sure if it is wise to change the system files automatically. Maybe libreelec will update it some day themselves.
Guess what, I decided to upgrade LibreELEC today and my stream has exactly the same issue XD Downgrading from LibreELEC 9.97.1 to 9.95.5 works for me as a workaround. Can you confirm this?
Thats very interesting, indeed. I haven't tried it with 9.95.5 yet, I will later today or tomorow. I changed the gpu memory as you suggested, but there is no visible change. I also tried to force H.264 in moonlight settings, but it just gets in a endless loading screen, but the app on the host pc starts as expected.
I can confirm that moonlights works fine with libreelec 9.95.5.
I'm not sure what to make of this. LibreELEC 9.95.5 works fine: moonlight-qt.log.kodi.9.95.5.txt
LibreELEC 9.97.1 does not: moonlight-qt.log.kodi.9.97.1.txt
The logs are quite the same, so I think something changed in the LibreELEC libraries. I tried playing a HEVC in Kodi which is working fine, so it might be the way moonlight-qt initializes the stream.
LibreELEC's changelog lists quite some changes: https://github.com/LibreELEC/LibreELEC.tv/compare/9.95.5...9.97.1
I might be a bit confused about how all of this works, but I changed one thing and one thing only and moonlight now seems to work OK, while CEC is suddenly broken:
In distroconfig.txt I changed dtoverlay=vc4-kms-v3d
to dtoverlay=vc4-fkms-v3d
Note the "fkms" replacing "kms".
This is my full distroconfig.txt after the change, without the warnings:
dtoverlay=vc4-fkms-v3d,cma-512
dtoverlay=rpivid-v4l2
disable_overscan=1
disable_fw_kms_setup=1
And this is my full config.txt without the comments, I defined a larger gpu memory size but it was a couple of updates ago:
gpu_mem=256
hdmi_ignore_cec_init=1
[all]
include distroconfig.txt
If I change kms
to fkms
and nothing else, moonlight works while CEC doesn't; when I switch back, CEC works but moonlight shows the vertical tiles glitch.
I did it on a hunch after reading other issues you linked in this one, I don't even know if the setting is different from LibreELEC's earlier version. It's quick enough to test so maybe you can confirm this.
As for the rest of the system, after the change Kodi works normally for both SDR and HDR content at 4k. No issues with the interface or anything else other than CEC disappearing.
I hope this will be useful somehow. And btw thanks for a really good plugin!
Hi @walterpalagi ! AFAIK LibreELEC supports KMS officially, any issue with FKMS will fly under the radar, nonetheless i'll test this workaround later. Thanks for the heads up!
I tried the fkms solution but it indeed kills the CEC and also my digital audio pass-through to my receiver stopped working. I think I'll stay on 9.95.5 for now and hope for the best in RC2 (fingers crossed!). I think it has something to do with the Pi4 HEVC patches in LibreELEC. they refactored them quite a bit.
The Raspberry Pi HEVC hardware outputs a very strange pixel format called V4L2_PIX_FMT_NV12_COL128
. This is NV12 in 128 byte columns. When the V4L2 output is converted to a DRM buffer, it needs to use DRM_FORMAT_NV12
with a special DRM_FORMAT_MOD_BROADCOM_SAND128
to tell the DRM driver about the special 128 byte columns for it to render correctly. Without the modifier, you get the strange tiling.
This looks likely to be a bug in the VC4 DRM driver not handling the special DRM_FORMAT_MOD_BROADCOM_SAND128
modifier properly. I don't think it's a bug in Moonlight because it works properly with the Fake KMS driver (fkms). The only thing changing between fkms and kms should be the VC4 driver.
A couple questions:
vc4-kms-v3d
and working successfully?rpi-update
on 9.55.5 and see if it introduces the bug? You can also try rpi-update
on 9.97.1 and see if it fixes the bug by pulling a different kernel.A couple questions:
1. Just to confirm, 9.95.5 was using `vc4-kms-v3d` and working successfully?
Yes, that works fine
2. To see if we can rule in/out kernel changes, can you run `rpi-update` on 9.55.5 and see if it introduces the bug? You can also try `rpi-update` on 9.97.1 and see if it fixes the bug by pulling a different kernel.
I tried this but the rpi-update script does not work on LibreELEC. I could try to reproduce the problem on OSMC which is Debian based.
I installed Raspbian and downgraded the kernel to 5.10.46 (Same as LibreELEC 9.97.1), the output is fine then. So I think there are two options left:
I'm currently investigating the last option and may also try to use a Raspbian bullseye based installation to get more up-to-date libs.
I spend the weekend compiling different versions of LibreELEC. The culprit seems to be a kernel upgrade from 5.10.35 to 5.10.36: https://github.com/LibreELEC/LibreELEC.tv/commit/ce15afca0cb3d8de9932086f8e55c1e9307fe9e6 When I compile the latest LibreELEC (master branch) using the 5.10.35 kernel moonlight works, and if I compile it using the 5.10.36 or a later kernel it displays the tiled image.
I'm not a C developer so I'm kind of stuck here. @cgutman any idea what the problem could be? It would be nice if I could get moonlight up and running again on LibreELEC.
Hi @veldenb, i'm no dev, but i'm following this issue. Just a reminder from your issue in LE repo. HiassofT said: "Please report this to the moonlight-qt plugin maintainers. Most likely it's embedded ffmpeg needs to be updated to work with latest RPi kernel."
Maybe that clue can help somehow. Bye.
Hi @veldenb, i'm no dev, but i'm following this issue. Just a reminder from your issue in LE repo. HiassofT said: "Please report this to the moonlight-qt plugin maintainers. Most likely it's embedded ffmpeg needs to be updated to work with latest RPi kernel."
Maybe that clue can help somehow. Bye.
I noticed, that's why I tagged @cgutman. To my knowledge he currently manages the apt-repository for moonlight-qt on the pi4 I'm using and may be able to supply a build using a newer ffmpeg.
Hi @veldenb, i'm no dev, but i'm following this issue. Just a reminder from your issue in LE repo. HiassofT said: "Please report this to the moonlight-qt plugin maintainers. Most likely it's embedded ffmpeg needs to be updated to work with latest RPi kernel."
Maybe that clue can help somehow. Bye.
FFmpeg was indeed the problem. Thanks for the hint.
I was able to reproduce this on Raspbian by changing to use Full KMS mode, and I verified that the updated FFmpeg patches from LibreELEC fix it.
I just released 3.1.4-2 packages for Raspbian with the updated FFmpeg in the APT repo.
@cgutman thanks for the fix, I tried it and it works like a charm again on my Pi4 using the latest LibreELEC :D
@SchwingMC if you use the update function in the plugin to update Moonlight, can you confirm your issue is solved after updating?
Works for me!
Yeah, it works now, thank you very much @cgutman and @veldenb for your time and effort.
Hi there, I don't know if its ok to open an issue here, but since libreelec is not officially supported by the moonlight-qt maintainers I decided to give it a try. If installed this plugin moonlights installs just fine and I'm able to pair the device. All the games and applications are visible just fine. But if i try start streaming I get a vertical teared picture like this:
Do you have any idea what to do? I tried to modify
/boot/config.txt
, as outlined in the moonlight-qt wiki to enable HEVC, but/boot/config.txt
does not exist in libreelec.Greetings