gl4es icon indicating copy to clipboard operation
gl4es copied to clipboard

Problems with apitrace trace/replay in non-SDL apps

Open MagaTailor opened this issue 8 years ago • 6 comments

Trying to trace torcs using gl4es fails due to a probable bug in apitrace:

Program received signal SIGSEGV, Segmentation fault.
SnappyOutStream::write (this=0x48b80, buffer=0xbe800013, length=1) at /tmp/apitrace/lib/trace/trace_ostream_snappy.cpp:123
123     /tmp/apitrace/lib/trace/trace_ostream_snappy.cpp: No such file or directory.
(gdb) #0  SnappyOutStream::write (this=0x48b80, buffer=0xbe800013, length=1) at /tmp/apitrace/lib/trace/trace_ostream_snappy.cpp:123
#1  0xb6eb1ffc in trace::Writer::_write (this=<optimized out>, dwBytesToWrite=1, sBuffer=0xbe800013)
    at /tmp/apitrace/lib/trace/trace_writer.cpp:83
#2  trace::Writer::_writeByte (c=0 '\000', this=0xb6fd78a0 <trace::localWriter>) at /tmp/apitrace/lib/trace/trace_writer.cpp:88
#3  trace::Writer::beginEnter (this=this@entry=0xb6fd78a0 <trace::localWriter>, 
    sig=sig@entry=0xb6faa630 <_glXCreateContextAttribsARB_sig>, thread_id=0) at /tmp/apitrace/lib/trace/trace_writer.cpp:174
#4  0xb6eb3534 in trace::LocalWriter::beginEnter (this=this@entry=0xb6fd78a0 <trace::localWriter>, 
    sig=0xb6faa630 <_glXCreateContextAttribsARB_sig>, fake=fake@entry=false) at /tmp/apitrace/lib/trace/trace_writer_local.cpp:191
#5  0xb6e07540 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
 at /tmp/apitrace/build/wrappers/glxtrace.cpp:16531
#6  0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#7  0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#8  0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#9  0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#10 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#11 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#12 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#13 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#14 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606

and so on. Posting here cause apitrace works fine under MESA.

Now, trying to replay a torcs MESA snapshot using gl4es also fails:

 LIBGL: Initialising gl4es
LIBGL: v0.9.2 built on Nov  9 2016 18:32:18
LIBGL:loaded: libGLESv1_CM.so
LIBGL:loaded: libEGL.so
LIBGL: Extension GL_OES_point_sprite detected and used
LIBGL: Extension GL_OES_point_size_array detected
LIBGL: Extension GL_OES_framebuffer_object detected and used
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected
LIBGL: Extension GL_OES_depth_texture detected and used
LIBGL: Max texture size: 4096
LIBGL: Texture Units: 8, Max lights: 8
LIBGL: Implementation Read is GL_RGB/GL_UNSIGNED_SHORT_5_6_5
LIBGL: Current folder is:/home/odroid
glXQueryVersion(0x521900, 0xbef02e30, 0xbef02e34)
glXQuesryExtension(0x521900, 0x516008, 0x51600c)
glXQueryExtensionString(0x521900, 0)
glXChooseFBConfig(0x521900, 0, 0x57d670, 0xbef02d0c)
glXGetVisualFromFBConfig(0x521900, 0xb2ba7ef8)
glXCreateContextAttribsARB(0x521900, 0xb2ba7ef8, (nil), 1) config is RGBA:8888, depth=1, stencil=1, drawable=1
glXCreateWindow(0x521900, 0xb2ba7ef8, 25165826, (nil))
glXMakeCurrent(0x521900, 0x1800002, 0x57d6b8) 'isPBuffer(drawable)=0
LIBGL: ERROR: EGL Error detected: EGL_BAD_MATCH (0x3009)
error: failed to make current OpenGL context and drawable

MagaTailor avatar Nov 09 '16 20:11 MagaTailor

I see it's cycling on a glX call...

Try with this: a001dc33825fa2624a385670ed1c1ce2a113267e I think it should help.

ptitSeb avatar Nov 09 '16 22:11 ptitSeb

On Wed, 09 Nov 2016 14:25:12 -0800 ptitSeb [email protected] wrote:

I see it's cycling on a glX call...

Try with this: a001dc33825fa2624a385670ed1c1ce2a113267e I think it should help.

Hey, well done! Recording torcs has been fixed, hope you can fix replay too :)

MagaTailor avatar Nov 09 '16 23:11 MagaTailor

The replay in torcs works for the menu, but crashes once replay the "in-game" part for me.

ptitSeb avatar Nov 10 '16 12:11 ptitSeb

On Thu, 10 Nov 2016 04:52:03 -0800 ptitSeb [email protected] wrote:

The replay in torcs works for the menu, but crashes once replay the "in-game" part for me.

One has to wonder where the difference's coming from. Any idea if it could be a bug in apitrace? BTW, should I try changing to 24bpp?

MagaTailor avatar Nov 10 '16 14:11 MagaTailor

Well, that trace has been done with gl4es too, not with Mesa, that can help.

ptitSeb avatar Nov 10 '16 14:11 ptitSeb

I played the trace on my regular PC and apitrace crashed at the same point. So the problem is not in the apitrace replay but in the recorded trace itself. I don't know what's wrong, but I assume it's around a framebuffer creation.

ptitSeb avatar Nov 10 '16 22:11 ptitSeb