[am335x] Completely frustrated with SGX+OpenGL

I’ve spent several days trying to install SGX drivers, OpenGL, … without success in order to run an application that depends on GLES3.0 and SDL.

But it has been totally impossible, I have tried to follow this tutorial:
https://elinux.org/BeagleBoneBlack/SGX_%2B_Qt_EGLFS_%2B_Weston

I have done it several times:

  • With the latest IoT version.
  • With ImgTech.
  • With the version mentioned in the wiki (the download link does not work but it is listed in beaglebone black / debian images).
  • And some others that I don’t remember.

If I carry out the tutorial with a completely clean image, I also have dependency problems with: libdrm.so.2 and libwayland-server.so.0.

Using different paths I have always gotten 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)

I am not able to find the way to install it, also I am very surprised how there can NOT always be an installation when the beaglebone black is sold indicating that it has graphic acceleration (there is no god who can use it).

Also try using this image indicated here: Fun with PowerVR and the BeagleBone Black: Low-Cost Development Made Easy - Imagination
But despite showing examples of having everything installed, I have not found a way to use hardware acceleration.

Finally I also tried to follow this post: How use SGX / PowerVR on BBB in 2019 ? - #6 by RobertCNelson

Somebody could help me? On the other hand, is there an image (unofficial) or can someone provide me with an image that allows me to run a simple game?
I’m trying to run this library: GitHub - efornara/frt: A Godot "platform" targeting single board computers.
I only managed to get it to work without hardware acceleration.
Thanks

The ImgTec image was created with this in mind, that image is about the best we can do with what we got…

The version of SGX support we got from TI was EGL / OpenGL ES only… So you can’t run X/etc. TI had wayland working on their TI SDK’s from back in the day…

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

This is an odd issue, as rc.pvr should be run at startup already, are you running it manually? (already initialized?)

Regards,

Yes, I get it of course I know this is open source but if I use ImgTech, I couldn’t find a way to access it. I don’t remember exactly the steps that figure out because I’ve done a lot of tests.

I’ve done it both manually I think, I’m going to redo the tutorial step by step to be sure.

What if I do the tutorial with a clean image of Debian 9.3 2018-01-28 4GB SD IoT and follow the tutorial step by step I get dependency problems with libdrm.so.2 and libwayland-server.so.0.

That’s the problem… The drivers used on the AM335x are NOT open source in our image. They were built for Android and TI got them to work on wayland. Another user hacked up a few libs (libgbm) to make them work~ish. So they require a specific kernel with a specific user-space…

I’ve just triggered a rebuild, in the next hour, i’ll have an updated link for the ImgTec build…

Regards,

Oh I understand! Sorry it’s so complicated, I didn’t know this. My hardware knowledge is limited, I’m just trying to use the beaglebone black for a personal project of running a godot game next to this projector DLPDLCR2000EVM Evaluation board | TI.com.

Ok, I tried to follow again the tutorial step by step, I used Debian 9.3 2018-01-28 4GB SD IoT (kernel: 4.9.78-ti-r94) and I used “Fast installation with deb files (not official)” downloading the .deb, …

During the installation everything worked fine:


debian@beaglebone:/opt$ ls /sys/devices/platform/ocp/56000000.sgx
driver driver_override drm modalias of_node power subsystem uevent
debian@beaglebone:/opt$ lsmod |grep pvr
pvrsrvkm 438798 0

But it is not the case for:

debian@beaglebone:/opt$ /usr/bin/pvrsrvctl --start --no-module
/usr/bin/pvrsrvctl: error while loading shared libraries: libdrm.so.2: cannot open shared object file: No such file or directory

(I had previously tried to install it manually with apt install, then I got another error with wayland-server that I also corrected with apt install manually, and also for lib_omap.so.1 but after these two errors I always got the PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ])

I can try to follow it again by doing the manual installation.

Thank you very much for the help and support.

Here you go:

