Page MenuHomeFreeBSD
Authored By
bses30074_gmail.com
Jan 18 2024, 9:28 PM
Size
36 KB
Dimensions
848px × 128px
Referenced Files
None

image.png

image.png (128×848 px, 36 KB)

File Metadata

Mime Type
image/png
Attributes
Image
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7410627
Default Alt Text
image.png (128×848 px, 36 KB)

Event Timeline

git clone Freebsd source code.
make -j4 buildworld -DNO_CLEAN # 16 hours
make -j4 buildkernel KERNCONF=GENERIC-VCHIQ # 5 hours errors out because of the minor formating string errors. Like nobody compiled the code.

So I edited files to be able to finish compiling the code. I did this for FreeBSD source code. Then I started working with GhostBSD source code (downstream from FreeBSD source code) Same errors. So made patch files git diff -u vchiq_core.c . Created the patch files against the bare original FreeBSD source code and finally understood that the VHCIQ Audio patches from review D37878 was not included in the FreeBSD code. So now I am patching the code with Review D37878 patches. Vchiq_Core.c errors
Having HDMI Audio work when using the D37878 Patch files. Yes, I think including those 3 patch files in your PNG picture , works.
FreeBSD 14.0 Compiing with Patch file to enable HDMI Audio output

Yes, How can I help review and upstream this VCHIQ code? What is the catch to not moving forward? License and origins of the VCHIQ code?

Script file to download an FreeBSD 14.0 compressed image file

Thank you for your response. I'm currently experiencing confusion. I applied the patch from https://lists.freebsd.org/archives/freebsd-arm/2022-February/000949.html to my RPI4 device, compiled it, and encountered no errors. It seems the patch referenced in the link corresponds to D37878, D37878, D36431.

After closely examining the linked patch, I noticed a slight difference compared to the three patches mentioned. For instance, in sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c, D37389 adds:

#if defined(aarch64)
int g_cache_line_size = 64;
#else

However, this addition is absent in the email patch.

I am not a FreeBSD administrator but rather a developer. I think the reviewer will give some feedback ASAP. As far as I can tell, the VCHIQ license appears to comply, using the BSD-3-Clause license.

Thank you for your valuable contribution to the driver!

This is my test result:

  1. Applied the email patch from link.

Result: Success, but only one PCM device is detected, which is the 3.5mm sound output.

  1. Applied the three patches manually: D37878, D37878, and D36431.

Result: Success, but only one PCM device is recognized namely the 3.5mm sound output.

  1. Applied the three patches manually: D37878, D37878, D36431. Then applied D43399 using the following commands:
$ patch <D36431.patch
$ patch <D37878.patch
$ patch <D37879.patch
$ git restore --source HEAD^  # Restore the files D43399 will use
$ patch <D43399.patch

Result: Encountered an error. Output details can be found here.

The discrepancy between my results and yours may be due to the version difference (I used FreeBSD 15). I think the reviewer will conduct similar tests. I will try to review the codes.

HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src January 19, 2024 Thank you Marcos Devesas Campos
HDMI audio sound patchs into GhostBSD & FreeBSD
Applied the three patches manually: D36431, D37878, D37879
D36431 date was September 2, 2022
D37879 date was December 26, 2022
D37878 date was December 26, 2022
fetch https://reviews.freebsd.org/D36431?download=true
wget -c https://reviews.freebsd.org/file/data/cc5gnx6lx7pcvduupcbj/PHID-FILE-ombv7ctfqm3de2dyqgeq/D36431.diff
fetch https://reviews.freebsd.org/D37878?download=true
wget -c https://reviews.freebsd.org/file/data/bicc7vdmyzwnylvq5soa/PHID-FILE-wc6uoit423pb3lpagwsq/D37878.diff
fetch https://reviews.freebsd.org/D37879?download=true
wget -c https://reviews.freebsd.org/file/data/ln65jga5vwpz4j2ijmnx/PHID-FILE-cnp5deghq74u3kcfwtxs/D37879.diff
Standard update to /usr/src code to the latest

git -C /usr/src pull --ff-only
root@usr/src # git -C /usr/src pull --ff-only
Already up to date.

PATCH Kernel example:

su - # setup to be root user
cd /usr/ghost14 ; mkdir Patches
cd Patches
wget -c https://reviews.freebsd.org/file/data/cc5gnx6lx7pcvduupcbj/PHID-FILE-ombv7ctfqm3de2dyqgeq/D36431.diff
wget -c https://reviews.freebsd.org/file/data/bicc7vdmyzwnylvq5soa/PHID-FILE-wc6uoit423pb3lpagwsq/D37878.diff
wget -c https://reviews.freebsd.org/file/data/ln65jga5vwpz4j2ijmnx/PHID-FILE-cnp5deghq74u3kcfwtxs/D37879.diff

cd /usr/ghost14/ghostbsd-src # Now patch those files. for FreeBSD /usr/src

patch <../Patches/D36431.diff
patch <../Patches/D37878.diff
patch <../Patches/D37879.diff

D37878 creates configuration file sys/arm64/conf/GENERIC-VCHIQ. Now compile with this line. make buildkernel KERNCONF=GENERIC-VCHIQ -DNO_CLEAN

whoami
su root
cd /usr/ghost14/ghostbsd-src

Using 3 previously completed patches to kernel, build the kernel, install the kernel

