glshim


Better! But still not working:

Code:
pi@raspberrypi ~/glshim $ cmake . -DBCMHOST=1; make GL
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/glshim
Scanning dependencies of target GL
[  4%] Building C object src/CMakeFiles/GL.dir/gl/array.c.o
In file included from /home/pi/glshim/src/gl/array.h:1:0,
                 from /home/pi/glshim/src/gl/array.c:1:
/home/pi/glshim/src/gl/gl.h:35:93: warning: ‘struct EGLClientPixmapHI’ declared inside parameter list [enabled by default]
/home/pi/glshim/src/gl/gl.h:35:93: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
/home/pi/glshim/src/gl/gl.h:36:23: error: expected declaration specifiers or ‘...’ before ‘*’ token
/home/pi/glshim/src/gl/gl.h:37:23: error: expected declaration specifiers or ‘...’ before ‘*’ token
/home/pi/glshim/src/gl/gl.h:38:95: error: unknown type name ‘EGLStreamKHR’
/home/pi/glshim/src/gl/gl.h:43:63: error: unknown type name ‘EGLStreamKHR’
/home/pi/glshim/src/gl/gl.h:54:37: error: expected declaration specifiers or ‘...’ before ‘*’ token
/home/pi/glshim/src/gl/gl.h:61:61: error: unknown type name ‘EGLStreamKHR’
/home/pi/glshim/src/gl/gl.h:62:65: error: unknown type name ‘EGLStreamKHR’
/home/pi/glshim/src/gl/gl.h:68:62: error: unknown type name ‘EGLStreamKHR’
/home/pi/glshim/src/gl/gl.h:69:71: error: unknown type name ‘EGLStreamKHR’
/home/pi/glshim/src/gl/gl.h:70:81: error: unknown type name ‘EGLStreamKHR’
/home/pi/glshim/src/gl/gl.h:71:71: error: unknown type name ‘EGLStreamKHR’
/opt/vc/include/interface/vcos/vcos_timer.h:112:6: warning: inline function ‘vcos_timer_delete’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_timer.h:109:6: warning: inline function ‘vcos_timer_reset’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_timer.h:102:6: warning: inline function ‘vcos_timer_cancel’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_timer.h:95:6: warning: inline function ‘vcos_timer_set’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_timer.h:80:15: warning: inline function ‘vcos_timer_create’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:269:6: warning: inline function ‘vcos_thread_resume’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:262:5: warning: inline function ‘vcos_thread_running’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:251:15: warning: inline function ‘vcos_change_preemption’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:234:6: warning: inline function ‘vcos_thread_relinquish’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:186:15: warning: inline function ‘vcos_thread_get_affinity’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_timer.h:112:6: warning: inline function ‘vcos_timer_delete’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_timer.h:109:6: warning: inline function ‘vcos_timer_reset’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_timer.h:102:6: warning: inline function ‘vcos_timer_cancel’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_timer.h:95:6: warning: inline function ‘vcos_timer_set’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_timer.h:80:15: warning: inline function ‘vcos_timer_create’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:269:6: warning: inline function ‘vcos_thread_resume’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:262:5: warning: inline function ‘vcos_thread_running’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:251:15: warning: inline function ‘vcos_change_preemption’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:234:6: warning: inline function ‘vcos_thread_relinquish’ declared but never defined [enabled by default]
/opt/vc/include/interface/vcos/vcos_thread.h:186:15: warning: inline function ‘vcos_thread_get_affinity’ declared but never defined [enabled by default]
src/CMakeFiles/GL.dir/build.make:54: recipe for target 'src/CMakeFiles/GL.dir/gl/array.c.o' failed
make[3]: *** [src/CMakeFiles/GL.dir/gl/array.c.o] Error 1
CMakeFiles/Makefile2:79: recipe for target 'src/CMakeFiles/GL.dir/all' failed
make[2]: *** [src/CMakeFiles/GL.dir/all] Error 2
CMakeFiles/Makefile2:91: recipe for target 'src/CMakeFiles/GL.dir/rule' failed
make[1]: *** [src/CMakeFiles/GL.dir/rule] Error 2
Makefile:106: recipe for target 'GL' failed
make: *** [GL] Error 2
 
