Since I spent way too much time on figuring this out, confused by plenty of old and outdated online
sources, here is how one would get the PowerVR SGX driver running on a current
Linux in 2019 - in this case a debian 9.6 with a 4.4 kernel. Other combinations
might/should work also, but I have not tested them.
To summarize briefly, the difference to the previous ways of getting the SGX
stuff running, is that the old GFX_SDK_* based setups are outdated. This
includes omaplfb.ko kernel module based instructions, which also come from the
GFX_SDK_* times.
Last but not least, it looks like one has to run a TI kernel (updated
to with flag --ti-kernel, see below), as the bone kernels (--bone-kernel)
don't seem to have the new SGX driver stack.
I used bone-debian-9.6-console-armhf-2018-12-10-2gb.img.xz from RobertCNelson's
site at https://rcn-ee.com/rootfs/2018-12-10/microsd/, as I wanted a leaner
base system than what's available on https://beagleboard.org/latest-images.
To put it in a nutshell, we need to run a TI kernel, and install the matching
SGX DDK, and ideally initialize it on startup. So on your system on the BBB
the following should install the TI kernel (v4.4, which worked for me) - the below assumes
that the default user debian of the image is used, so some sudo is needed occasionally:
cd /opt/scripts/tools
git pull
sudo ./update_kernel.sh --ti-kernel --lts-4_4
sudo reboot
Now the SGX DDK, which we'll build from source:
sudo apt install -y libdrm-omap1 libgbm1
cd ~
git clone -b ti-img-sgx/1.14.3699939_k4.4 git://git.ti.com/graphics/omap5-sgx-ddk-um-linux.git --depth=1
cd omap5-sgx-ddk-um-linux/
sudo env DISCIMAGE=/ TARGET_PRODUCT=ti335x make install
cd ~
rm -rf ./omap5-sgx-ddk-um-linux
sudo ln -s /usr/lib/arm-linux-gnueabihf/libgbm.so.1 /usr/lib/arm-linux-gnueabihf/libgbm.so.2
lsmod | grep pvr
dmesg | grep -i -C1 'drm\|sgx\|pvr'
sudo rm /etc/powervr.ini
sudo tee -a /etc/powervr.ini <<EOF
[default]
WindowSystem=libpvrDRMWSEGL.so
DefaultPixelFormat=RGB888
EOF
sudo /usr/bin/pvrsrvctl --start --no-module
cd /usr/bin
eglinfo
gles1test1 x
gles2test1 x
cd -
cat /proc/pvr/version
If the above installed fine, and all the test steps in the above block also
worked, let's automate the SGX initialization at startup via systemd:
sudo tee -a /etc/systemd/system/pvr-init.service <<"TTT"
[Unit]
Description=PowerVR
After=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
# startup fails sometimes (too early?), retry in loop - this paired with TimeoutStartSec is a
# workaround to oneshot services refusing decent Restart= settings (at least for systemd <= 232)
ExecStart=/bin/sh -c 'while ! /etc/init.d/rc.pvr start; do sleep 5; done'
ExecStop=/etc/init.d/rc.pvr stop
TimeoutStartSec=60sec
User=root
[Install]
WantedBy=multi-user.target
TTT
sudo systemctl enable pvr-init
sudo reboot