Weird crash on Android

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
arf_rinux
Gnoblar
Posts: 5
Joined: Sat Sep 21, 2013 2:45 pm

Weird crash on Android

Post by arf_rinux » Tue Oct 01, 2013 9:16 am

Hi,
I don't know if this is the right place for this post. By the way I would like to share with you what happens very often at my Ogre Test Application.
I have troubles with the power management I think. Basically I have two problems:

PROBLEM 1: If the screen of my phone goes off while loading and initializing the render window, I don't have any scene rendered. Work around at moment: set a longer timeout in my phone power saving options. Has somebody never experienced this behavior? I still don't get if this is a bug in Ogre, in my Android life cycle handling or a bug in the Android itself.

PROBLEM 2: Once my app is properly running and rendering the scene if the screen turns off, because of power saving, if I press the HOME button to turn the screen back on I have the following errors:

Code: Select all

10-01 10:02:14.271: V/ARF_Log(5214): APP_CMD_SAVE_STATE: implement something if needed.
10-01 10:02:14.301: I/ARF_Log(5214): Activity status changed to: APP_CMD_STOP
10-01 10:02:16.196: I/ARF_Log(5214): Activity status changed to: APP_CMD_START
10-01 10:02:16.236: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.236: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.236: E/SurfaceTextureClient(5214): queueBuffer: error queuing buffer to SurfaceTexture, -19
10-01 10:02:16.236: E/MaliEGL(5214): void __egl_platform_queue_buffer(mali_base_ctx_type*, egl_buffer*):851 [EGL-ERROR] unable to queue buffer (0x2e5294)
10-01 10:02:16.236: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.236: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.236: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.236: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.236: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.236: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/MaliEGL(5214): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2dfbd0); err = -19, buf = 0x0
10-01 10:02:16.241: E/OGRE(5214): OGRE EXCEPTION(3:RenderingAPIException): Fail to SwapBuffers in swapBuffers at /AR-Frame/experimental/ogreAndroid/ogre_1.9/RenderSystems/GLES2/src/EGL/OgreEGLWindow.cpp (line 160)
10-01 10:02:16.256: A/libc(5214): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
Does somebody can guess what's going wrong and give me some hints to solve or investigate deeper the issue?

Many thanks in advance.
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Weird crash on Android

Post by c6burns » Wed Oct 02, 2013 5:05 am

For problem 1 you need to hold onto a wakelock to stop the system from sleeping while your app has focus. When you lose focus you unlock. Not sure how to do that through the NDK, but there's plenty of documentation on it in Java.

For problem 2, I have a similar issue when using the OgreJNI. Any time I lose and then regain focus, the surface appears to be invalid and I get an exception calling renderOneFrame:

Code: Select all

E/OGRE    (23930): OGRE EXCEPTION(3:RenderingAPIException): Fail to SwapBuffers in swapBuffers at ..\..\..\RenderSystems\GLES2\src\EGL\OgreEGLWindow.cpp (line 160)
Currently using API 18 / Android 4.3. Admittedly I am new to both android and opengl development, but I've been trying to get to the bottom of this myself. If I find anything I'll surely let you know, and if anyone has any insight at all then it'd be much appreciated.
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Weird crash on Android

Post by c6burns » Wed Oct 02, 2013 3:35 pm

OK, I isolated the issue a bit. If I target NDK platform 14 then I get the exception. If I target NDK platform 9 (-DANDROID_NATIVE_API_LEVEL=9) then I don't have this issue. I don't actually need anything from api level 14 so this is not a problem for me. Hopefully this helps you as well.

Also I see masterfalcon commited a fix for the android build 2 days ago, which resolves the issue of defines in GLES2 when not building GLES3. So you should be able to move up to v1-9 head and build without any tinkering. Thanks for that!
0 x

arf_rinux
Gnoblar
Posts: 5
Joined: Sat Sep 21, 2013 2:45 pm

Re: Weird crash on Android

Post by arf_rinux » Thu Oct 03, 2013 10:42 am

I've alreay cofigured using -DANDROID_NATIVE_API_LEVEL=9 and I just did yesterday an hg pull and hg update and rebuild of ogre v1.9. But nothing chaged.
I still have the same problems.
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Weird crash on Android

Post by c6burns » Thu Oct 03, 2013 2:11 pm

Does the OgreJNI sample do the same thing on your device? Just a thought that if that works you could isolate from there, and if not you could always file an issue in JIRA with all your specifics.

EDIT: Oh wait, not sure why I assumed you are even using JNI. If you are using a native activity then make sure the samplebrowser or one of the other native examples works, as a sanity check.
0 x

yvesa
Gnoblar
Posts: 10
Joined: Tue Oct 15, 2013 5:18 pm

Re: Weird crash on Android

Post by yvesa » Wed Oct 16, 2013 10:37 am

Hello,
I am using JNI and I am also getting the swap buffer crashes (tested on Samsung Galaxy Tab2) . Have you resolved the issue?

Thanks
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Weird crash on Android

Post by c6burns » Wed Oct 16, 2013 4:18 pm

I was able to resolve it, but I'm still not sure why. I'm using the newest precompiled dependencies (27_08_2013), NDK r8c, and v1-9 head. When I targetted NDK api other than 9 I encountered the issue. I tried v1-9RC1 also, so perhaps the issue lies with my NDK version or those dependencies. Tested on Galaxy Nexus, Nexus 7, Nexus 4, and OUYA.
0 x

RigoCL
Greenskin
Posts: 114
Joined: Mon Oct 14, 2013 1:41 am
Location: Chile

Re: Weird crash on Android

Post by RigoCL » Sun Oct 27, 2013 11:17 pm

I'm posting just to mention that am using similar versions as mentioned by c6burns (AndroidDependencies_27_08_2013, android-ndk-r9, and Ogre SVN v1-9-0RC2) and I don't have the second problem of crashing when the screen turns off, am using Samsung Galaxy S III.

But I do have the first problem of the application quitting when hitting the HOME button to wake up the device after turning off the screen for power saving, though this is just the first time I run the app, because after quitting and trying to reload it, the app seems to reload faster, before the screen turning off. I haven't been able to prevent this so far now... keep on surfing inet...
0 x

Lavitanova
Gnoblar
Posts: 1
Joined: Thu Dec 05, 2013 12:49 pm

Re: Weird crash on Android

Post by Lavitanova » Wed Dec 11, 2013 1:28 pm

You will update system now :?
0 x

Post Reply