-
Notifications
You must be signed in to change notification settings - Fork 178
Crash in native code #52
Comments
The same crash with adreno chipset and kitkat was reported earlier today (via mail). The user found that GL.glDrawElements(GL20.GL_LINES ... ) in ExtrusionRenderer triggers the problem. I havent looked further into it yet, though google:'adreno kitkat rb_memcpy' shows the issue also happens elsewhere. |
Just dumping info here for what it's worth: https://gist.github.com/baldur/9652381 it's a bit strange the map loads fine but as soon as you start interact with it it eventually will crash and it's almost always shortly after a GC run. I have tried fiddling with some of the code including the line you mentioned and I am not convinced it's the same issue. I've been unable to attach a gdb debugger due various issues http://developer.samsung.com/forum/thread/ndk-debugging-with-gdb/77/178834 being one of them. I am sort of running out of ideas and if you have any advice on how I can help with debugging this further please let me know ... thankfully we do have devices still with 4.3 so we are not pressed for time but I can definitely spend a bit more time if you have ideas for what would be good to experiment with in order to identify the culprit. |
There were some reports for Unity providing similar traces. So I'm pretty sure it's a bug in the driver - or in Android memory management. One way to test if it is caused by buffer data is being garbage collected before moved to GL memory would be to comment out 'mUsedBuffers = releaseAll(mUsedBuffers);' in MapRenderer. If thats the case one could ensure to keep references to the Buffer objects and not reuse them until the corresponding VBOs are drawn once. |
Could you try changing GL_DYNAMIC_DRAW in BufferObject to GL_STATIC_DRAW? It might use a different path in the driver and circumvent the problem. |
Tried both of those to no avail ... everything points to the problem with the driver as you mentioned. Next step I am planning on is to root the device and reset some of the settings as is suggested here https://developer.qualcomm.com/forum/qdevnet-forums/mobile-technologies/mobile-gaming-graphics-optimization-adreno/26936. This mentions opengl 3 so I am not sure if it applies to our situation but it's worth a shot. The post does mention another workaround which I didn't quite understand but perhaps you understand what he means by:
|
I just had reported the same via email and then I found it here ;-) |
Not sure if what they talk here can be applied (was about buffers...) |
If you could check the ant traces file one might see if the crash is triggered by a rendering call from the same renderer - One reporter told me that it happens in ExtrusionRenderer but he didnt replied back to confirm that it's the only place. In this case one could disable 3D buildings for blacklisted drivers... |
Just for the record I can crash without the building layer added ... so I am not sure if that approach will suffice. |
Also blacklisting two of the most popular GPUs doesn't feel like a great On Mon, Apr 14, 2014 at 11:38 AM, Baldur Gudbjornsson <
|
Could you send the crash details to qualcomm? - It seems one can get direct feedback on their forum with such issues: |
Any way to use opengl 3 on these devices? Read this fixed it in other apps. |
@stleusc where did you find that? |
I don't remember :-( |
I guess it wouldn't - If it were possible to enable gles3. For the driver it should make no difference as gles2 is a strict subset of the gles3 api - but from what I've read about adreno drivers[1] I wouldnt count on should :) [1] https://dolphin-emu.org/blog/2013/09/26/dolphin-emulator-and-opengl-drivers-hall-fameshame/ |
well according to this: http://developer.android.com/guide/topics/graphics/opengl.html |
might be worth a try, maybe it really switches the complete driver .so... In org.oscim.android.gl.GLView() add:
|
I had problems compiling your code sample but I set the clientVersion directly to 3 and also changed all the constants in AndroidGL to use GLES30 in lua of GLE20 but I still get crashes. libGLESv2 seems to suggest that the driver for v2 is still being used so I wonder if this is not enough to get it to use gles3. Do you know what I can call in the running app to verify that I have successfully set it to use gles3?
|
If there is no /system/vendor/lib/egl/libGLESv3_adreno.so it is probably the correct library. What was the problem with the code above? It's the recommended way to query the gl version at http://developer.android.com/guide/topics/graphics/opengl.html - when the first call to eglCreateContext does return a context then you have a gles3 context. Maybe we can figure out if one specific vtm renderer triggers the crash - There are not many uses of glDrawElements. Have you tried to turn off LabelLayer and BuildingLayer? Thinking about it I suspect LineTexLayer.Renderer.draw() is the one - just comment out the body to check. I could write a simpler version if that one makes trouble :) |
must remain in draw() though ... |
I have previously tried pulling out both building and label layer ... and now I tried emptying out the body of the draw method and still having failures. |
So if there is no call to glDrawElements done by vtm anymore (all the other renderers use glDrawArrays) then glDrawElements may only be called by the Android UI or compositor, i.e. after a gl context switch.. stilll I would like to find out which vtm renderer is involved with it: could you disable draw() in LineLayer and PolygonLayer the same way? |
@hjanetzek we have made some progress here and have identified the culprit: By commenting out that GL.glDrawElements we have a running app that doesn't crash ... we found this by looking at which shaders where affected and the app also runs by making main methods in this shader blank:
We don't know yet how to fix it but we wanted to give you an update to see if you had thoughts in the light of this discovery. |
When an attribute is not used in the shader it will be optimized out and GL.glGetAttribLocation will return an invalid handle (< 0) So glDrawElements will probably fail before even fetching data from the vbo (fail in the usual GL way - just show nothing). |
Awesome thanks so much, this patch appears to be working. Looks like the icons for pois are missing though. |
Good to hear that this works. I've added no-vbo option to SymbolLayer now: bdc63d8 actually squashed the SymbolLayer change again and added useVBO option to ElementLayers for putting vertex data into a separate buffer. This only works when ElementLayers contains only TextureLayers though. |
Awesome ... poi's are back and the map appears to be running smoothly on affected devices. Thanks again for fixing this. |
I also gave the fix to my affected users. Great work! |
Merged with a check in MapView to enable the workaround for Samsung devices running Kitkat - If you have the exact models for the affected devices this test could be made more specific, but I guess devices running Kitkat are fast enough to have no measurable performance difference using no VBO in this case. |
Thanks! We know the S4 (Adreno 320) and S5 (Adreno 330) devices are On Mon, May 12, 2014 at 9:12 AM, Hannes Janetzek
|
I could reproduce the crash with a S5 now. It seems the problem is actually the use of glBufferSubData (which seems to have realiably issues with adreno). Just disabling glBufferSubData makes it work for me. The crash probably shows up in text renderer because its vertex data is most frequently replaced. So I guess a more appropriate fix would be 9c1ae88 |
@hjanetzek we found another device which has issues Here is a gist from the logcat if that's useful https://gist.github.com/baldur/9dd383bfba1b83bb9593 As before we tryied commenting out the GL.glDrawElements call in: |
It seems to be the same problem. I wasnt pleased with the test for Samsung with Kitkat anyway - now I just found that one can get the vendor/renderer info via glGetString to disable use of glBufferSubData for these chips. Could you try https://github.com/opensciencemap/vtm/tree/testing-adreno |
awesome that did the trick ... thanks |
Hi, |
Hi I just diving in to troubleshoot a crash that started happening after we updated to android 4.4. The devices affected are Samsung Galaxy S4, we have a nexus running 4.4 which doesn't seem to be affected or at least we have not experience the problem there, nore did we with our S4 prior to the 4.4 update.
I figured I would raise the issue here incase someone already knows about this issue or has some insights. I will follow up as I progress in my search.
The text was updated successfully, but these errors were encountered: