Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTC Only Hard Crash inside OpenGL

I have been seeing this problem for a while in my application. It shows itself by randomly hardlocking or rebooting HTC phones when they are rendering using OpenGL. Checking the logcat it appears to be a deadlock issue as you will see this printed...

waitForCondition(LockCondition) timed out (identity=9, status=0). CPU may be pegged. trying again. 

The best source for information I have been able to find so far is over here: http://groups.google.com/group/android-developers/browse_thread/thread/d5b7e87f4b42fa8f/d6214ed7a02efc98?q=freeze&lnk=ol&

Where they suggest adding a glFinish at the end of your glSurface's OnDraw function. I am not having great results using this solution (its still crashing but less often). Has anyone else heard about this problem? Encountered any better solutions?

like image 499
TurqMage Avatar asked Mar 08 '11 22:03

TurqMage


1 Answers

We have been getting exactly this problem on our game with HTC Sensation devices and Android 2.3.4 - so we went and bought the device and experimented for a bit. One of the solutions was to call egl.eglWaitGL() at the end of the onDraw() method but that halved the framerate - suprisingly only on that device, but I consodered it a bad solution and kept looking.

The second fix and the one we are using currently which had almost no performance penalty was to stop using glBufferSubData to update our vertex arrays and keep uploading the whole array with glBufferData. If you are using VBO's and glBufferSubData to update them, try changing it.

like image 167
MichalisB Avatar answered Nov 15 '22 08:11

MichalisB