[Letux-kernel] letux-5.0-rc1 - SGX

H. Nikolaus Schaller hns at goldelico.com
Tue Sep 17 11:23:52 CEST 2019

Now its time for an update.

The driver setup is now working better and better on letux-5.3.

1. it works on omap5 / Pyra as you can see here


2. on GTA04 and BeagleBone it has small problems

2a. modprobe reports problem with deasserting reset on omap3/am335x

root at letux:~# modprobe pvrsrvkm_omap_am335x_sgx530_125
[  187.528139] pvrsrvkm_omap_am335x_sgx530_125: module is from the staging directory, the quality is unknown, you have been warned.
[  187.584580] omap_reset_deassert: timedout waiting for gfx:0
[  187.614430] [drm] Initialized pvr 1.14.3699939 20110701 for 56000000.sgx on minor 1
root at letux:~#

2b. pvrsrvctl fails after doing an mmap2() which seems to map
   the wrong address to user-space so that some condition
   for pvrsrvctl initialization is not fulfilled and
   BridgedDispatchKM reports "Initialization failed".

root at letux:~# pvrsrvctl --start --no-module
[  209.085931] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
[  209.116399] PVR_K:(Error): BridgedDispatchKM: Initialisation failed.  Driver unusable.
PVR:(Error): LoaduKernelProgram : SGX ukernel program Device Addr: 0xe400000 invalid alignment [0, ]
PVR:(Error): SetupuKernel : Failed to load uKernel programs [0, ]
PVR:(Error): SrvInit: Initialisation for device of class 0, type 7, index 0, failed (1) [0, ]
PVR:(Error): PVRSRVBridgeCall: Failed to access device.  Function ID:3223086862 (strerror returns no value.). [0, ]
pvrsrvctl: SrvInit failed (already initialized?) (err=PVRSRV_ERROR_OUT_OF_MEMORY - Unable to allocate required memory)
root at letux:~#

Full source code of v5.3 + pvr/sgx patches to compile with omap2plus_defconfig can be found at


With full Letux-5.3 it one just has to configure

# CONFIG_SGX_DEBUG is not set

It is good to do

	echo blacklist pvrsrvkm_omap_omap5_sgx544_116
	echo blacklist pvrsrvkm_omap_omap3630_sgx530_125
	echo blacklist pvrsrvkm_omap_am335x_sgx530_125
	) >etc/modprobe.d/pvr.conf

so that the module isn't loaded at boot time which makes experiments easier.

For a demo we also need user-space code.

Here is the procedure to create an µSD with Letux-Stretch that I use for my tests

# ssh into BeagleBone and become root
# insert empty (or to be overwritten) SD card into reader
wget -O makesd "http://git.goldelico.com/?p=gta04-makesd.git;a=blob_plain;hb=HEAD;f=makesd" && chmod +x makesd
# replace "pyra" with "bbb" or "debian" for gta04 (where bootloader is in NAND)
DEV=/dev/sdb ./makesd pyra -r http://download.goldelico.com/letux-debian-rootfs/20190708-stretch-9.9-armhf-minimal.tbz
mkdir -p /media/letux/rootfs
mount /dev/sdb2 /media/letux/rootfs
cd /media/letux/rootfs
wget -O sgx.tar.xz https://packages.pyra-handheld.com/images/extra/sgx.tar.xz
tar xvJf sgx.tar.xz
cp -R sgx/pvr/etc sgx/pvr/lib .
cp -R sgx/pvr/bin sgx/pvr/include ./usr
ln -sf libgbm.so.1 usr/lib/arm-linux-gnueabihf/libgbm.so.2    # there is (will be) no libgbm.so.2 in Debian
(echo blacklist pvrsrvkm_omap_omap5_sgx544_116; echo blacklist pvrsrvkm_omap_omap3630_sgx530_125; echo blacklist pvrsrvkm_omap_am335x_sgx530_125) >etc/modprobe.d/pvr.conf
# optionally install newly built kernel, device tree and modules
cd $HOME
umount /dev/sdb*
# extract SD card and insert into Pyra

# boot Pyra
# ssh or access console into Pyra (ssh root at through USB3 port)
yes | apt-get install letux-base libdrm-omap1 libgbm1   # needs some active internet connection on Pyra (ethernet over USB, wwan, wlan)
# use correct driver variant - see device tree
modprobe pvrsrvkm_omap_omap5_sgx544_116 - unless loaded through device tree
pvrsrvctl --start --no-module
cat /proc/pvr/*    # check that PVR was loaded successfully
eglinfo    # get some info
gles1test1 0    # run demo

What I plan is to include this setup in the Letux kernel tree
so that the /root/sgxdemo script loads everything on demand
what is needed.

Then one only has to install LetuxOS and run /root/sgxdemo.


> Am 10.01.2019 um 10:46 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>> Am 09.01.2019 um 18:04 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>> Am 07.01.2019 um 22:05 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>> Hi,
>>> I have spent a lot of time to rebase to letux5.0-rc1.
>>> It went mostly well, except sound and aess.
>>> There has been a significant reorganisation of
>>> sound/soc/omap -> sound/soc/ti files which made
>>> it impossible to apply our patch set.
>>> So I had to filter-branch it to track the file
>>> renames, remove some manually and finally update
>>> all Kconfig, Makefile and some #include.
>>> There were also some other minor issues.
>>> Now it compiles - with warnings.
>>> I have only compile-tested and did a quick boot
>>> test on GTA04.
>>> Note that the tree will be overwritten in the
>>> next days by more fixes and consolidation of them.
>>> Here it is (will be because the git push is still running):
>>> 	http://git.goldelico.com/?p=letux-kernel.git;a=heads
>> Branches have been updated to fix some more issues (mainly AESS and CONFIG).
>> So I wait for v4.20.1 to arrive so that I can build new binaries
>> for everything.
> In addition I have tried to configure SGX530 and build our tree.
> Thre were some minor API changes in 4.16 and 4.20 which did break
> the build. Patches will come...
> The /proc/pvr node appears, i.e. the driver loads (on GTA04 with
> dm3730).
> Anyways, there seems to be a problem now that 
> root at letux:~# pvrsrvctl --start --no-module
> pvrsrvctl: SrvInit failed (already initialized?) (err=4)
> root at letux:~# 
> So either my patches are not perfect (there was something in
> vm -> vmf and error handling) or there is something else...
> Unfortunately this won't make it working anyways since the
> interface to the framebuffer is broken (which should be
> rewritten to use DRM). Therfore the GPU does not know the
> framebuffer memory address...
> Well, we would need a sponsor for 1-2 man years and then
> we could (re)work everything (clean up older API, make driver
> compatible to kernel conding style, get rid of #if for SGX
> variants and replace by if(model)) and more importantly
> (back)port the latest PVR/SGX code we have (which does not
> only claim to handle OMAP3/4 but also OMAP5, and some Intel
> PVR/SGX devices.
> But as usual, there is a need, but no mentor.
> BR,
> Nikolaus
> _______________________________________________
> http://projects.goldelico.com/p/gta04-kernel/
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel

More information about the Letux-kernel mailing list