raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
Other
11.14k stars 4.99k forks source link

Kodi 19 no sound over hdmi using fkms #4634

Open unformatted opened 3 years ago

unformatted commented 3 years ago

Describe the bug With the latest linux-raspberrypi kernel on RPi4 aarch64 and kodi-rpi I cannot select hdmi as audio output device anymore.

To reproduce With config.txt as follows: dtoverlay=vc4-fkms-v3d,cma-512 dtoverlay=rpivid-v4l2 dtoverlay= dtparam=audio=on From kodi, go to Settings > System > Audio > Audio output device.

Expected behaviour hdmi selectable as an audio output device.

Actual behaviour there's only headphone option.

System

Additional context Since kms heavily depends on the monitor's hdmi capabilties and I'm using an hdmi audio extractor in combination with a DVI monitor I have to use fkms. This worked fine until linux-raspberrypi4 5.10.63-18. After upgrading a few days ago hmdi sound was not available anymore. When I downgrade the current linux-raspberrypi4 5.10.73-2 kernel to linux-raspberrypi4 5.10.63-18 I have sound over hdmi back again. See also https://archlinuxarm.org/forum/viewtopic.php?f=65&t=15598 for more details.

popcornmix commented 3 years ago

Can you report output of dmesg, aplay -l and aplay -L for 5.10.63 and 5.10.73 kernels.

Dark-Sky commented 3 years ago

With all of the latest 5.19, 5.14 and 5.15 kernels I have had to put this in cmdline.txt, not just kodi:

KMS: snd-bcm2835.enable_compat_alsa=0 FKMS: snd-bcm2835.enable_compat_alsa=1

Basically this looks like this it turns on and off the bcm2835-hdmi and vc4-hdmi sound. I am guessing the PiOS is using something different to accomplish this. This was done automatically before this depending on which mode you were booting along with the Headphones.

Our thread:

https://forum.manjaro.org/t/i-have-no-sound-output-through-hdmi-on-5-10-73-1-or-5-14-or-5-15/86485

unformatted commented 3 years ago

@Dark-Sky: snd-bcm2835.enable_compat_alsa=1 works for me with fkms, thank you for the detailed information.

@popcornmix: do you still want me to report those outputs after Dark-Sky's answer?

popcornmix commented 3 years ago

If you are saying that then behaviour changed between 5.10.63 and 5.10.73 kernels, then I'd like to understand why (it's not something I'm immediately aware of having a new requirement). So the logs could b useful.

Dark-Sky commented 3 years ago

In the past kernels fkms would boot ok. Starting with kernels 5.14 and 5.15 kernels I figured out I had to manually put values with snd-bcm2835.enable_compat_alsa= depending on which mode (kms/fkms). And with the last 5.10 this issue crept in. This is with no mention of snd-bcm2835.enable_compat_alsa=1 in cmdline.txt with fkms using V3D rendering. All you get is the headphones but what is strange is the hdmi seems to be picked up in inxi but not available to be picked if you open up the Sound Settings to switch Headphones is the only choice.

I have seen multiple times with in the last couple of months if these manual setting was not right on the 2 newer kernels that it would boot up to going into the graphical login or trying to enter kodi I would get a black screen and a message from my monitor saying "No Signal". I have not seen this on the latest 5.10 because as soon as I saw my sound situation I knew what to try to fix it.

pic

dmesg: In the Kernel command line: snd_bcm2835.enable_compat_alsa=0 the value needs to be =1 for it to boot (in the past it was =0) with fkms with bcm2835-hdmi sound as it stands with now with the latest 5.10. 514 and 5.15 kernels.

https://drive.google.com/file/d/1LkM3gOQVSgLjuGjre07XYMpzy3UVESl2/view?usp=sharing

Xorg log:

https://drive.google.com/file/d/1ozSjN5ezFWZsL8PaZSvFfAVuuXivQO4G/view?usp=sharing

Dark-Sky commented 3 years ago

In contrast if I put snd-bcm2835.enable_compat_alsa=1 in cmdline.txt for fkms with v3d rendering and the hdmi sound works and seen in the Sound Settings.

enabled-aplay

enabled-inxi

unformatted commented 3 years ago

@popcornmix : Here's 5.10.63-18 dmesg: https://pastebin.com/2fjSnZLt Here's 5.10.73-3 dmesg: https://pastebin.com/A6PTxEkH I don't have aplay installed and for the moment while I'm still testing I won't install anything new. If you want me to post other logs please let me know.

popcornmix commented 3 years ago

I wonder if this problem is the same as https://github.com/raspberrypi/linux/issues/4635 @Dark-Sky can you test a kernel with the linked device tree commit?

Dark-Sky commented 3 years ago

I wonder if this problem is the same as #4635 @Dark-Sky can you test a kernel with the linked device tree commit?

Sure. Just getting up; need some coffee first.

Dark-Sky commented 3 years ago

@popcornmix I put the new bcm2711-rpi-4-b.dtb through a battery of tests and all is back to what it used to be. I removed any mention of _snd-bcm2835.enable_compatalsa= in config.txt and tested fkms/kms with V3D rendering with the DE and tested kodi-rpi 19.2 with kms and fkms.

