Skip to content

Instantly share code, notes, and snippets.

@d3nd3
Last active January 25, 2023 10:57
Show Gist options
  • Save d3nd3/a4f16e436bfb85668cfb88ac6378aa9b to your computer and use it in GitHub Desktop.
Save d3nd3/a4f16e436bfb85668cfb88ac6378aa9b to your computer and use it in GitHub Desktop.
Raspberry Pi

lightdm lxsession startup sequence files

  • default run level??
  • /etc/rc3.d/S01lightdm - launches lightdm for runlevel 3.
  • /etc/lightdm/lightdm.conf contains configuration options for lightdm, including autologin-user
  • /etc/X11/Xsession.d/50x11-common_determine-startup will set STARTUP to either ~/.xsession or ~/.Xsession if it exists. If not executable, it will prepend ${SHELL:-sh}. The default is STARTUP=/usr/bin/x-session-manager which is linked to /etc/alternatives/x-session-manager which is linked to /usr/bin/startlxde-pi
  • lxde is the "Lightweight X11 Desktop Environment"
  • /usr/bin/startlxde-pi finishes by starting an lxsession called LXDE-pi: exec /usr/bin/lxsession -s LXDE-pi -e LXDE
  • /etc/xdg/lxsession/LXDE-pi/autostart
  • /etc/xdg/lxpanel/LXDE-pi
  • ~/.config/lxpanel/LXDE-pi
  • ~/.config/lxsession/LXDE-pi/

Docker is best solution

FROM amd64/ubuntu:bionic
RUN apt -y update && apt -y install python3 python3-pip && pip3 install --user pymongo==2.7

WORKDIR mongo-ads
ENTRYPOINT ["python3"]

Hardware Accelerated Chromium Raspberry Pi OS

Solution

Old

chromium-browser --enable-features=VaapiVideoDecoder --use-gl=desktop > /dev/null 2>&1

New

Not needed anymore, just ensure gpu rasterization is enabled in chrome://gpu, and decoder is VDAVideoDecoder

Hardware Acceleration API's

  • VA API - Developed by intel

  • VDPAU - Developed by Nvidia

  • NVENCODE/NVDECODE - Nvidia Specific

  • AMF - Amd Specific

  • The Pi implements OpenMAX and Video4Linux stateful decoder and encoder APIs (and stateless decoder for HEVC).

  • Video4Linux 2 (V4L2) manages video capture and also hardware video compression/decompression

  • V4L2 - codecs and cameras

  • DRM - Direct Rendering Manager. Puts layers on the screen

  • KMS - Kernel Mode Setting. Sets up the screen resolution and timings.

  • GBM - Generic Buffer Management. Actually part of the Mesa 3D library, but generally is actually sitting on top of DRM doing the allocation. AIUI 3D will almost always be using GBM for the output resources.

When passing objects from V4L2 into DRM you generally pass a dmabuf around rather than copying pixels between the subsystems. A dmabuf is a file handle type thing that can be exported from one kernel subsystem and imported into one or more other subsystems. Either V4L2 or DRM can be the allocator/exporter.

Sticky regarding hw accel on pi

https://forums.raspberrypi.com/viewtopic.php?t=317511

Thoughts

The chrome flag enable-gpu-rasterization should be enabled Depends on the decoder being used.

VDAVideoDecoder = bad? VaapiVideoDecoder = NotSure

Angle is bad?

Viewing Decoder in use

Chrome Inspector -> More Tools -> Media or chrome://media-internals

To view the decoder in use.

Nice Image

https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/The_Linux_Graphics_Stack_and_glamor.svg/1200px-The_Linux_Graphics_Stack_and_glamor.svg.png

Opengl support

Raspberry pi can support up to OpenGLES 3.2 and OpenGL 2.1

That is why you will get a lot of shader errors when running programs. Because they are often using OpenGL 4.1 version of the GLSL shader language.

pi zero mongodb compatibility easy

old version here. used pymongo in python3.5 , can't remember why, sorry. https://hub.docker.com/r/nonoroazoro/rpi-mongo https://github.com/nonoroazoro/rpi-mongo
So pizero had to use this old version of mongodb because it is the only one to support 32-bit, which is what the pizero is.
These do not work on the pi4, alignment bus error bug armv7
Mongo from repo assume too new to communicate with pi mongo
Trying docker pull arm64v8/mongo:3.7
server client do not match Bye
pymongo.errors.ConfigurationError: Server at 192.168.0.54:27017 reports wire version 0, but this version of PyMongo requires at least 2 (MongoDB 2.6).
The driver does not support older versions of MongoDB.
Pymongo supports 2.6 max!!!! Trying oldest pymongo driver version @ 2.7
pip3 install --user pymongo==2.7
https://api.mongodb.com/python/2.7/tutorial.html
https://api.mongodb.com/python/2.7.2/api/index.html
Seems to work !!
Refer to mongo gist for more use cases !

High quality sound resample method for raspberry pi, whilst not eating too much cpu.

/etc/pulse/daemon.conf

resample-method = soxr-vhq

Running runescape and runelite on the pi

A neat program discovered MangoHud

Really nice all around fps counter etc for all games.

Runelite

This is default.
./AppRunFile --mode OFF
When --mode OPENGL, weird texture glitches on ui occurs.
Wasnt sure then if rs is running with opengl renderering.
Because libraries were not visible under lsof -p [pid].
MangoHud did not work with runescape but it did work with minecraft.
Runescape .desktop file in ~/.local/share/applications/
Maybe its "indirect rendering" and so it can't pick it up?

Gist with useful information about using a raspberry pi 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment