Nexus One / Android “CPU may be pegged” bug

前端 未结 5 1655
生来不讨喜
生来不讨喜 2021-02-05 12:36

I\'m writing a graphically intense game for the Nexus One, using the NDK (revision 4) and OpenGL ES 2.0. We\'re really pushing the hardware here, and for the most part it works

相关标签:
5条回答
  • 2021-02-05 13:17

    The waitForCondition() causes the lockup (system-freeze).
    But it is not the root-cause. This seems to be a issue with

    The audio-framework (ur game has sounds?)
    -or-
    The GL rendering-subsystem.

    Any "CPU-pegged" messages in the log? You might want to take a look at this:
    http://soledadpenades.com/2009/08/25/is-the-cpu-pegged-and-friends/

    0 讨论(0)
  • 2021-02-05 13:20

    I don't believe such error can occur in audio code, SharedBufferStack is only used in Surface libraries. Most probably this is a bug in EGL swapBuffers or SurfaceFlinger implementation, and you should file it to the bug tracker.

    0 讨论(0)
  • 2021-02-05 13:26

    FWIW, I hit this issue recently while developing on Android 2.3.4 using GL ES 2 on a Samsung Galaxy S.

    The issue for me was a bug in my glDrawArrays call - I was rendering past the end of the buffer, i.e. the "count" I was passing in was greater than the actual count. Interestingly, that call did not throw an exception, but it would intermittently result in the issue you described. Also, the buffer I ended up rendering looked wrong so I knew something was off. The "CPU may be pegged" thing just made it more annoying to track down the real issue.

    0 讨论(0)
  • 2021-02-05 13:33

    I got CPU may be pegged messages on LogCat because I had a ArrayBlockingQueue in my code. If you have any blocking queue (as seems to be the case with audio buffers), be sure to BlockingQueue.put() only if you have timing control enough to properly BlockingQueue.take() elements to make room for it. Or else, have a look on using BlockingQueue.offer().

    0 讨论(0)
  • 2021-02-05 13:39

    There seems to be a driver problem with eglSwapBuffers():

    http://code.google.com/p/android/issues/detail?id=20833&q=cpu%20may%20be%20pegged&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

    One workaround is to call glFinish() preceding your call to eglSwapBuffers(), however this will induce a performance hit.

    0 讨论(0)
提交回复
热议问题