-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No HDMI audio with KMS #5525
Comments
What does The HDMI driver with KMS has no controls at the ALSA level. It needs IEC958 formatted data, which is normally done via either the ALSA conf file, or via Pulseaudio / Pipewire. If VLC can play audio, then it's more likely to be a configuration issue in Chromium than a kernel issue. |
I see.. how do I play around with the audio configuration of Chromium? I don't see anything in its settings. |
I suspect Chromium is using the system defaults. |
I already have HDMI selected from that drop-down menu. |
There is also a "device profiles" option there. |
If you have a spare sdcard, then it would be useful to install a clean RPiOS Bullseye on it, I've just tested chromium on RPiOS bullseye and I hear the hdmi audio through youtube just fine. It would be good to confirm if your issue is broken from a clean image (which suggests, perhaps TV related). |
Ah - I tried using your edid file, and I do see in dmesg:
which I also see in your log file. I am getting audio, but it sounds a little glitchy. Let me see what's in your edid that causes the channel mapping complaints. |
Okay I understand the channel mapping complaints. From your edid:
It looks like alsa tries both of these formats: But reasonably says 6 channels and 2 speakers doesn't match. But it's not an error - the 2 channel output succeeds. I've also changed hdmi cable and audio is perfect (I was also getting video dropouts previously). So currently I can't see an issue here, so I'd like to know the results of a clean install. Ping @HiassofT - AAC passthrough support seems very unusual. But I wonder if ALSA should even be considering opening PCM with 6 channels - possibly an additional case from #5518 |
@popcornmix is pulse's output profile set to multichannel HDMi output maybe? I'd guess it should work fine if set to Digital Stereo (HDMI) as then pulse should request only 2ch output from ALSA |
Yes, profile was Digital stereo but we get this call:
with this backtrace:
|
Do these messages only appear on pulse startup? If yes my guess is pulse is probing available formats/channels and the message can be safely ignored - kernel is rightfully rejecting 6ch mode. Fixing the AAC constraints should remove the messages but alas I don't have specs for it (my guess is they could be the same as for AC3/DTS, i.e. 2ch at 32/44.1/48 but I'm not 100% sure) |
Yes, the device profile is set to Digital Stereo.
This occurs with a clean install as well (aside from adding SSH & WiFi through the Imager and then connecting a Bluetooth keyboard). If it is an issue with the TV, why is Chromium able to play audio when on fKMS? And why is VLC able to produce sound even otherwise? |
kms and fkms have completely different alas drivers (one runs on the firmware, one on the arm in the kernel). They report different names and supported formats. There are many reasons why they may behave differently. I'm not an expert on pulseaudio, but could you run this command:
when playing a youtube video through chromium (and hearing no sound) and when playing with VLC (and hearing sounds), and report the output of each. I'd like to know if pulse believes it is active in both cases, and if there's any difference in paramaters (e.g. number of channels and sample rate) in each case. |
I am attaching outputs of the command for three cases:
The only difference between the VLC and Chromium files seems to be the sample rate. When I'm playing a YouTube video on Chromium that generates no audio, it shows 44100Hz, while when VLC plays music that does produce sound, it shows 48000Hz. Could that be causing the this behaviour? |
It's quite possible the sample rate is relevant (e.g. the display doesn't actually support 44100Hz despite reporting support in the edid). Can you edit
(without a ; at start) and reboot and try again? |
Yess!! That worked! So how is the fKMS driver able to pick/pass-on the right sample rate, if the EDID reports one that is unsupported? |
Interesting! |
Editing the edid to remove advertising of 44100Hz support would likely work with alsa and non alsa. |
Do I close this issue? I'm still a bit confused as to where the actual issue lies. |
Leave it for now. I'm just seeing if a hdmi analyser can see any issue with the kms audio output at 44.1kHz compared to fkms. |
Removing 44.1 from EDID won't help, 32/44.1/48kHz are mandatory rates for all HDMI devices supporting audio (and the kernel driver will always allow them).
BTW: for ALSA only you can simply force a fixed rate by using this ~/.asoundrc (the default alsa PCM will then automatically resample any rate to 48kHz)
|
@HiassofT I am seeing something suspicious.
We output 44.1kHz audio over hdmi. But the analyser shows the channel status bits as If I add logging to alsa-lib here I see those numbers. If I change this to be unconditional, then we replace the final 02 with a 00 and the analyser decodes the CSB as 44.1kHz (and the red timing errors go away). If I stop pulseaudio, and run the aplay line again, alsalib is called with 04 82 00 00 and analyser gets 44.1kHz and is happy. So it feels like pulseaudio is opening alsa with an incorrect AES setting (saying 48kHz when it's 44.1kHz) and causing this issue. Although a quick grep through pulseaudio doesn't look like it is setting AES (except in passthrough mode). |
@popcornmix looking at the pcm_iec958 code I think it could happen when pulse calls hw_params multiple times with different rates, without re-opening the alsa device. If no rate info is provided in AES (the default unless set explicitly), i.e. rate is NOTID then the first hw_params call will fill in the rate, but subsequent calls won't (as it's no longer NOTID). could you try with this alsa-lib patch? |
I don't have analyser here, but from logging I don't think that helped.
I've added logging (here) and get:
so it looks like |
Thanks for testing! I did some tests, too, and noticed the AES3 value 0x02 is coming from the hdmi PCM definition here: pulse just opens the device "hdmi:1" (1 is the card number) so doesn't set any AES bits and the default in pcm.conf is used. Changing the default to 0x01 (NOTID) gave correct channel status bits. This is a bit hacky (it might cause issues on non-RPi systems that don't fill in values for NOTID) but will work fine on RPi. I'll keep thinking about some solution that could be upstreamed |
@physkets can you remove the previous fix and instead edit
and replace the That will confirm if your audio issue is definitely caused by the channel status bits. |
That does indeed fix the issue as well. I removed the previous change and rebooted to check if the audio stopped playing. I then made this new change and after rebooting, the audio was back. Do I keep it as is right now? Or go back to the previous fix? |
The new fix is better so stick with it. |
For interest, using bookworm, which uses pipewire this issue doesn't happen by default.
If I add 44.1kHz into there, I get the same error with 44.1KHz audio being used but 48kHz transmitted in csb. Ah - I've found where pipewire enabled 44.1kHz and then reverted it due so complaints (almost certainly due to this issue) |
Hi, I also encountered the same issue where the audio couldn't work on Chromium browser. I can confirm the modification on Although the issue is fixed, I notice the following error messages during system bootup (both before and after the fix). Not sure if there is any thing related to this issue.
Despite the error, I don't experience any actual problem with the audio. |
Describe the bug
When I use the KMS driver, there is no HDMI audio device present, as per
alsamixer
. In spite of that, when using VLC, the connected HDMI television does play audio. However, I hear nothing when using Chromium.Upon switching to fKMS, all applications generate audio.
Steps to reproduce the behaviour
Device (s)
Raspberry Pi 4 Mod. B
System
With fKMS: info_raspi_fKMS.txt
With KMS: info_raspi_KMS.txt
Logs
No response
Additional context
I had first raised this issue on the forum:
https://forums.raspberrypi.com/viewtopic.php?p=2116517
The text was updated successfully, but these errors were encountered: