glshim


Update: I managed to run some of the OpenGL software on Mali400 GPU using glshim, but it's far from perferct. Notably, darkplaces engine segfaults:

(gdb) r
Starting program: /usr/games/darkplaces
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Game is DarkPlaces-Quake using base gamedir id1
DarkPlaces-Quake Linux 10:23:04 Oct 12 2012 0~20110628+svn11619-3 Debian
Current nice level is below the soft limit - cannot use niceness
WARNING: base gamedir id1/ not found!
Playing shareware version.
Skeletal animation uses generic code path (SSE not compiled in)
DPSOFTRAST not available (SSE2 not compiled in)
Failed to init SDL joystick subsystem:
couldn't exec quake.rc
couldn't exec default.cfg
couldn't exec config.cfg
couldn't exec autoexec.cfg
Client using an automatically assigned port
Client opened a socket on address 0.0.0.0:0
Linked against SDL version 1.2.15
Using SDL library version 1.2.15
libGL:loaded: libGLESv1_CM.so
libGL:loaded: libEGL.so
libGL: built on Aug 10 2015 19:37:50
[New Thread 0xb5528410 (LWP 3088)]
[New Thread 0xb4d28410 (LWP 3089)]
[New Thread 0xb4528410 (LWP 3090)]
GL_VENDOR: ARM
GL_RENDERER: Mali-400 MP
GL_VERSION: 1.4 glshim wrapper
glXGetProcAddress: glMultiTexCoord1fARB not found.
glXGetProcAddress: glMultiTexCoord3fARB not found.
glXGetProcAddress: glStencilOpSeparate not found.
glXGetProcAddress: glStencilFuncSeparate not found.
glXGetProcAddress: glBlendEquationEXT not found.
glXGetProcAddress: glDrawRangeElements not found.
Video Mode: fullscreen 640x480x32x0.00hz
glActiveTexture: texture > GL_TEXTURE_MAX
glClientActiveTexture: texture > GL_TEXTURE_MAX
glActiveTexture: texture > GL_TEXTURE_MAX
glClientActiveTexture: texture > GL_TEXTURE_MAX
glActiveTexture: texture > GL_TEXTURE_MAX
glClientActiveTexture: texture > GL_TEXTURE_MAX
warning: invoking glX stub

Program received signal SIGSEGV, Segmentation fault.
0xb68ecf94 in memcpy () from /lib/arm-linux-gnueabihf/libc.so.6
(gdb) bt
#0 0xb68ecf94 in memcpy () from /lib/arm-linux-gnueabihf/libc.so.6
#1 0xb5585886 in _gles_fb_tex_image_2d () from /usr/lib/mali/libGLESv1_CM.so
#2 0xb556d586 in _gles_tex_image_2d_internal ()
from /usr/lib/mali/libGLESv1_CM.so
#3 0xb556d69c in _gles_tex_image_2d () from /usr/lib/mali/libGLESv1_CM.so
#4 0xb5578570 in _gles1_tex_image_2d () from /usr/lib/mali/libGLESv1_CM.so
#5 0xb556bd64 in glTexImage2D () from /usr/lib/mali/libGLESv1_CM.so
#6 0xb57255a8 in glTexImage2D (target=<optimized out>, level=0,
internalformat=<optimized out>, width=1024, height=512, border=0,
format=6408, type=5121, data=0x2)
at /root/opengl/glshim/src/gl/texture.c:179
#7 0xb572ce26 in render_raster () at /root/opengl/glshim/src/gl/raster.c:231
#8 0xb57823e4 in glXSwapBuffers (dpy=0x183f3e0, drawable=<optimized out>)
at /root/opengl/glshim/src/glx/glx.c:504
#9 0xb6b548a6 in ?? () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
#10 0xb6b548a6 in ?? () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

openarena starts, but has several visual issues:

image.jpg
 
Last edited by a moderator:
This is on the unstable branch right?


