Forums - GL_OUT_OF_MEMORY / EGL_CONTEXT_LOST avoidance

4 posts / 0 new
Last post
GL_OUT_OF_MEMORY / EGL_CONTEXT_LOST avoidance
Dark_Photon
Join Date: 19 Jul 15
Posts: 5
Posted: Fri, 2016-04-22 13:27

Two questions:

    1. What memory conditions cause the Adreno KGSL driver on Android to fail with GL_OUT_OF_MEMORY?
    2. How does one increase the amount of memory usable by the KGSL to avoid this?

Background:

I have dedicated Nexus 7 tablets designed to run component test suites implemented with NDK, EGL, and OpenGL ES 3.  What I'm seeing is that some tests trigger GL_OUT_OF_MEMORY a subsequent EGL_CONTEXT_LOST errors on the N7 but not other test platforms.  I'd like to avoid this.

Reducing the amount of GPU memory consumption does avoid these errors, but that invalidates the test configuration which I need to match across devices (e.g. some OEM SoCs with Adreno 320 GPUs) .  Also, relative to the tablet's 2GB of RAM, the app isn't using that much memory when the Adreno driver hits GL_OUT_OF_MEMORY.  Here's the process footprint after an OOM failure:

    - 80MB "GL mtrack", 8MB "EGL mtrack", and 72MB "Gfx dev", with total process PSS around 200MB.

(reporting the numbers from dumpsys meminfo and /sys/kernel/debug/kgsl/proc/<pid>/mem).

However, if I run a test multiple times within the test application, triggering multiple OOM scenarios each time, I can rack up the following process memory sizes before the app is killed:

    - 734MB "GL mtrack", 76MB "EGL mtrack, 511MB "Gfx dev", with total process PSS around 1.3GB (1300MB).

The bottom line is: I don't understand what KGSL memory is being exhausted causing the Adreno GPU driver to throw the GL_OUT_OF_MEMORY / EGL_CONTEXT_LOST errors.  Could someone shed some light on my confusion?   Thanks!

CONFIGURATION:

    TABLET: Nexus 7 2013 Wifi, 2GB
    GPU: Adreno 320
    Android: 5.1.1 (LMY48T)

 

  • Up0
  • Down0
Dark_Photon
Join Date: 19 Jul 15
Posts: 5
Posted: Fri, 2016-04-22 13:53

In case it might help, here are the standard tell-tale signs I see in the Android log when a GL_OUT_OF_MEMORY condition is coming:

 

W/Adreno-GSL(13765): <gsl_ldd_control:427>: ioctl fd 34 code 0x400c0907 (IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID) failed: errno 71 Protocol error

W/Adreno-GSL(13765): <log_gpu_snapshot:337>: panel.gpuSnapshotPath is not set.not generating user snapshot

W/Adreno-GSL(13765): <gsl_ldd_control:427>: ioctl fd 34 code 0x400c0907 (IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID) failed: errno 35 Resource deadlock would occur

W/Adreno-GSL(13765): <log_gpu_snapshot:337>: panel.gpuSnapshotPath is not set.not generating user snapshot

W/Adreno-GSL(13765): <gsl_umd_context_waittimestamp:266>: error:-12 ctx 00000009 ts 15

E/Adreno-ES20(13765): <rb_timestamp_wait_on_timestamp:341>: gsl_device_waittimestamp failed in rb_timestamp_wait_on_timestamp

W/Adreno-GSL(13765): <gsl_ldd_control:427>: ioctl fd 34 code 0xc02c093d (IOCTL_KGSL_SUBMIT_COMMANDS) failed: errno 35 Resource deadlock would occur

W/Adreno-GSL(13765): <log_gpu_snapshot:337>: panel.gpuSnapshotPath is not set.not generating user snapshot

W/Adreno-GSL(13765): <gsl_ldd_control:427>: ioctl fd 34 code 0xc02c093d (IOCTL_KGSL_SUBMIT_COMMANDS) failed: errno 35 Resource deadlock would occur

W/Adreno-GSL(13765): <log_gpu_snapshot:337>: panel.gpuSnapshotPath is not set.not generating user snapshot

W/Adreno-ES20(13765): <finish_current_fbo_rendering:386>: GL_OUT_OF_MEMORY
 

 

  • Up0
  • Down0
Dark_Photon
Join Date: 19 Jul 15
Posts: 5
Posted: Mon, 2016-04-25 10:15

UPDATE: Just found that the GL_OUT_OF_MEMORY errors being thrown by the KGSL driver are a red herring.  Reducing app GPU memory doesn't get rid of the problem.

CAUSE: The root cause that triggers the above KGSL failure sequence is writing gl_FragDepth in a fragment shader.  (As also described here: https://developer.qualcomm.com/comment/9923#comment-9923). 

If I comment out the single line that writes gl_FragDepth, making no other changes to the application, then the run always succeeds.

QUESTION: Is there a driver fix for this problem?  If so, how do I download and install it on a Nexus 7?

I'm very new to Qualcomm drivers, so apologies if the answer to the latter is obvious to some.  Thanks in advance for the help!

  • Up0
  • Down0
Dark_Photon
Join Date: 19 Jul 15
Posts: 5
Posted: Thu, 2016-04-28 12:15
Hello? Does anyone monitor these boards?
  • 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.