Dietpi 9.1.1 no sound with dtoverlay=vc4-kms-v3d on Amiberry

If I use Dietpi 9.1.1 Arm8 Bookworm and only install Amiberry, I don’t get any sound with the setting in comfig.txt dtoverlay=vc4-kms-v3d. I set it to dtoverlay=vc4-fkms-v3d and I have sound but it starts stuttering after a restart. After exiting Amiberry I always get this message vc4 error async flips arent allowed. Using Raspberry 3A+ installed sdl2. Previously I used Dietpi 8.25.1 and no sdl2 with the setting dtoverlay=vc4-fkms-v3d and never had any problems with the sound. I can use an old image but would like to stay current. What can I do to make it work properly?

@MichaIng can you have a look.

Where should I take a look?

I did a ping to our development

thanks, maybe someone can help me

Pls try to stick to English. You are free to use translation tools like DeepL. Some people might understood German but definitely not all forum user :wink:

OK, I’ll get it done

Do you use HDMI audio or another audio device, and can you show the output of:

aplay -l

What other audio device should I use and how is everything set up automatically and then I no longer have sound under Amiberry dtoverlay=vc4-kms-v3d

This was a question, quite possible that you use the 3.5mm audio jack or a USB DAC. However, if I understand you correctly, you do use HDMI audio. The difference between fkms (fake KMS) and kms (full KMS) is, that the latter provides and internal audio driver, replacing the Broadcom onboard audio driver. Both however have different properties.

Can you please show the output of the command above, so we first see whether really the intended HDMI audio device is listed and used:

aplay -l

EDIT: Okay, ran some tests. This vc4hdmi audio driver supports only a certain IEC958 audio format, hence playback requires a conversion. The native ALSA auto-conversion plugin does not support this, instead a special ALSA PCM type is required. The libasound2-data package from the RPi repository ships a configuration for this, which sets the required config as default for this card. But applying any pcm.!default via /etc/asound.conf or ~/.asoundrc overwrites the default, hence breaks it. Strange is that even raspi-config does not handle this correctly: As fast as you select the vc4hdmi audio device there, it creates a ~/.asoundrc which breaks HDMI audio output.

@Lollly2997
Can you verify this? Run raspi-config on your RPi OS image, system settings, audio and select the vc4hdmi device there. Then speaker-test should fail. To fix it:

rm ~/.asoundrc

Services are not affected, since raspi-config places this file into the login user’s home, not into root home and of course not into any service user’s home. So it does not break sound for Amiberry.

However, if you hence still have the DietPi image for testing, please try to switch to vc4-kms-v3d, and then just

rm /etc/asound.conf

This should fix speaker-test as well as audio output for Amiberry and other services/players.

I need to add this to dietpi-config. Hence when onboard audio is selected, and KMS is enabled, to not create any ALSA config and to hide the auto-conversion and equalizer options.

Another thing I was not aware of: When KMS is enabled, the vc4hdmi device always shows up, regardless whether a HDMI device is actually attached or not. Hence the “auto” option does not work in this case. I mean currently, if someone enables KMS, obviously a HDMI device is attached (unless rare cases of other LCD types or SDTV). But we will probably switch to KMS OOTB with RPi builds, when switching to the new kernel/firmware stack.

Another option is to use dtoverlay=vc4-kms-v3d,noudio by default, which disables the KMS HDMI audio driver and replaces it with the bcm2835 one, which is used for 3.5mm output as well, and when KMS is disabled. It however has some downsides as well, e.g. it deos not support 24bit audio, IIRC. But we could instead add a dedicated option for the KMS audio driver.

The is with kms

After rm /etc/asound.conf and vc4hdmi still no sound

I’m desperate and borrow something like that

I usually install dietpi image set language, keyboard and wifi. Amiberry is installed ready more I don’t do because otherwise everything is set automatically and since kms sdl2 that doesn’t work at all anymore

Again, I’m always getting the same result! no sound


