3

I asked a related question recently, but I forgot to ask this question explicitly.

(I want to implement a double-buffer scheme in an Android app using OpenGL ES 2.0, and Android's default scheme seems a little too unpredictable.)

Janin zah
  • 201
  • 2
  • 14

1 Answers1

3

The only way to bypass SurfaceFlinger is to root your device and shut the entire application framework down. You then have to interface with the hardware composer HAL -- simply using the framebuffer dev won't work on all devices.

SurfaceFlinger's behavior is very predictable so long as nothing much else is going on. There's always something else going on, of course, but that's true whether or not you composite through SurfaceFlinger.

As mentioned in another question (possibly yours), GLES on Android is at least double-buffered (eglSwapBuffers()), so there is no need for you to implement anything to get that behavior.

fadden
  • 51,356
  • 5
  • 116
  • 166
  • Yes, you answered my other question to my satisfaction at that time, Mr. Fadden, but I have noticed that even though each rendering process in my test programs is really short (cannot be anywhere near 1/60th of a second), I notice stuttering once in a while. Also, if my memory serves me correctly, you wrote in one of your technical articles that surfaceflinger's behavior may change in the future Androids. Is it guaranteed that double-buffering will stay? – Janin zah Aug 24 '14 at 03:40
  • The best tool for analyzing jankiness is systrace (e.g. http://developer.android.com/tools/debugging/systrace.html ). It may be possible to avoid apparent stutters by changing the render loop; see https://source.android.com/devices/graphics/architecture.html#loops . Double (or triple) buffering is necessary to avoid tearing, so it's not going away. – fadden Aug 24 '14 at 05:53
  • Hi Mr.Fadden. I'm building Android system by myself and i wonder how I can shut down entire application framework ? – DreamInBox May 04 '18 at 02:16
  • 1
    @DreamInBox: `adb shell stop`. FWIW, you should create a new question for things like this, rather than adding a comment to an existing answer. – fadden May 04 '18 at 05:41