Beagleboard-xm ALMOST WORKING [Now with more working!]

I’ve had this beagleboard-xm for a few years and i’ve always thought it would make a great little OF board. However the lack of hardware accel support has kept me at bay for a long time.

It now seems that TI has released some some hardfp SGX SDK files. I’ve gotten them installed on 12.10 by following the guide over at the elinux wiki.

I’ve gotten OF and some examples to build successfully. Initially I ran into some trouble with pkg-config not detecting the egl, glesv1_cm and glesv2 files so I decided to install some mesa packages hoping this would solve the problem, and it did, sort of. When I ran the graphics example it was terribly slow and i ran the eglinfo command included with sgx and it showed that i was now using the Mesa Software Renderer. I had to use the ofAppEGLWindow class to get things running.

So I started over (again) and this time I copied over the includes files for the OGLES/OGLES2 and EGL packages, created some .pc files, and I now have OF compiled without the mesa software renderer. SO CLOSE. I compiled the graphics example and when I run it it ALMOST works… seems like it doesnt like working with X11. I kinda knew this going in, because i had heard that there was not yet xwindows support with the SGX drivers provided by TI.

So looking through the code I see that there is a bunch of interesting specifics going on with regards to the RPi, and that it creates some kind of native window, bypassing X. I was hoping that with the community’s help, we could come up with a similar solution for the beagleboard-xm.

here’s a probably not so useful log

[notice ] ofAppEGLWindow: createSurface(): setting up EGL Display
[notice ] ofAppEGLWindow: createSurface(): EGL Display correctly set
WSEGL_InitialiseDisplay: DRI2OpenConnection failed
[ error ] ofAppEGLWindow: createSurface(): eglInitialize returned EGL_FALSE
[ error ] ofAppEGLWindow: setupPeripherals(): peripherals not supported on X11
[notice ] ofAppEGLWindow: setupOpenGL(): peripheral setup complete
[notice ] ofAppEGLWindow: runAppViaInfiniteLoop(): entering infinite loop
[notice ] ofAppEGLWindow: setWindowTitle(): not implemented
[notice ] ofAppEGLWindow: runAppViaInfiniteLoop(): setting up notifications complete
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid
[ error ] ofAppEGLWindow: destroySurface(): attempted to destroy uninitialized window

So, anyone else still trying with this board? Ill keep looking into how to create a native window for SGX, there has to be something in the SDK about it. Been trying all weekend and I got so close!

For the interested, heres some poorly fleshed out notes that I wrote to keep track of what i did. i can add info if anyone wants it.
install RCN's 12.10 image:
tar xf ubuntu-12.10-console-armhf-2013-09-26.tar.xz
cd ubuntu-12.10-console-armhf-2013-09-26
sudo ./ --mmc /dev/sdd --uboot beagle_xm
sudo sync

copy GFX_4.0*_libs.tar.gz to home dir
edit on boot partition uEnv.txt:
uncomment/modify lines 7-9:


save, eject, put in beagleboard-xm, power on

sudo apt-get update && sudo apt-get upgrade

install sgx sdk header files

add pkg-config files 
1 Like

there’s probably an specific api for this card to open a gl context without creating an x11 window, you’ll need to find out what that is from any examples that probably come with the drivers, and modify eglWindow to use that instead of the rpi specific api

I did a bunch of work trying to get the SGX drivers installed on the BBB a while back. There was a long discussion here:

You may or may not find helpful info in there. :slight_smile:

Good luck!

I’ve got the full SDK package and i’m looking through trying to find an example to work from. It looked like they are just using eglCreateContext. When I tried to run the example initially, I did so from within an LXTerm window, in LXDE. I just tried running it from a regular terminal and I get a non-responsive white screen! After killing the process via remote ssh, I looked at the output and it seems like it is successfully creating the context, but now failing on attaching keyboard events. I’ll be able to post the output later tonight, and hopefully I can figure out the keyboard stuff.

This seems very promising!

here is the output when i run from the command line:

