Skip to content

rpi02 branch for Bullseye, 64bit, h265 and kmsdrm

Blueroom VR edited this page Feb 19, 2023 · 106 revisions

NEW VERSION of Chiaki for the Raspberry Pi - RPI02

[ YOUTUBE DEMO VIDEO ]

The point of doing this new version is to pick up the latest RPi and other updates for Mesa, FFmpeg and SDL to enable the following improvements over the previous rpi01 version of Chiaki for the RPi:

  • Works with both h264 and h265 codecs. (HDR with h265 will not work until someone figures that one out)
  • Gamepad navigable GUI with some basic settings.
  • Displays on the tty/cli screen using kmsdrm. (Ie without X11)
  • OpenGL display on the Desktop.
  • Can build on Rpi 32bit and 64bit ,RPiOS, Ubuntu, Debian and others.
  • Does not use the legacy RPiOS decode and display stack/libraries.
  • (Still works with both PS4 & PS5 same as before)

The previous, rpi01 version, hardware decode and display is using mmal/ilclient which is an old API that doesn't fully work on 64bit OS's and also is not maintained and therefore never will. The Raspberry team has instead been improving and promoting the v4l2m2m hardware decoders. Additionally support for kmsdrm rendering, ie straight to screen rendering when not under X11, has been established as a new standard and support for that has improved.

This RPI02 branch version is primarily meant to be run from the tty/cli screen.

It works on the Desktop too but doesn't run as smoothly or with as low latency there.

Main system Dependencies, tested versions:

  • Mesa 21.1.0 as minimum. OR the new RaspberryOS included backport version.
    (the DRMPRIME video path is dependent on recent Mesa)
  • Special Rpi FFmpeg/AVCodec (the one included in RpiOS Bullseye is ok)
  • SDL 2.0.18 minimum

Install Instructions

Tested on RPiOS Bullseye 32bit & 64bit, Rpi4b & Zero2W. Those are the Reccommended configurations.
Unfortunately at the time of writing the RPiOS's versions SDL is too old for rpi02 but I have added a custom SDL install script as an easy work around.
If you are trying to run on another (raspberry) Linux distro please read these additional instructions first.

1. Install some Chiaki dependencies

sudo apt install cmake
sudo apt install python3-protobuf protobuf-compiler
sudo apt install libopus-dev
sudo apt install libssl-dev
sudo apt install libudev-dev libevdev-dev
sudo apt install libsdl2-ttf-dev libsdl2-image-dev
sudo apt install libavutil-dev libavcodec-dev libavformat-dev libswscale-dev
sudo apt install libdrm-dev libgbm-dev

2. If you have an Rpi4b, enable the h265 decoder

(Actually this step is now redundant if you have an up-to-date RPi OS)
By adding the following line to your /boot/config.txt
dtoverlay=rpivid-v4l2

3. Download Chiaki rpi02 git branch

git clone --recursive --single-branch --branch rpi02 https://github.com/Fredrum/chiaki.git chiaki-rpi

4. Run my install script for SDL

cd chiaki-rpi
./install_sdl.sh

5. Build Chiaki

mkdir build
cd build
cmake ..
make -j3

6. Run and configure Chiaki

Run the executable
rpi/chiaki-rpi

Do the setup steps needed for the Raspberry to find and communicate with your PS4/PS5.

NOTES:

  • Press 'R3 + Circle' to exit back to gui while in Play session.
  • On PS5 make sure Enable Turning On PS5 from Network is enabled. Under System->Power Saving.
  • More info about internet remote sessions and other things here.
  • F11 toggles Fullscreen on the desktop.
  • PS4 Pro and upwards support 1080p. Only PS5 supports h265.
  • I tried using Bluetooth Audio on the Zero2W but it never worked. Not sure why yet maybe the cpu is getting choked.
  • You can re-use your ~/.config/Chiaki/Chiaki_rpi.conf file to avoid re-registering. I save mine and just copy it back on new SD cards.

Missing/ToDo's on this new version:

  • Add Rumble back.
  • Add back imu Motion Input from PS controllers.
  • Per architecture build specifics.
  • Support for more than one Playstation host in availablility list.

Acknowledgments

The amazing core library of this software that does all the Playstation connections and communication was created by Florian Märkl aka 'thestr4ng3r'. His original version of Chiaki is hosted here, https://git.sr.ht/~thestr4ng3r/chiaki.
Many thanks to Raspi forum member 6by9 for his continous help in explaining Raspberry video and display techniques.
Likewise github user jc-kynesim showed me how to use his new Rpi specific additions to ffmpeg/avcodec and drm rendering which this version relies on. Thank you!