Forums - Hard lock on Adreno 320 (Nexus 4) when alternating EGL_BUFFER_PRESERVED

4 posts / 0 new
Last post
Hard lock on Adreno 320 (Nexus 4) when alternating EGL_BUFFER_PRESERVED
programmerTim
Join Date: 14 Nov 11
Location: Cambridge, UK
Posts: 3
Posted: Wed, 2013-01-23 10:15

I have been experimenting with ways to obtain a vsync lock at 30hz (or half the display refresh rate). One attempt was to duplicate the last frame rendered by setting swap behaviour to EGL_BUFFER_PRESERVED and adding a duplicate call to eglSwapBuffers, then setting back EGL_BUFFER_DESTROY. Sadly this hard locks the Nexus 4 (see attached log) due to what looks like a failure in the Adreno driver.

Only specifying EGL_BUFFER_PRESERVED once does not cause the driver to fail and appears to preserve the backbuffer correctly, but I would assume this incurs an additional redundant framebuffer copy. I also tested on Adreno 200 (HTC Desire) and similarly, while using only EGL_BUFFER_PRESERVED works correctly, alternating state appears to disable backbuffer preservation for all swaps (though it doesn't hard lock!), The preserve alternating solution works correctly on the Tegra 3 powered Nexus 7 yielding a stable artefact free 30fps.

I'm mainly providing this information so Qualcomm can improve the robustness their drivers, but if anyone happens to know a better way to achieve 30hz vsync I'd love to hear it! Passing 2 to eglSwapInterval would be the ideal solution if it wasn't ignored (or silently clamped to 1).

  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Thu, 2013-03-07 07:52

Hi Tim -

Our drivers only support eglSwapInterval(0) or eglSwapInterval(1) ..nothing higher.  In fact you can query for this range using eglChooseConfg with EGL_MIN_SWAP_INTERVAL and EGL_MAX_SWAP_INTERVAL.

A suggested way of achiving a specific vsync is to use a timer within a rendering loop and add a delay/sleep each frame as needed to keep the frame rate constant.

 

  • Up0
  • Down0
programmerTim
Join Date: 14 Nov 11
Location: Cambridge, UK
Posts: 3
Posted: Wed, 2013-04-17 07:42

Hi, I realised your drivers only support eglSwapInterval(0) or eglSwapInterval(1), which was why I was attempting to work around this limitation by presenting the each frame twice at 60 hz. Your suggested way of achieving 30hz by throttling the CPU does not work as this diagram illustrates:

https://dl.dropbox.com/u/19400176/30hzlock.png

See also this thread from which I borrowed the link above:

http://www.madewithmarmalade.com/devnet/forum/locking-framerate-30fps-ios

It's also usually beneficial to allow the CPU to run a frame ahead of the GPU so that CPU framerate spikes can be absorbed without dropping frames. Throttling the CPU at 30 fps can degrade performance more on devices that are close to CPU bound and ultimately doesn't solve the problem that the user is seeing juddery motion as frames are displayed for a variety of 1/60 or 1/30 second intervals.

Finally, you don't address the problem that using standard OpenGL ES features causes your display driver to hard-lock requiring a reboot of the Nexus 4. It's not the only Adreno driver failure I've experienced, we had problems with Slingshot Racing on launch where occasionally after closing the app the phone would freeze. A logcat shows a bunch of errors from the driver similar to the log I posted to this thread (which has been removed?). Slingshot Racing uses the Unity game engine, I was able to hard-lock my phone by closing a few other popular Unity powered games including Bad Piggies. It might be something your engineers would like to take a look at, as it was pretty easy to reproduce!

  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Wed, 2013-04-17 08:59

Tim - Thanks for your comments...

Setting the swap interval with delays is very game/app dependant, and will only approximate the desired FPS with occasional missed syncs.  Adding run-tume compensation is to be expected, and sometimes involved, as the links you provide demonstrate.

Also our driver team is aware of the hard-lock  - preserving swap is a difficult feature to implement without impacting performance, and hence not necessarily recommended in an app - with the exception of implemently a rather static UI (in conjunction with using the GL_QCOM_tiled_rendering extension).

 

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.