#6 0xb57255a8 in glTexImage2D (target=<optimized out>, level=0,
internalformat=<optimized out>, width=1024, height=512, border=0,
format=6408, type=5121, data=0x2)
The pointer to data is wrong here (there's no way 0x02 is a valid memory address). Not sure why the raster buffer got set to that. Might be memory corruption, or I failed to initialize memory properly. Any way you can run this with valgrind or asan?


texture > GL_TEXTURE_MAX

In src/config.h, set MAX_TEX to 32 or something and rebuild.
 
Last edited by a moderator:
Thanks for the suggestions, I will try out and report back. Meanwhile, I have another question: why is the SONAME of your library set to libGL.so.1.2.0 and not to libGL.so.1? This goes unnoticed on Pandora where all OpenGL apps are linked against glshim and thus import the correct SONAME, but regular Debian packages are build against libGL.so.1 and won't work with glshim out of the box. See this topic for details.

PS: yes, I'm on the unstable branch.
 
Last edited by a moderator:
For the address at 0x02 maybe it's using MapBuffers functions ? (it's running on my side)
 
Last edited by a moderator:
For the address at 0x02 maybe it's using MapBuffers functions ? (it's running on my side)
Well no the address of 0x02 is the raster target which should only be the output of malloc(). Feels like memory corruption.
 
Hi all,

Hopefully this is the right place to post this issue as the relevant github project page doesn't have issues enabled.

I've built and run the original Glest game, v3.2.2 using ptitSeb's glshim on my Odroid C1. The menus are being rendered perfectly well but the game segfaults upon starting a scenario:


Couldn't process event: Error creating texture 3D

Program received signal SIGSEGV, Segmentation fault.
0xb6e160b4 in glTexSubImage2D (target=<optimized out>, level=0, xoffset=0,
yoffset=0, width=64, height=64, format=6406, type=5121, data=0x6677b38)
at /tmp/glshim-master/src/gl/texture.c:628
628 /tmp/glshim-master/src/gl/texture.c: No such file or directory.
(gdb) bt
#0 0xb6e160b4 in glTexSubImage2D (target=<optimized out>, level=0,
xoffset=0, yoffset=0, width=64, height=64, format=6406, type=5121,
data=0x6677b38) at /tmp/glshim-master/src/gl/texture.c:628
#1 0x0002a9d4 in ?? ()
#2 0x0001f3d0 in ?? ()
#3 0x000373a8 in ?? ()
#4 0x00038db6 in ?? ()
What say ye, oh masters of all things GLES? ;)
 
It seems it want to create a Texture3D, which are not really supported (I got the same issue with MegaGlest). You have to disable the use of texture3d to go farther (but you have issu with depth reading farther in the game, for mouse selection).
 
It makes no difference whatsoever on my box (maybe it does in megaglest).

Btw, judging by my experience with MegaGlest on an old x86 OpenGL 1.4 system surely it's too heavy for these arm gles SBC's?  
 
Last edited by a moderator:
One last question, I've tried FreeOrion 0.4.5 recently and it's running surprisingly well but there are a few visual glitches that make it rather impractical to play. You're probably well aware of those but maybe some workarounds could be suggested?  
 
Last edited by a moderator:
One last question, I've tried FreeOrion 0.4.5 recently and it's running surprisingly well but there are a few visual glitches that make it rather impractical to play. You're probably well aware of those but maybe some workarounds could be suggested?  
I didn't tried FreeOrion recently. I will try soon and get my feedback here.

MegaGlest, I didn't tried much, because of the depth reading issue. I think some workaround using GL_SELECT result can be done, but I haven't worked on it yet. The speed seemed ok, not stellar, but ok.
 
Great, thx! You might wish to read my impressions first:

http://forum.odroid.com/viewtopic.php?f=91&t=16054
Screenshots looks very nice! Not sure I understood the graphical issue, but I'll compile on my side, it will be easier for me to debug.

(by the way, you can probably run also TORCS, SpeedDreams (too slow on pandora for now), and FS2Open with latest glshim, and The Secret Chronycle of Dr. M., even VDrift, but you have to grab an old version without mandatory shader).
 