https://rcn-ee.net/rootfs/bb.org/testing/2022-11-30/stretch-imgtec-armhf/

It uses the 4.14.108-ti-r143 and everything is prebuilt/pre-installed with sgx enabled.

If you need any kernel changes, you can tweak the device-tree and overlays, but a kernel rebuild will require a full sgx module rebuild… So yeah, a pain…

Once booted, just run dmesg | grep pvr and you should see the SGX modules loaded and active…

dmesg | grep pvr

Regards,

Thanks a lot! Now the output of the dmesg is perfect!!!

I am now trying to run the ./OGLES2Water test with BeagleBoneBlack/SGX + Qt EGLFS + Weston - eLinux.org.
But I’m getting a:

root@beaglebone:/opt/img-powervr-sdk/Examples/Advanced/NullWS# ./OGLES2Water
./OGLES2Water: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory

Can I install libgbm1 by hand? If I do, would I still use SGX?
At the moment to continue investigating I have done it manually (apt install libgbm1).

With a normal display work like a charm!!! But with the projector I got:

debian@beaglebone:/opt/img-powervr-sdk/Examples/Advanced/NullWS$ ./OGLES2Water
PVR:(Error): WSEGL_CreateWindowDrawable: Couldn't set CRTC: Invalid argument [0, ]
PVR:(Error): WSEGL_CreateWindowDrawable: Couldn't set CRTC: Invalid argument [0, ]
Exit message has been set to: "PVRShell: Unable to create surface
".
InitAPI failed!
PVRShell: Unable to create surface

I have the feeling that it is not detecting my projector correctly, since it is not on HDMI-1 (as in the example):

debian@beaglebone:/opt/img-powervr-sdk/Examples/Advanced/NullWS$ ls -alh /sys/class/drm/
total 0
drwxr-xr-x  2 root root    0 Nov 30 23:29 .
drwxr-xr-x 59 root root    0 Jan  1  2000 ..
lrwxrwxrwx  1 root root    0 Jan  1  2000 card0 -> ../../devices/platform/vgem/drm/card0
lrwxrwxrwx  1 root root    0 Jan  1  2000 card1 -> ../../devices/platform/ocp/4830e000.lcdc/drm/card1
lrwxrwxrwx  1 root root    0 Jan  1  2000 card1-LVDS-1 -> ../../devices/platform/ocp/4830e000.lcdc/drm/card1/card1-LVDS-1
lrwxrwxrwx  1 root root    0 Nov 30 23:29 card2 -> ../../devices/platform/ocp/56000000.sgx/drm/card2
lrwxrwxrwx  1 root root    0 Nov 30 23:29 renderD128 -> ../../devices/platform/ocp/56000000.sgx/drm/renderD128
-r--r--r--  1 root root 4.0K Jan  1  2000 version

I have tried using weston.init to use this device:

debian@beaglebone:/opt/img-powervr-sdk/Examples/Advanced/NullWS$ cat /etc/weston.ini 
[output]
name=LVDS-1
mode=640x360

Maybe I forget something…

EDIT:
It works now! Basically I had to change the format of powervr.ini to:

[default]
WindowSystem=libpvrDRMWSEGL.so
DefaultPixelFormat=RGB888 #RGB565
2 Likes

Good morning Robert,

As luck would have it, I would like to make a kernel change to this image to change the logo to a custom one.

I was able to I followed the steps outlined in this post of yours:

My steps:

  • I cloned ti-linux-kernel-dev
  • I checked out the ti-linux-4.14.y branch
  • Looks like the Kernel is v4.14.108-ti-r144.2 (mine was, of course, 4.14.108-ti-r143)
  • I followed the Toradex example and replaced Tux logo with my own.
  • New logo showed upon reboot.

But now EGL is dead.

So . . . can you point me to what “a full sgx module rebuild” entails?

git clone -b ti-img-sgx/1.14.3699939/k4.14 https://git.ti.com/git/graphics/omap5-sgx-ddk-um-linux.git
cd ./omap5-sgx-ddk-um-linux/