The current unstable branch of glshim is capable of rendering OpenGL in the public release of Exagear (as well as QEMU).

  1. On a 32-bit x86 machine, build the unstable glshim branch (`cmake .; make`), then copy lib/libGL.so.1 to /usr/local/lib in your Exagear chroot (somewhere in /opt/exagear/images).
  2. On your ARM machine, build libgl_remote from the unstable glshim branch (`cmake .; make remote`), then copy bin/libgl_remote to /usr/local/bin.
  3. Add libgl_remote to /opt/exagear/images/ubuntu-1204lts/.exagear/opaths-list like this: "/usr/local/bin/libgl_remote=/usr/local/bin/libgl_remote"
    3.1. `sudo touch /opt/exagear/images/ubuntu-1204lts/usr/local/bin/libgl_remote`
    3.2. Make sure --opaths-list is in your exagear command line (look at the bottom of /usr/bin/exagear).
  4. Run an OpenGL program in Exagear with environment variables like so: `LIBGL_REMOTE=1 ./path/to/exe`. If it doesn't work on your device, try any combination of LIBGL_FB=1 and LIBGL_X11_REOPEN=1.
You'll want to do this over SSH as you might need to hard kill one of the sides when you quit. I'm working on making it more stable.

I've tested this with Stepmania, glxgears, and Unreal Tournament 1. I'll probably do a video tonight, though I need to work on performance a bit.

Edit: Exagear just got back to me about running native programs, updated the steps. Here are the old steps if you need them:

  1. Run an OpenGL program in Exagear with environment variables like so: `LIBGL_REMOTE=1 LIBGL_REMOTE_NOSPAWN=1 ./path/to/exe`
  2. Look in the output for `libGL: shm_name='/glshim.0'`, and copy the `/glshim.0` part.
  3. On the ARM side, run `libgl_remote /glshim.0`.
 
Last edited by a moderator:
The future is here, folks. Time for me to set up Exagear on my Pandora. Thank you for all your work on this.
 
Last edited by a moderator:
What about Pandora?
Umm yeah this IS posted in the Pandora section. However there still not an easy install process on the Pandora for Exagear Desktop and there still may be issues with audio.
 
Ah yes... I forgot about that. Oh well at least this will be a nice thing to try once we have that.
 
Ooohh yeahh ! Awesome news!  :wub:

@lunixbochs: Will you do a binary release when it's more stable and optimized?
 
I'm not sure if my question is on topic, but there seems to be no other place to ask. I recently bought a Banana pi, and I want to set up  OpenGL on it. I managed to build and install Mali GLES drivers:

root@bananapi ~/opengl/sunxi-mali/test (git)-[master] # ./test
EGL Version: "1.4 Linux-r3p0-04rel0"
EGL Vendor: "ARM"
EGL Extensions: "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_reusable_sync EGL_KHR_fence_sync EGL_KHR_lock_surface EGL_KHR_lock_surface2 "
Surface size: 480x480
GL Vendor: "ARM"
GL Renderer: "Mali-400 MP"
GL Version: "OpenGL ES 2.0"
GL Extensions: "GL_OES_texture_npot GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_depth24 GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 GL_EXT_blend_minmax GL_OES_EGL_image_external GL_OES_EGL_sync GL_EXT_multisampled_render_to_texture GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_EXT_shader_texture_lod "

I also can see the colored triangle, so GLES seems to work fine. However, when I try to run glxgears with recent glshim, I get a segmentation fault:

root@bananapi ~/opengl/glshim/lib (git)-[unstable] # LD_LIBRARY_PATH=. LD_DEBUG=files glxgears
[...]
      5421:    calling init: /usr/lib/mali/libGLESv1_CM.so
      5421:    
      5421:    opening file=/usr/lib/mali/libGLESv1_CM.so [0]; direct_opencount=1
      5421:    
libGL:loaded: libGLESv1_CM.so
      5421:    
      5421:    file=libEGL.so [0];  needed by ./libGL.so.1 [0]
      5421:    opening file=/usr/lib/mali/libGLESv1_CM.so [0]; direct_opencount=2
      5421:    
libGL:loaded: libEGL.so
      5421:    /usr/lib/mali/libGLESv1_CM.so: error: symbol lookup error: undefined symbol: glXChooseVisual (fatal)