Okay, now I see two issues:

  • First of all, you selected rpi-bcm2835-auto in dietpi-config audio options, right? This works with HDMI when KMS is disabled, since the bcm2835 HDMI audio device appears 1st in list, and the headphones/analogue 2nd, and the HDMI audio device disappears from the list if no HDMI screen is actually attached, so that headphones becomes 1st. So when we set 0 (the 1st) as default audio card, it works like an auto-mode. With KMS however, as you can see, the vc4hdmi audio device is not only permanently there, but also 2nd. So rpi-bcm2835-auto equals rpi-bcm2835-3.5mm and never uses the HDMI device. You would need to switch to rpi-bcm2835-hdmi, so that the headphones/analogue device is disabled any only the HDMI audio device is in the list as card 0. Then rm /etc/asound.conf and test with speaker-test, whether you get output.
  • In Amiberry you cannot select the prepared “default” or “sysdefault” PCM, which contains the IEC958 converter plugin, but only the naked hardware PCMs. This means the audio source must be in the right format already, which is obviously not true here. So as long there is no way to use any ALSA meta device, this cannot work with Amiberry at all. I’ll check back with midwan (Amiberry developer) whether there is a way.

It would all work with the bcm2835 HDMI driver, so one could disable this complicated vc4hdmi driver (do not do that):

G_CONFIG_INJECT 'dtoverlay=vc4-' 'dtoverlay=vc4-kms-v3d,noaudio' /boot/config.txt
reboot
aplay -l

This actually used to work in the past, but when I just tested it, it did not enable the bcm2835 HDMI driver anymore in the same turn. I checked and saw that the wanted driver is still disabled by the KMS overlay, by adding snd_bcm2835.enable_hdmi=0 to the kernel command-line. Searching for the reason: bcm2835-audio HDMI device is not present on Pi 4 running with KMS and VC4 HDMI devices disabled · Issue #4651 · raspberrypi/linux · GitHub
So indeed this changed in the end of 2021. I tried to override this by adding snd_bcm2835.enable_hdmi=1 to /boot/cmdline.txt: The bcm2835 HDMI 1 device appeared, but it did not play any sound, and furthermore the HDMI screen indeed turned off immediately, when I tried to play sound. So as stated in the linked GitHub issue, it is true, that at least with recent kernel and firmware, it is technically not possible to use KMS for HDMI display, but the firmware/bcm2835 driver for HDMI audio.

This indeed breaks the usage of HDMI audio in Amiberry on RPi, currently, after we switched from the (deprecated) fake KMS driver to the full KMS driver stack. A regression I was not aware of, but sadly one that we must currently accept, since this fake KMS driver really is deprecated, also not recommended by Amiberry anymore, and the related libaries to make this work via DispmanX not shipped with the new kernel/firmware packages from RPi Ltd. anymore, since Bookworm.

I’ll check back with midwan, as said. Since this affects all RPi users, not only ours, there needs to be a solution to use the default or sysdefault ALSA device, instead of raw hardware PCMs only: HDMI audio on Raspberry Pi with SDL2/KMS backend · Issue #1241 · BlitterStudio/amiberry · GitHub

wow very detailed the whole thing until the problem is solved I will first use the fkms to have sound via Amiberry or take an old image I still have a normal 64bit PC with the Dietpi everything works great but I just use a Raspberry Pi for my custom Amiga

As I said, I take fkms, I only have sound with slight stuttering. When I finish Amiberry, the message vc4 error async flips arent allowedend appears several times among each other

Thanks again for the friendly help. I’ll just have to wait and see whether it works again in the near future

Can you try this one:

cd /tmp
wget https://dietpi.com/downloads/binaries/bookworm/testing/amiberry_rpi3-64-sdl2.deb
dpkg -i amiberry_rpi3-64-sdl2.deb
rm amiberry_rpi3-64-sdl2.deb

RPi 3A+ on an ARMv8/64-bit image, right? Else I can compile the one you need.

That one has a checkbox in Amiberry sound settings, to use the system’s “default” audio device. I was not able to test it quickly, since I have no Amiga application to start through Amiberry, and there is no sound test or similar in the GUI (is it?). But if we understood the SDL2 documentation correctly, then this has a high chance to do what we need.

EDIT: I tested it with some random ROM and Prince of Persia game. I really need a simple free demo :smile:. While it started and ran horribly slow on my RPi Zero W, it did produce some sound with this HDMI setup. So it seems to work. But better you test this as well with an actual production game where you know how it should sound.

I tried your solution unfortunately without success as you can see tested with dietpi 9.1.1 sdl2 kms set amiberry 5.6.9 from testing still no sound sorry


So my problem is now solved, thank you, you are an angel
With the testing Amiberry version 5.6.9 and with the fkms setting I have great sound without any jerking and no error message after quitting Amiberry

1 Like