Patch: ti-sgx-omap5/0001-sgx-add-fno-PIE.patch at master · rcn-ee/ti-sgx-omap5 · GitHub
Patch: ti-sgx-omap5/0003-gcc8.patch at master · rcn-ee/ti-sgx-omap5 · GitHub

make_options="CROSS_COMPILE=${CC} KERNELDIR=${x86_dir}/KERNEL TARGET_PRODUCT=ti335x"

Use CC from your kernel build, and set the KERNELDIR

cd ./src/eurasia_km/eurasiacon/build/linux2/omap_linux
make ARCH=arm ${make_options} clean
make ARCH=arm ${make_options}

then copy the modules to /lib/modules/${uname_r}/extra/${device}/

(from: src/eurasia_km/eurasiacon/binary2_omap_linux_release/target/kbuild/pvrsrvkm.ko)

Regards,

1 Like

OK, so first off, thank you Robert. This was exactly the direction I needed.

A few things.

  1. The repo clone command should be:
$ git clone -b ti-img-sgx/1.14.3699939/k4.14 https://git.ti.com/git/graphics/omap5-sgx-ddk-linux.git

You’ve got an extra -um in there.

  1. I created a bash script to simplify the build. I’m posting it for posterity. Obviously stuff needs to be changed per environment.
#!/bin/bash

KERNEL_REPO_DIR="/home/embedded/GitHub/ti-linux-kernel-dev"
MAKEFILE_DIR="./eurasia_km/eurasiacon/build/linux2/omap_linux"

# This sets CC to the value set up by the kernel
source "$KERNEL_REPO_DIR/.CC"

# Robert Nelson defined a sh variable to simplify the make command.
MAKE_OPTIONS="ARCH=arm CROSS_COMPILE=${CC} KERNELDIR=${KERNEL_REPO_DIR}/KERNEL TARGET_PRODUCT=ti335x"

# ------------------ start script --------------------------------

# An installation option. Change this to suit your needs.
# You need to create the extra directory on the BBB first, e.g.
#     $ sudo mkdir -p /lib/modules/4.14.108-ti-r144.2/extra/ti335x
# You need to be able to ssh as root on the BBB.
if [[ "$1" == "install" ]]; then
    BUILD_TARGET_DIR="./eurasia_km/eurasiacon/binary2_omap_linux_release/target/kbuild"
    BBB_TARGET_DIR="/lib/modules/4.14.108-ti-r144.2/extra/ti335x"
    scp $BUILD_TARGET_DIR/*.ko root@BBBIMGTEC:$BBB_TARGET_DIR
    exit 0
fi

# Build all the things
{
    cd $MAKEFILE_DIR

    echo "Running make clean . . . "
    make $MAKE_OPTIONS clean

    echo "Running make . . . "
    make $MAKE_OPTIONS
}

And now it works!

$ eglinfo

eglGetConfigs():
======================================================================

**********************************
EGL config number: 0
EGL vendor string: Imagination Technologies
EGL version string: 1.4 build 1.14@3699939 (MAIN)
EGL extensions: EGL_IMG_client_api_ogl EGL_KHR_image EGL_KHR_image_base EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_vg_parent_image EGL_IMG_cl_image EGL_KHR_fence_sync EGL_IMG_context_priority EGL_IMG_hibernate_process EGL_IMG_image_plane_attribs EGL_KHR_surfaceless_context EGL_KHR_wait_sync EGL_KHR_create_context EGL_WL_bind_wayland_display EGL_EXT_image_dma_buf_import
EGL client APIs are: OpenGL_ES

EGL config Attributes:
 EGL_CONFIG_ID = 0x1
 EGL_BUFFER_SIZE = 0x10
 EGL_RED_SIZE = 0x5
 EGL_GREEN_SIZE = 0x6
.
.
.
1 Like