time make -j4 buildkernel KERNCONF=GENERIC-VCHIQ -DNO_CLEAN

Compiling to see if errors show up.
time MAKE-j4 buildKERNEL KERNCONF=GENERIC-VCHIQ -DNO_CLEAN

MAKE installKERNEL example:
https://docs.freebsd.org/en/books/handbook/cutting-edge/index.html#updating-src-installing 26.6.5. Installing the Compiled Code

make installkernel KERNCONF=GENERIC-VCHIQ

If a custom kernel was built, KERNCONF must also be set to use the new custom kernel:

  1. cd /usr/src
  2. make installkernel KERNCONF=GENERIC-VCHIQ
  3. shutdown -r now
  4. cd /usr/src
  5. make installworld
  6. shutdown -r now

pkg install mpg123 # use this audio program as a simple test. Others can be used. Open a Web Browser like Falkon and play audio or play a video
mpg123 *.mp3
ITS ALIVE and WELL and SOUNDS GREAT!! Marcos Devesas Campos for the WIN!

root@rpi-Ghost4B-test-Dec12-3-jan8:~ # dmesg | grep -in pcm
64:pcm0: <VCHIQ audio> on vchiq0
root@rpi-Ghost4B-test-Dec12-3-jan8:~ # dmesg | grep -in vchiq
8: root@rpi-Ghost4B-test-Dec12-3-jan8:/usr/obj/usr/ghost14/ghostbsd-src/arm64.aarch64/sys/GENERIC-VCHIQ arm64
62:vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b87b irq 72 on simplebus0
63:vchiq: local ver 8 (min 3), remote ver 8.
64:pcm0: <VCHIQ audio> on vchiq0

root@rpi-Ghost4B-test-Dec12-3-jan8:~ # sysctl hw.snd.default_unit
hw.snd.default_unit: 0
root@rpi-Ghost4B-test-Dec12-3-jan8:~ #

root@rpi-Ghost4B-test-Dec12-3-jan8:~ # sysctl dev.pcm
dev.pcm.0.trace: 0
dev.pcm.0.starved: 10
dev.pcm.0.freebuffer: 40000
dev.pcm.0.underruns: 2
dev.pcm.0.retrieved: 775696
dev.pcm.0.submitted: 812000
dev.pcm.0.callbacks: 824
dev.pcm.0.dest: 0
dev.pcm.0.mode: 3
dev.pcm.0.bitperfect: 0
dev.pcm.0.buffersize: 0
dev.pcm.0.play.vchanformat: s16le:2.0
dev.pcm.0.play.vchanrate: 48000
dev.pcm.0.play.vchanmode: fixed
dev.pcm.0.play.vchans: 1
dev.pcm.0.%parent: vchiq0
dev.pcm.0.%pnpinfo:
dev.pcm.0.%location:
dev.pcm.0.%driver: pcm
dev.pcm.0.%desc: VCHIQ audio
dev.pcm.%parent:

root@rpi-Ghost4B-test-Dec12-3-jan8:~ #

root@rpi-Ghost4B-test-Dec12-3-jan8:~ # cat /dev/sndstat
Installed devices:
pcm0: <VCHIQ audio> (play) default
No devices installed from userspace.

root@rpi-Ghost4B-test-Dec12-3-jan8:~ # freebsd-version -kru
14.0-STABLE
14.0-STABLE
14.0-STABLE
root@rpi-Ghost4B-test-Dec12-3-jan8:~ # ghostbsd-version -fkov
14.0-STABLE
1400501
root@rpi-Ghost4B-test-Dec12-3-jan8:~ # uname -aKmnopr
FreeBSD rpi-Ghost4B-test-Dec12-3-jan8 14.0-STABLE FreeBSD 14.0-STABLE #0 stable/14-n230719-b026f834365-dirty: Sat Jan 20 11:04:28 UTC 2024 root@rpi-Ghost4B-test-Dec12-3-jan8:/usr/obj/usr/ghost14/ghostbsd-src/arm64.aarch64/sys/GENERIC-VCHIQ arm64 aarch64 1400501

sysctl dev.pcm.0.dest

Marcos FreeBSD-arm maillist post on Raspberry Pi VCHIQ audio sound usage.

From: Marco Devesas Campos <devesas.campos_at_gmail.com>
Date: Tue, 06 Sep 2022 11:23:08 UTC

Hi

On 7 Sep 2022, at 06:04, Fred Finster <fred@thegalacticzoo.com> wrote:

VCHIQ sound on Raspi4B HDMI audio. Which DTB to include on config.txt file, Any other missing pieces?

stock confit.txt and dtb-s.

dmesg should then show

vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b87b irq 72 on simplebus0
vchiq: local ver 8 (min 3), remote ver 8.
pcm0: <VCHIQ audio> on vchiq0

and

cat /dev/random > /dev/dsp

should play static

If nothing’s playing, flipping the sysctl dev.pcm.0.dest through

  • 0: both hdmi and headphones
  • 1: headphones
  • 2: hdmi

usually brings the audio back to life.

Best,
Marco

  • Wish you a SOUND fun time using this VCHIQ Audio patch for FreeBSD on the Raspberry Pi **

Oh, I get it. It is using the "dev.pcm.0.dest" to control the output. In my device, it is like below. The HDMI output can work whilst setting it to 2.

  • 0: headphones
  • 1: headphones
  • 2: HDMI
kola@generic:~ $ freebsd-version
15.0-CURRENT