ubuntu@arm:~/openFrameworks/examples/graphics/graphicsExample$ make RunRelease
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa gtk+-2.0 libmpg123 glesv1_cm glesv2 egl 
[ error ] ofAppEGLWindow: createEGLWindow(): no native window type for this system, perhaps try X11?
[warning] ofAppEGLWindow: getNativeDisplay(): window not initialized, returning NULL
[warning] ofAppEGLWindow: getNativeDisplay(): window not initialized, returning NULL
[notice ] ofAppEGLWindow: createSurface(): setting up EGL Display
[notice ] ofAppEGLWindow: createSurface(): EGL Display correctly set
[notice ] ofAppEGLWindow: createSurface(): current renderer type: GL
[notice ] ofAppEGLWindow: createSurface(): default renderer detected
[notice ] ofAppEGLWindow: createSurface(): surface created correctly
[notice ] ofAppEGLWindow: createSurface(): API bound correctly
[notice ] ofAppEGLWindow: createSurface(): -----EGL-----
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION_MAJOR = 1
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION_MINOR = 4
[notice ] ofAppEGLWindow: createSurface(): EGL_CLIENT_APIS = OpenGL_ES 
[notice ] ofAppEGLWindow: createSurface(): EGL_VENDOR = Imagination Technologies
[notice ] ofAppEGLWindow: createSurface(): EGL_VERSION = 1.4 build 1.9@2188537
[notice ] ofAppEGLWindow: createSurface(): EGL_EXTENSIONS = EGL_IMG_client_api_ogl EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap 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 
[notice ] ofAppEGLWindow: createSurface(): GL_RENDERER = PowerVR SGX 530
[notice ] ofAppEGLWindow: createSurface(): GL_VERSION  = OpenGL ES-CM 1.1
[notice ] ofAppEGLWindow: createSurface(): GL_VENDOR   = Imagination Technologies
[notice ] ofAppEGLWindow: createSurface(): -------------
[ error ] ofAppEGLWindow: setupOpenGL(): screen creation failed, window not inited
[notice ] ofAppEGLWindow: setupPeripherals(): peripheral setup complete
[notice ] ofAppEGLWindow: setupNativeUDev(): created udev object
[notice ] ofAppEGLWindow: setupMouse(): unabled to find mouse
[ error ] ofAppEGLWindow: setupMouse(): did not open mouse
[ error ] ofAppEGLWindow: setupMouse(): did not open mouse, mouse_fd < 0
[warning] ofAppEGLWindow: setupKeyboard(): unabled to find keyboard
[ error ] ofAppEGLWindow: setupKeyboard(): did not open keyboard
[ error ] ofAppEGLWindow: setupKeyboard(): did not open keyboard, keyboard_fd < 0
[notice ] ofAppEGLWindow: setupPeripherals(): native event setup complete
[notice ] ofAppEGLWindow: setupOpenGL(): peripheral setup complete
[notice ] ofAppEGLWindow: runAppViaInfiniteLoop(): entering infinite loop
[notice ] ofAppEGLWindow: setWindowTitle(): not implemented
[notice ] ofAppEGLWindow: runAppViaInfiniteLoop(): setting up notifications complete

I don’t have the time to get this working at the moment but if anyone has an idea about what the points of failure might be, that would be helpful for when I get the chance to dedicate to it. After briefly looking at the ofAppEGLWindow code, i probably need to modify this so be similar in some ways to how the RPi handles the window. not sure about the keyboard & mouse though.

I’ve gotten a white screen to show up with the graphics example with the GLESv1_CM library, but i cant get anything to show up, there is a problem with eglSwapBuffers().

I figured I would rather have GLES2 anyway for shader support, so I have switched to the programmable renderer and GLES2, but there is something wrong during the initialization of OpenGL.

With GLES2, i get:

[notice ] ofAppEGLWindow: createSurface(): GL_RENDERER =
[notice ] ofAppEGLWindow: createSurface(): GL_VERSION =
[notice ] ofAppEGLWindow: createSurface(): GL_VENDOR =

Followed by an error and the program crashes, not even a white screen. Not sure what is going on, There are no errors reported by egl, and it claims to have set everything up properly but obviously it isn’t if the GL info returned is blank.

in the pandaboard only the first library for GL that you link, works, so if you want to use GLES2 you need to edit the makefile and change the link order. the symptoms are the same so it’s probably what’s going on here

Cool thanks arturo. I will try that soon and report back

So that did the trick, or part of the trick at least. I’ve get the white screen back, but nothing is drawn to the screen and there doesn’t appear to be any suspicious errors coming out on the CLI. Well I’m back on track now, I’ll keep digging.


So I’ve worked out what was causing my white screen, i hadn’t properly set the currentWindowRect variable within ofAppEGLWindow. Now it works! I’ve even got the shader example working, just had to make a few small tweaks.

I think im still a long way off from producing code that would be worth submitting as a PR.

I would need to change all of my hacks into proper code using a new #define. I had to disable mouse and keyboard input for now, and I would need to get that working again. as well as a bunch of other things that only half work right now like anything related to setting the dimensions of the “window”

That being said, if anyone else really wants to get their beagle board XM working with OF, I at least have a solid starting point now.

I would like to get OF working on the BeagleBone or BeagleBone Black (I have one of each). I don’t have the xm. I am interested in robotics applications (e.g., ofOpenCV for vision experiments), so mouse and keyboard input may not be needed.

As long as you can get graphics drivers supporting OpenGL ES2 on an armhf linux install running on it in some capacity, you should be able to get OF running in some capacity as well.

In my case the drivers didnt support X11 so I had to hack around that, similar to how it is done for the raspberry pi.

If you have specific questions I would be happy to point you in the right direction.

hi, any new development? I would love to get OF on Beaglebone black too. could you share or detail the hacks you had to use?

First and foremost you need to get an armhf distro with graphics drivers running on the device. Getting the drivers installed is very device specific. I don’t have a BBB, so I can’t help out as much with this aspect.

Once you have that working, the rest of the actual OF specific stuff should be very similar to what I have done and I can help out from there.

My BBB work is on pause at the moment as I’m waiting for an Arduino Tre ( which should work with the same drivers etc. I’ll be able to devote some more time to getting the BBB working when the Tre arrives. My progress is documented in the links above and mostly (as @TimS notes) is contingent on the successful installation of binary graphics drivers blobs alongside the right kernel.

Tim S

I follow your instruction to build OF on my beagleboard till install untar the GFX file , but there is a lot of things I can’t understand the next step to the end what you did.

Would you please show your sample code ,and what’s your modifying in Makefile , and how to change keyboard & mouse settings from enable to disable ?

hello! i need help to install SGX Drivers on my beaglebone with debian 3.8.13,
any help?
thanks for share!

hi @TimS
i have a beaglebone black with debian, i installed the gfx driver.
i need some help to hack OF to init graphics interface without x11 (gfx driver only support FBDEV)
thanks for share!