Difference between revisions of "BeagleBoneBlack/SGX + Qt EGLFS + Weston"

From eLinux.org
Jump to: navigation, search
(The OLD Version)
Line 39: Line 39:
= Install PowerVR Modules =
= Install PowerVR Modules =
== The OLD Version ==
== The OLD Version ==
It's not a good solution and I have not test.<br>
'''<span style="color:darkred">WARNING: It's not a good solution and I have not test.</span>'''<br>
The older version may run on versions lower or equal than 4.4.68-bone17.<br>
The older version may run on versions lower or equal than 4.4.68-bone17.<br>
The old version use the FBDEV.<br>
The old version use the FBDEV.<br>

Revision as of 19:30, 17 March 2019


The SoC of BeagleBone Black is an AM335x by Texas Instruments.
The graphic accelerator by Imagination Technologies is PowerVR chipset, the serie 5 (SGX530).
I don't have a very good english, thanks to the people who will be able to correct me ;-)



Texas Instruments

Imagination Technologies


  1. We must have "-ti-" on the BBB kernel. Type uname -r to verify your kernel version
  2. We connect a screen to the BBB with a micro HDMI to HDMI cable
  3. We need an ethernet cable to connect the beaglebone to the internet
  4. A lot of place if you want install demos and Weston without Cross Compilation
  5. All orders will be in "root" mode here (sudo -i). Sorry if it's not secure ^^
  6. All packages are up to date (apt-get update).

For my tests I use :

  • Debian 9.3 2018-01-28 4GB SD IoT (kernel: 4.9.78-ti-r94)
  • Debian 9.5 2018-10-07 4GB SD LXQT (kernel: 4.14.71-ti-r80)

you can download the last image of BBB here

Install PowerVR Modules

The OLD Version

WARNING: It's not a good solution and I have not test.
The older version may run on versions lower or equal than 4.4.68-bone17.
The old version use the FBDEV.
So you need a lts/bone kernel to download :

cd /opt/scripts/tools/
git pull
./update_kernel.sh --kernel 4.4.`your version here`-bone17
apt-get install ti-sgx-es8-modules-`uname -r`
depmod -a

Build SGX userspace for 4.4.x (must be done on an x86, due to the TI blob extractor)

git clone https://github.com/RobertCNelson/bb-kernel.git
cd bb-kernel/
git checkout origin/am33x-v4.4 -b tmp-sgx

Copy ./deploy/GFX_5.01.01.02_es8.x.tar.gz to BeagleBone/BeagleBone Black and install

tar xfv GFX_5.01.01.02_es8.x.tar.gz -C /
cd /opt/gfxinstall/
apt-get install lsb-release insserv

Verify omaplfb & pvrsrvkm loaded

debian@arm:~$ lsmod | grep omaplfb
omaplfb                12065  0 
pvrsrvkm              178782  1 omaplfb

But when I test with lastest 4.4-bone kernel, the omapfbl module was not loaded

The NEW Version

Check access of SGX drivers

ls /sys/devices/platform/ocp/56000000.sgx
driver  driver_override  drm  modalias  of_node  power  subsystem  uevent

If you are on 4.9.X kernel, you don't have access to the SGX drivers, update your dtb files for solve this problem:

cd /opt/source/dtb-4.9-ti/
git pull
make install

The git pull command patch the dtb files to apply this patch. And retry the command to verify the access of SGX drivers, it's very important else you can't continue this tutorial...

Install modules

apt-get install ti-sgx-ti335x-modules-`uname -r`
depmod -a

Verify module loaded

lsmod |grep pvr
pvrsrvkm              442368  0 

The GBM Library


The GBM library is patched by Texas Instruments for use the PowerVR module.
The library on /usr/lib/arm-linux-gnueabihf/libgbm.so.1.0.0 is not a good library for use the graphic accelerator.

Add news directories of libs

Edit /etc/ld.so.conf.d/arm-linux-gnueabihf.conf file, and add /usr/lib and /usr/local/lib after the first line.

cat /etc/ld.so.conf.d/arm-linux-gnueabihf.conf
# Multiarch support

After your file saved, type ldconfig to reload the new directories of libraries.

Download/Install library

cd /opt/
git clone git://git.ti.com/glsdk/libgbm.git -b next
cd libgbm/
git apply 0001-Hack-gbm.pc.in-add-ldl-at-Libs-to-pass-the-QT5-confi.patch
make install
cd /opt/
rm -r libgbm
ln -s /usr/local/lib/libgbm.so.2.0.0 /usr/local/lib/libgbm.so.2

How get the GOOD library

Note: If you want just use the graphic accelerator, this part is not important.
I explain how I sought to get the patches from Texas Instruments. You can go to the next step if you want.
I created a SD with am335x-evm-linux-XX.XX.XX.XX.img image and the graphic accelerator work fine on the BeagleBone Black. So I download the last SDK of AM335X from this page. Must be done on an x86 because this repo is very big, I use PSDK for this example:

$ cd /opt/
$ git clone git://arago-project.org/git/projects/oe-layersetup.git tisdk
$ cd tisdk
$ ./oe-layertool-setup.sh -f configs/processor-sdk/processor-sdk-
$ find /opt/tisdk/sources -iname "*libgbm*"
$cat /opt/tisdk/sources/meta-ti/recipes-graphics/gbm/libgbm_10.0.0.bb
BRANCH = "next"
SRC_URI = "git://git.ti.com/glsdk/libgbm.git;protocol=git;branch=${BRANCH}"
$ls /opt/tisdk/sources/meta-processor-sdk/recipes-graphics/gbm/libgbm

I have the git source with the branch and I know there is only one patch !

The Graphic SDK

Download/Install SGX SDK

cd /opt/
git clone -b ti-img-sgx/1.14.3699939 git://git.ti.com/graphics/omap5-sgx-ddk-um-linux.git
cd omap5-sgx-ddk-um-linux/
export DISCIMAGE=/
export TARGET_PRODUCT=ti335x
make install
cd /usr/lib/
ln -s libGLESv2.so.1.14.3699939 libGLESv2.so.1
mkdir /usr/local/lib/gbm/
cd /usr/local/lib/gbm/
ln -s ../../../lib/libpvrGBMWSEGL.so.1.14.3699939 gbm_pvr.so
rm -r /opt/omap5-sgx-ddk-um-linux

File powervr.ini

As explained on the texas instruments wiki, the configuration of the /etc/powervr.ini file is important. I advise you to configure your file as mine:

cat /etc/powervr.ini

Start PowerVR Controller

It is very important that at each start the module pvrsrvkm.ko be loaded
The access to the SGX drivers which is found at this location /sys/devices/platform/ocp/56000000.sgx
And that launches the program /usr/bin/pvrsrvctl --start --no-module, recovered from the graphic SDK of Texas Instruments.
There is a script on your /etc/init.d/ folder, to load modules and start the pvr controller, execute this command:

/etc/init.d/rc.pvr start

Loaded PowerVR consumer services. Whenever the BBB starts, this script need to start. Use insserv or update.rc to execute on each boot.

If you have this error:

/etc/init.d/rc.pvr start
PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ]
PVR:(Error): PVRSRVInitSrvConnect: PVRSRVConnect failed [0, ]
PVR:(Error): SrvInit: PVRSRVInitSrvConnect failed (4) [0, ]
/usr/bin/pvrsrvctl: SrvInit failed (already initialized?) (err=PVRSRV_ERROR_INIT_FAILURE)
  1. Verify you have access to SGX drivers: ls /sys/devices/platform/ocp/56000000.sgx
  2. Verify you boot log with dmesg command
  3. Verify that the powerVR module is loaded lsmod |grep pvr
  4. If all is ok, please halt your board, Remove the power and put it again to boot

Dmesg analyse

dmesg |grep -i pvr
[   51.554766] pvrsrvkm: loading out-of-tree module taints kernel.
==> Module PowerVR loaded
[   51.778874] [drm] Initialized pvr 1.14.3699939 20110701 for 56000000.sgx on minor 2
==> Module PowerVR connected with SGX Drivers
[  122.361997] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
==> PowerVR controller linked with Module and SGX Drivers

Tests graphic accelerator

The PVR Tools and Examples

The first step is to use Imagination Technologies tools and examples because they work well and it's easy to use.


cd /opt/
git clone git://git.ti.com/graphics/img-pvr-sdk.git
cd img-pvr-sdk
export DISCIMAGE=/
export TARGET_PRODUCT=ti335x
make install
cd /opt/
rm -r img-pvr-sdk


Test with No Window System (NullWS)

cd /opt/img-powervr-sdk/Examples/Advanced/NullWS/

It is my favorite! I like it! If you have a problem here, have you a monitor connected on your BBB? Type ls -alh /sys/class/drm/ to verify your monitor:

ls -alh /sys/class/drm/
total 0
drwxr-xr-x  2 root root    0 Mar 18 03:13 .
drwxr-xr-x 61 root root    0 Mar 17 15:17 ..
lrwxrwxrwx  1 root root    0 Mar 17 15:43 card0 -> ../../devices/platform/ocp/4830e000.lcdc/drm/card0
lrwxrwxrwx  1 root root    0 Mar 18 03:13 card0-HDMI-1 -> ../../devices/platform/ocp/4830e000.lcdc/drm/card0/card0-HDMI-1
lrwxrwxrwx  1 root root    0 Mar 18 03:13 card1 -> ../../devices/platform/ocp/56000000.sgx/drm/card1
lrwxrwxrwx  1 root root    0 Mar 18 03:13 controlD64 -> ../../devices/platform/ocp/4830e000.lcdc/drm/controlD64
lrwxrwxrwx  1 root root    0 Mar 18 03:13 renderD128 -> ../../devices/platform/ocp/56000000.sgx/drm/renderD128
-r--r--r--  1 root root 4.0K Mar 18 03:13 version

If you have a problem here, don't continue because it's the easiest way to use hardware acceleration!


It's an application to monitoring the graphics resources, cpu and memory on BBB
Go to /opt/img-powervr-sdk/PVRHub/PVRPerfServer/ and execute ./PVRPerfServerDeveloper


Note: You need to execute PVRPerfServerDeveloper on BeagleBone before.
Download PVRTune here for your x86 operating system and execute it. On PRVTuneDeveloper:
Connect to: (or the IP of BBB) and click on "Go" button's.


Launch your graphic application
The log/s file/s is/are: /opt/img-powervr-sdk/PVRHub/PVRTrace


QtQuick + EGLFS