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

From eLinux.org
Jump to: navigation, search
(Tests graphic accelerator)
(Check access of SGX drivers)
Line 74: Line 74:
 
  ls /sys/devices/platform/ocp/56000000.sgx
 
  ls /sys/devices/platform/ocp/56000000.sgx
 
  driver  driver_override  drm  modalias  of_node  power  subsystem  uevent
 
  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:
+
If you are on 4.9.X-ti- 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/
 
  cd /opt/source/dtb-4.9-ti/
 
  git pull
 
  git pull
Line 81: Line 81:
 
The <code>git pull</code> command patch the dtb files to [https://github.com/dutchanddutch/bb-kernel/tree/am33x-v4.9/patches/drivers/ti/sgx apply this patch].
 
The <code>git pull</code> command patch the dtb files to [https://github.com/dutchanddutch/bb-kernel/tree/am33x-v4.9/patches/drivers/ti/sgx 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...
 
And retry the command to verify the access of SGX drivers, it's very important else you can't continue this tutorial...
 +
 
=== Install modules ===
 
=== Install modules ===
 
  apt-get install ti-sgx-ti335x-modules-`uname -r`
 
  apt-get install ti-sgx-ti335x-modules-`uname -r`

Revision as of 19:43, 17 March 2019

Introduction

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 ;-)


Sources

BeagleBoard

Texas Instruments

Imagination Technologies


Conditions

  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
reboot
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 5.01.01.02 blob extractor)

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

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
./sgx-install.sh
reboot

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-ti- 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
reboot

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
reboot

Verify module loaded

lsmod |grep pvr
pvrsrvkm              442368  0 


The GBM Library

Introduction

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
/lib/arm-linux-gnueabihf
/usr/lib
/usr/local/lib
/usr/lib/arm-linux-gnueabihf

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
./autogen.sh
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 05.02.00.10 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-05.02.00.10-config.txt
$ find /opt/tisdk/sources -iname "*libgbm*"
/opt/tisdk/sources/meta-ti/recipes-graphics/gbm/libgbm_10.0.0.bb
/opt/tisdk/sources/meta-processor-sdk/recipes-graphics/gbm/libgbm_10.0.0.bbappend
/opt/tisdk/sources/meta-processor-sdk/recipes-graphics/gbm/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
0001-Hack-gbm.pc.in-add-ldl-at-Libs-to-pass-the-QT5-confi.patch

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
[default]
WindowSystem=libpvrDRMWSEGL.so
DefaultPixelFormat=RGB565


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.

Download/Install

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

Example

Test with No Window System (NullWS)

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

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!


PVRPerfServerDeveloper

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

PVRTune

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

PVRTrace

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


KMScube

cd /opt/
git clone git://git.ti.com/glsdk/kmscube.git
cd kmscube/
./autogen.sh
make install
cd /opt/
rm -r kmscube
kmscube

If you have a Segmentation fault here, it's because you're not using the right GBM library!
More information on GBM Library section. If you have a failed to initialize DRM, it's that your monitor is not detected ( ls -alh /sys/class/drm/).


QtQuick + EGLFS

apt-get install libqt5qml5 qml-module-qtquick-controls qt5-default qtdeclarative5-dev qtquickcontrols5-examples
cd /usr/lib/arm-linux-gnueabihf/qt5/examples/quickcontrols/extras/dashboard
qmake
make
export QT_QPA_PLATFORM=eglfs
export QT_QPA_EGLFS_INTEGRATION=none
./dashboard

Do you see a dashboard on your monitor? It's perfect ^^!

Weston

GStreamer