As far as I am concerned this fixes and was a firestorm getting people to adjust to the way you all had it and we released new images with that change yesterday. Now I am having to re-live that memory all over again. Just wanted to let you know I understand. Game on again..... lol

cmdline.txt used in all tests:

root=PARTUUID=b75fdbb1-02 rw rootwait console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 usbhid.mousepoll=8 audit=0

fkms aplay -l:

card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3

kms aplay -l:

card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

A side note:

It has been mentioned that with kodi using fkms one does not get HW decoding. That is not the case here.

kodi-fkms

pelwell commented 3 years ago

Now I am having to re-live that memory all over again.

Would sending you some stickers help?

Dark-Sky commented 3 years ago

Would sending you some stickers help?

LOL. I am used to it I have been messing with the pi's since the first one came out. I even to this day get the first pi up to date just for nostalgia. All is good....

popcornmix commented 3 years ago

It has been mentioned that with kodi using fkms one does not get HW decoding. That is not the case here.

Correct. Hardware video decoding is not related to the choice of kms or fkms.

kms only affects the display pipeline (which includes hdmi audio), so there is probably some confusion with omxplayer and mmal variants of kodi which won't work with kms (for display reasons rather than decode reasons).

The newer v4l2 interfaces (for HEVC/H264, and MPEG4/MPEG-2/VC-1 on older Pi's) work fine with kms or fkms.

Dark-Sky commented 3 years ago

I do not see specifically anything related to this change with the latest 5.14 and 5.15 kernels which has the same issue. I am reluctant to release new images if they still do not work with the same cmdline.txt now being used with this fix. A lot of the people are liking the current 5.15 kernel in the our forums. I guess I could copy over the new .dtb's in the kernel PKGBUILD but have not tested if all would be good.

popcornmix commented 3 years ago

I see the fix in 5.14/5.15. e.g. https://github.com/raspberrypi/linux/commit/a415622f250b130c4551401b7e52dab0c3c218cb

Dark-Sky commented 3 years ago

Thanks when I looked a while ago I did not see a change on that file in History.

Dark-Sky commented 3 years ago

I compiled and tested the latest 5.14 and 5.15 kernels and they appear to be good also.

KonstaT commented 3 years ago

I'm experiencing a similar issue that wasn't fixed with https://github.com/raspberrypi/linux/commit/214bf6b3eeae500ac13887ce7b2cca576191f38e.

When running with KMS and disabling VC4 HDMI devices (i.e. setting dtoverlay=vc4-kms-v3d,noaudio in /boot/config.txt) bcm2835-audio HDMI device is not present as it should be.

Running 5.10.74 kernel with latest firmware (https://github.com/raspberrypi/firmware/tree/d2ab264b688a223e23029ffbba86820c8c6cb329) I get:

[    3.899252] ALSA device list:
[    3.902277]   #0: bcm2835 Headphones

Same kernel but downgrade the firmware to https://github.com/raspberrypi/firmware/tree/d06e0ef85c22825a4491497a1d2a4787471f011b I get:

[   10.422612] ALSA device list:
[   10.425629]   #0: bcm2835 HDMI 1
[   10.428908]   #1: bcm2835 Headphones

This would be the expected behaviour. This doesn't work with any newer firmware (bisected this to something that changed between https://github.com/raspberrypi/firmware/tree/d06e0ef85c22825a4491497a1d2a4787471f011b and https://github.com/raspberrypi/firmware/tree/19272ccd69049aaf42c78a235a0bf37dbabd5ea7)

@pelwell @popcornmix Any ideas? Should I open a separate issue for this (and where - kernel/firmware)?

pelwell commented 3 years ago

Is this on a Pi 4? It may not matter, but it could make a difference. And thanks for bisecting it down to one commit - that's always helpful.

KonstaT commented 3 years ago

Ah, yes. This is on Pi 4.

pelwell commented 3 years ago

I'm investigating now, but in the meantime please do create a new issue.

foice commented 2 years ago

@Dark-Sky: snd-bcm2835.enable_compat_alsa=1 works for me with fkms, thank you for the detailed information.

@popcornmix: do you still want me to report those outputs after Dark-Sky's answer?

Confirm that

snd-bcm2835.enable_compat_alsa=1 works for me with fkms, and it is apparently ignore with kms

Dark-Sky commented 2 years ago

@Dark-Sky: snd-bcm2835.enable_compat_alsa=1 works for me with fkms, thank you for the detailed information. @popcornmix: do you still want me to report those outputs after Dark-Sky's answer?

Confirm that

snd-bcm2835.enable_compat_alsa=1 works for me with fkms, and it is apparently ignore with kms

Which kernel are you using. You should not have to do it with the later kernels.

foice commented 2 years ago

https://github.com/raspberrypi/linux/issues/4634#issuecomment-992502317

@Dark-Sky: snd-bcm2835.enable_compat_alsa=1 works for me with fkms, thank you for the detailed information. @popcornmix: do you still want me to report those outputs after Dark-Sky's answer?

Confirm that snd-bcm2835.enable_compat_alsa=1 works for me with fkms, and it is apparently ignore with kms

Which kernel are you using. You should not have to do it with the later kernels.

5.10.63-v7+ #1496 SMP Wed Dec 1 15:58:11 GMT 2021 armv7l GNU/Linux