Last edited by a moderator:
Thanks for the suggestions, I'll do some more testing.

From your list I tried the latest torcs 2 days ago but my own build of torcs+plib manages to segfault at startup (even using mesa) and only gets egl context @16bpp. I'm stumped as I remember seeing the previous version (from ubuntu) working in mesa.
 
Can you file a bug against lunixbochs/glshim for the FreeOrion segfault with a stacktrace?
 
Last edited by a moderator:
lunixbochs/glshim scores!

It's able to run TSC 2.0.0 (The Secret Chronycle of Dr. M.) whereas ptitSeb/glshim dies with a segfault on startup:


gdb -x /home/odroid/gdbinit -batch ./tsc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
LIBGL: Initialising glshim
[New Thread 0xb19a9450 (LWP 8499)]
[Thread 0xb19a9450 (LWP 8499) exited]
libGL egl backend: libEGL.so
libGL: built on Sep 14 2015 20:41:25
LIBGL: Current folder is:/media/odroid/78456063-ca3b-48c5-8b43-106bcfc3e27a/TSC-2.0.0/tsc
[New Thread 0xb19a9450 (LWP 8500)]
[New Thread 0xb58b8450 (LWP 8501)]
libGL backend: libGLES_CM.so
libGL: warning, gles_glBlendFuncSeparate is NULL
glX stub: glCopyTexSubImage3D
glXGetProcAddress: glBlendColor not found.
glX stub: glFogCoordPointer
glXGetProcAddress: glMultiDrawArrays not found.
glXGetProcAddress: glMultiDrawElements not found.
glXGetProcAddress: glPointParameteri not found.
glXGetProcAddress: glPointParameteriv not found.
glXGetProcAddress: glBeginQuery not found.
glXGetProcAddress: glDeleteQueries not found.
glXGetProcAddress: glEndQuery not found.
glXGetProcAddress: glGenQueries not found.
glXGetProcAddress: glGetQueryObjectiv not found.
glXGetProcAddress: glGetQueryObjectuiv not found.
glXGetProcAddress: glGetQueryiv not found.
glXGetProcAddress: glIsQuery not found.
glX stub: glDrawBuffersARB
glX stub: glEdgeFlagPointerEXT
glX stub: glIndexPointerEXT
glX stub: glXCreatePbuffer
glX stub: glXCreatePixmap
glX stub: glXDestroyPbuffer
glX stub: glXDestroyPixmap
glX stub: glXGetCurrentReadDrawable
glX stub: glXGetSelectedEvent
glX stub: glXSelectEvent
[New Thread 0xb4a70450 (LWP 8502)]
libGL: warning, gles_glBlendFuncSeparate is NULL

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
#0 0x00000000 in ?? ()
#1 0x003045fa in CEGUI::OpenGLRenderer::beginRendering (this=0x5b2e70) at CEGUIOpenGLRenderer.cpp:367
#2 0x0032511c in CEGUI::System::renderGUI (this=0x5c98b8) at CEGUISystem.cpp:396
#3 0x00252404 in TSC::Loading_Screen_Draw() ()
#4 0x00252364 in TSC::Loading_Screen_Draw_Text(std::string const&) ()
#5 0x001f42c6 in TSC::preload_Images(bool) ()
#6 0x001e1760 in TSC::Init_Game() ()
#7 0x001e0de4 in main ()   
Here's eglinfo from Odroid C1/Mali 

https://gist.github.com/petevine/c681e8613da9c4bb205c
 
Last edited by a moderator:
lunixbochs/glshim scores!


It's able to run TSC 2.0.0 (The Secret Chronycle of Dr. M.) whereas ptitSeb/glshim dies with a segfault on startup:

gdb -x /home/odroid/gdbinit -batch ./tsc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
LIBGL: Initialising glshim
[New Thread 0xb19a9450 (LWP 8499)]
[Thread 0xb19a9450 (LWP 8499) exited]
libGL egl backend: libEGL.so
libGL: built on Sep 14 2015 20:41:25
LIBGL: Current folder is:/media/odroid/78456063-ca3b-48c5-8b43-106bcfc3e27a/TSC-2.0.0/tsc
[New Thread 0xb19a9450 (LWP 8500)]
[New Thread 0xb58b8450 (LWP 8501)]
libGL backend: libGLES_CM.so
libGL: warning, gles_glBlendFuncSeparate is NULL
glX stub: glCopyTexSubImage3D
glXGetProcAddress: glBlendColor not found.
glX stub: glFogCoordPointer
glXGetProcAddress: glMultiDrawArrays not found.
glXGetProcAddress: glMultiDrawElements not found.
glXGetProcAddress: glPointParameteri not found.
glXGetProcAddress: glPointParameteriv not found.
glXGetProcAddress: glBeginQuery not found.
glXGetProcAddress: glDeleteQueries not found.
glXGetProcAddress: glEndQuery not found.
glXGetProcAddress: glGenQueries not found.
glXGetProcAddress: glGetQueryObjectiv not found.
glXGetProcAddress: glGetQueryObjectuiv not found.
glXGetProcAddress: glGetQueryiv not found.
glXGetProcAddress: glIsQuery not found.
glX stub: glDrawBuffersARB
glX stub: glEdgeFlagPointerEXT
glX stub: glIndexPointerEXT
glX stub: glXCreatePbuffer
glX stub: glXCreatePixmap
glX stub: glXDestroyPbuffer
glX stub: glXDestroyPixmap
glX stub: glXGetCurrentReadDrawable
glX stub: glXGetSelectedEvent
glX stub: glXSelectEvent
[New Thread 0xb4a70450 (LWP 8502)]
libGL: warning, gles_glBlendFuncSeparate is NULL

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
#0 0x00000000 in ?? ()
#1 0x003045fa in CEGUI::OpenGLRenderer::beginRendering (this=0x5b2e70) at CEGUIOpenGLRenderer.cpp:367
#2 0x0032511c in CEGUI::System::renderGUI (this=0x5c98b8) at CEGUISystem.cpp:396
#3 0x00252404 in TSC::Loading_Screen_Draw() ()
#4 0x00252364 in TSC::Loading_Screen_Draw_Text(std::string const&) ()
#5 0x001f42c6 in TSC::preload_Images(bool) ()
#6 0x001e1760 in TSC::Init_Game() ()
#7 0x001e0de4 in main ()   
Oh, there is no glBlendFuncSeparate in your gles driver. That is certainly an issue for TSC (and other). In gl.c, around line 119, you should comment "GL_EXT_blend_func_separate " to not expose that function.

*EDIT* in fact, you should check with eglinfo what is supported and maybe remove also "GL_EXT_blend_equation_separate " if you don't see GL_OES_blend_equation_separate and "GL_EXT_blend_subtract " if you don't see GL_OES_blend_subtract, as dynamic detection is not implemented for now.
 
Last edited by a moderator:
Both functions were missing from the list so after recompiling the game seems to be working perfectly. Thx!

BTW, why not move bc_cat.h into the in-tree include directory? This would solve the missing include problem for linux newbies.
 
Last edited by a moderator:
Any news on the FreeOrion front, guys? Is it hopeless or should it be possible to ever play it using glshim?
 
Any news on the FreeOrion front, guys? Is it hopeless or should it be possible to ever play it using glshim?
I'm still compiling it... It takes times to compile on the pandora (and I'm doing other things too). It's almost ready...

BTW, why not move bc_cat.h into the in-tree include directory? This would solve the missing include problem for linux newbies.
Yeah, I have to fix that...
 
I'm still compiling it...
I'd have never guessed...
Is it even possible without huge amounts of swap and a whole day to spare? Those 15.04 ubuntu binaries are not usable on pandora I take it?
 
Last edited by a moderator:
Back
Top