Skip to content
Snippets Groups Projects
Commit 9ee07a4a authored by Dylan Aïssi's avatar Dylan Aïssi
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
---
title: "T10085 -- Initial PipeWire evaluation on R-Car"
papersize: a4
header-includes:
- \usepackage{a4wide}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- >
\fancyfoot[C]{\thepage \\
Copyright © 2023 Collabora Ltd. }
linkcolor: blue
colorlinks: true
---
[PipeWire](https://pipewire.org/) is *de facto* the new audio server used by all
major Linux distributions (including Debian and Apertis). It provides a
low-latency, graph-based processing engine on top of audio and video devices
that can be used to support the use cases currently handled by both [PulseAudio](https://www.freedesktop.org/wiki/Software/PulseAudio/)
and [JACK](https://jackaudio.org/).
The goal for this task is to evaluate PipeWire in known problematic use-cases
with JACK, primarily in supporting multiple audio streams and dynamic switching
between them between outputs.
# Set-up the R-Car board
To evaluate Pipewire, we will use an [R-Car Starter Kit Premier board](https://elinux.org/R-Car/Boards/H3SK)
(`RTP8J779M1ASKB0SK0SA003`) with several [Leagy USB Sound Cards](https://www.amazon.de/-/en/External-Speakers-Surround-Simultaneous-Recording/dp/B07VSHCGWD/).
The first step is to install Apertis v2023 (previous Apertis releases don't
support R-Car audio output) on the board eMMC. Running tests from Apertis
installed in an SD card is not recommended as it may reduce performance.
The support of R-Car audio output has recently been added to the Apertis v2023
linux kernel, thus we need at least linux [6.1.20-2~bpo11+1+apertis4](https://gitlab.apertis.org/pkg/linux/-/merge_requests/262).
To avoid having to update the kernel after installing Apertis, we will flash a
daily image (i.e. built after 2023.10.10) of Apertis which includes the required
kernel.
The easiet way to achieve that is first to flash Apertis on an SD card, then use
this SD card to boot the board. From there, we can flash Apertis on the eMMC.
## How to flash Apertis on SD card
First, insert your SD card in a computer then run `fdisk -l` to identify by
which device it is referenced:
```
$ sudo fdisk -l
Disk /dev/mmcblk0: 29.72 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Device Start End Sectors Size Type
/dev/mmcblk0p1 34 500000 499967 244.1M EFI System
/dev/mmcblk0p2 500001 5859375 5359375 2.6G Linux filesystem
/dev/mmcblk0p3 5859376 7812466 1953091 953.7M Linux filesystem
```
In our example, SD card is `/dev/mmcblk0`. Now, we can tell bmaptool to copy our
Apertis image to the SD card:
```
$ sudo bmaptool copy https://images.apertis.org/daily/v2023/20231010.0115/arm64/hmi/apertis_v2023-hmi-arm64-uboot_20231010.0115.img.gz /dev/mmcblk0 # FIXME: kernel panic
$ sudo bmaptool copy https://images.apertis.org/daily/v2023/20231010.0115/arm64/fixedfunction/apertis_v2023-fixedfunction-arm64-uboot_20231010.0115.img.gz /dev/mmcblk0
```
Once copying is complete, the SD card is ready to go in our R-car board.
## How to flash Apertis on eMMC
Before, booting your board, you will have to use a microUSB cable to connect the
PC to R-Car board and then open a serial console with for instance picocom:
```
$ sudo dmesg | tail # To help identifying the tty device name
$ sudo picocom -b 115200 /dev/ttyUSB0
```
Now, it's time to boot the board, if u-boot is correctly configured, apertis will
start otherwise, you will have to re-install a new one (please refer to the
Apertis documentation to update u-boot, see [rcar-gen3_setup](https://www.apertis.org/reference_hardware/rcar-gen3_setup/#updating-u-boot)).
Once, you have access to the Apertis shell, the first step is to add enable
`development` repositories by adding
`deb https://repositories.apertis.org/apertis/ v2023 development` to `/etc/apt/sources.list`
```
$ sudo vi /etc/apt/sources.list
$ sudo apt update && sudo apt install bmap-tools
```
Once, `bmap-tools` is installed, you can flash Apertis on the eMMC. Please refer
to steps above to identify the device name of your eMMC and how to use `bmaptool copy`.
When, Apertis is flashed on the eMMC, it's time to remove the SD card from the
board and to reboot the board.
## How to check if sound works
After re-enabling `development` repositories to `sources.list`, we can install
some tools:
```
$ sudo apt update
$ sudo apt install alsa-utils pulseaudio-utils pipewire
```
If the linux kernel is recent enough, you should have sound cards registrered:
```
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: rcarsound [rcar-sound], device 0: rsnd-dai.0-ak4613-hifi ak4613-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: rcarsound [rcar-sound], device 1: rsnd-dai.1-i2s-hifi i2s-hifi-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0
```
The tool `speaker-test` can be used to verify if speakers can make sound, but
before we need to bump the volume of `DVC Out` with:
```
alsamixer -D hw:0
```
Select the item `DVC Out` with the left and right arrows and then use the up and
down arrows to adjust the volume. Now, `speaker-test` should make noise (be
careful when using a headset because the volume can be quite loud).
# Test case 1: Switching audio streams onto running devices
![Test case 1](audio-test-1.png){#id .class width=50% }
FIXME
# Test case 2: Audio input reconfiguration
![Test case 2](audio-test-2.png){#id .class width=50% }
FIXME
# Test case 3: Capturing multiple inputs to multiple outputs
![Test case 3](audio-test-3.png){#id .class width=50% }
FIXME
# Test case 4: Benchmarking load caused by a bigger number of clients
![Test case 4](audio-test-4.png){#id .class width=50% }
FIXME
# Test case 5: xrun behaviour under load
FIXME
# References
- [T10085: Initial pipewire evaluation on r-car](https://phabricator.apertis.org/T10085)
- [PipeWire's website](https://pipewire.org/)
- [Enable R-Car audio output in Apertis v2023-updates](https://gitlab.apertis.org/pkg/linux/-/merge_requests/262)
- [Enable R-Car audio output in Apertis v2024pre](https://gitlab.apertis.org/pkg/linux/-/merge_requests/264)
- [R-Car Starter Kit Premier board](https://elinux.org/R-Car/Boards/H3SK)
- [Leagy USB Sound Card](https://www.amazon.de/-/en/External-Speakers-Surround-Simultaneous-Recording/dp/B07VSHCGWD/)
#!/usr/bin/make -f
all:
pandoc -f markdown-implicit_figures AT10085_report.md -o AT10085_report.pdf
pandoc AT10085_report.md -o AT10085_report.html
audio-test-1.png

47.9 KiB

audio-test-2.png

46.5 KiB

audio-test-3.png

60 KiB

audio-test-4.png

35.5 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment