#!/bin/bash -eux

# This script will run ossia score directly on DRM & EGLFS,
# without using X11, Wayland or anything like this.
# This is the most efficient way to playback scores that use the GPU on a Pi
# as the entirety of the GPU is dedicated to the graphics rendering of score.
# Note that the Qt EGLFS back-end is fairly configurable: if multiple screens
# or special resolution is required, check out the documentation here:
# https://doc.qt.io/qt-6/embedded-linux.html
# in particular "Custom configuration" near the end
DIR=$(realpath "${BASH_SOURCE[0]}")
DIR=$(dirname "$DIR")

export MESA_GLES_VERSION_OVERRIDE=3.2
export MESA_GLSL_VERSION_OVERRIDE=320
export LD_LIBRARY_PATH="$DIR/lib"
export QT_QPA_PLATFORM=eglfs

"$DIR/bin/ossia-score" $@ --no-opengl --no-gui