libGL: built on Aug  3 2015 23:36:37
      5421:    /usr/lib/mali/libGLESv1_CM.so: error: symbol lookup error: undefined symbol: glXCreateContext (fatal)
[1]    5421 segmentation fault (core dumped)  LD_LIBRARY_PATH=. LD_DEBUG=files glxgears
Does anyone have any advice on how to debug this? What are those symbols (glXChooseVisual and glXCreateContext) I'm missing?
 
The current unstable branch of glshim is capable of rendering OpenGL in the public release of Exagear (as well as QEMU).

  1. On a 32-bit x86 machine, build the unstable glshim branch (`cmake .; make`), then copy lib/libGL.so.1 to /usr/local/lib in your Exagear chroot (somewhere in /opt/exagear/images).
  2. On your ARM machine, build libgl_remote from the unstable glshim branch (`cmake .; make libgl_remote`), then copy bin/libgl_remote to /usr/local/bin.
  3. Add libgl_remote to /opt/exagear/images/ubuntu-1204lts/.exagear/opaths-list like this: "/usr/local/bin/libgl_remote=/usr/local/bin/libgl_remote"
    3.1. `sudo touch /opt/exagear/images/ubuntu-1204lts/usr/local/bin/libgl_remote`


    3.2. Make sure --opaths-list is in your exagear command line (look at the bottom of /usr/bin/exagear).
  4. Run an OpenGL program in Exagear with environment variables like so: `LIBGL_REMOTE=1 ./path/to/exe`. If it doesn't work on your device, try any combination of LIBGL_FB=1 and LIBGL_X11_REOPEN=1.
You'll want to do this over SSH as you might need to hard kill one of the sides when you quit. I'm working on making it more stable.

I've tested this with Stepmania, glxgears, and Unreal Tournament 1. I'll probably do a video tonight, though I need to work on performance a bit.

Edit: Exagear just got back to me about running native programs, updated the steps. Here are the old steps if you need them:

  1. Run an OpenGL program in Exagear with environment variables like so: `LIBGL_REMOTE=1 LIBGL_REMOTE_NOSPAWN=1 ./path/to/exe`
  2. Look in the output for `libGL: shm_name='/glshim.0'`, and copy the `/glshim.0` part.
  3. On the ARM side, run `libgl_remote /glshim.0`.

What does all this mean?
Potential of 3D acceleration for x86 linux and Windows game via WINE.
Will this accelerate DirectX applications or is the OpenGL 1.x exposed by GLshim not enough for that? If so which DX versions?
 
Does anyone have any advice on how to debug this? What are those symbols (glXChooseVisual and glXCreateContext) I'm missing?
Try the LIBGL_FB=1 environment variable. Also, try running it under gdb so we can see where it segfaults, or use LIBGL_STACKTRACE=1 for the builtin segfault handler.
 
Try the LIBGL_FB=1 environment variable. Also, try running it under gdb so we can see where it segfaults, or use LIBGL_STACKTRACE=1 for the builtin segfault handler.
LIBGL_FB and LIBGL_STACKTRACE have had no effect. Running under gdb suggests (as per my limited knowlege) that the segfault comes from bcm_host_init():

root@bananapi ~ # export LD_LIBRARY_PATH=.
root@bananapi ~ # cd opengl/glshim/lib
root@bananapi ~/opengl/glshim/lib (git)-[unstable] # gdb glxgears
GNU gdb (GDB) 7.4.1-debian
Reading symbols from /usr/bin/glxgears...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/glxgears
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
libGL:loaded: libGLESv1_CM.so
libGL:loaded: libEGL.so
libGL: built on Aug 3 2015 23:36:37

Program received signal SIGSEGV, Segmentation fault.
0xb6f0fa8c in bcm_host_init () from ./libGL.so.1
(gdb) bt
#0 0xb6f0fa8c in bcm_host_init () from ./libGL.so.1
#1 0xb6eae3ba in glXCreateContext (dpy=0x13008, vis=<optimized out>,
shareList=<optimized out>, direct=1)
at /root/opengl/glshim/src/glx/glx.c:311
#2 0x0000966a in ?? ()
#3 0x0000966a in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

EDIT: don't mind the stuff, after a git pull and make glxgears started to work.
 
Last edited by a moderator:
Back
Top