DRI Library - akhilharihar/tinydrm_show GitHub Wiki

A DRI library specific to your controller is required if you want to run an application based on opengl es or Qt for Embedded Linux without an xserver. If a file with name <your_driver_name>_dri.so format exists in /usr/lib/arm-linux-gnueabihf/dri/, you need not proceed with the DRI library compilation and can directly use QT eglfs or opengl ES application.

  1. Enable source code repository by uncommenting deb-src line in /etc/apt/sources.list. Then run:
  2. Update apt cache and install mesa build dependencies.
sudo apt update && sudo apt upgrade -y
sudo apt build-dep mesa
  1. Get mesa sources from https://github.com/mesa3d/mesa/releases that matches libgl1-mesa-dri package version installed in your system.
pi@raspberrypi:~ $ apt search libgl1-mesa-dri | grep "installed"
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libgl1-mesa-dri/testing,now 19.3.2-1~bpo10+1~rpt3 armhf [installed]
...

pi@raspberrypi:~ $ wget https://github.com/mesa3d/mesa/archive/refs/tags/mesa-19.3.2.zip && unzip mesa-19.3.2 && mv mesa-19.3.2 mesa
pi@raspberrypi:~ $ cd mesa
    • Add DEFINE_LOADER_DRM_ENTRYPOINT(driver_name) in src/gallium/targets/dri/target.c file just below #if defined(GALLIUM_KMSRO) line.
    • Add driver_name_dri.so in src/gallium/targets/dri/meson.build file in array next to with_gallium_kmsro text. Refer https://github.com/mesa3d/mesa/search?q=st7735r
  1. configure and build mesa DRI drivers
pi@raspberrypi:~ $ meson build \
    --prefix=/usr \
    --libdir=/usr/lib/arm-linux-gnueabihf \
    -Dbuildtype=release \
    -Dplatforms=x11,drm \
    -Ddri-drivers= \
    -Dgallium-drivers=vc4,kmsro

pi@raspberrypi:~ $ ninja -C build
pi@raspberrypi:~ $ sudo ninja -C build install