This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

OpenGL ES 3.1 on Mali T880: flashes

Hello OpenGL gurus,

I have written a OpenGL ES 3.1 app for mobile devices and I am battling with problems on ARM Mali GPU.  I can reproduce the problem easily using a Samsung Galaxy S7 phone equipped with a Mali T880 GPU. The program appears to run correctly on Adreno and PowerVR GPUs.

One frame is composed of several render passes. The render passes communicate with help of a Shader Storage Buffer Object and atomic counters. The whole thing looks like this:

Pass1_Initialize_SSBO_and_Atomic();
glMemoryBarrier(GL_ALL_BARRIER_BITS);
 
Pass2_Fill_SSBO_With_initial_Data();
glMemoryBarrier(GL_ALL_BARRIER_BITS);
 
for(i=0;i<N;i++)
   {
   Pass3_Render_Object(i);
   glMemoryBarrier(GL_ALL_BARRIER_BITS);
   }
 
Pass4_Compose_Everything();

Now, the problem is that on Mali the screen keeps flashing. I have made many recordings and watched them frame-by-frame. What happens is that about 95% of frames look correct, but every so often an arbitrary subset of Objects disappears, and reappears in the next frame. Sometimes (very rarely) I can also see in Android's debug facility (logcat) the following:

E/OpenGLRenderer: Error:glFinish::execution failed
E/OpenGLRenderer: GL error: Out of memory!


I've seen that a few times before and so far this meant that some shader runs couldn't finish (due to an infinite loop) but I have no proof that this is the same issue.

################################################## ######

The problem is, I have no idea what can be causing the disappearing Objects. What I've tried so far is to keep removing code to see if the bug is still there - in an attempt to come up with the shortest piece of code that reproduces the problem. This approach fails because the more code I remove, the harder the bug gets to reproduce. Initially it keeps happening about twice per second, after several passes of removing various bits I can only reproduce it once per minute, and ultimately I cannot reproduce it anymore, but I have no idea if this is because I just removed the offending code or because I just passed some threshold and the bug is still there but is now very hard to reproduce.

The second thing I tried is to measure the bug by taking a look at the SSBO. I memory-map it to CPU at certain moments between passes and make sure it really does contain what it should. Unfortunately as soon as I add a

glBindBuffer(GL_SHADER_STORAGE_BUFFER, mSSBO[0] );
glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, length, GL_MAP_READ_BIT);
(...) // print the buffer
glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);


pretty much anywhere in the application code, the bug simply disappears.

In particular, when I remove the first glMemoryBarrier() and replace it with the above, the bug disappears completely ( I recorded 10 minutes worth of screen and watched this frame-by-frame, it's gone). This happens even if I don't inspect the buffer on CPU at all, I just map it and unmap it right away (which AFAIK should have the same effect like a memoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT) ??) This has raised a suspicion that maybe glMemoryBarrier() on Mali is buggy, so I wrote a test program to see - and this proved that glMemoryBarrier() works just fine.

I also have a Mali Graphics Debugger and I can connect it to the phone, and when I do the bug still shows. I however have no idea what to look for in the Debugger's interface.

Would you have any advice how to approach such an issue?


The code is GPL v2 and it is fully available to download - is it 45k lines of Java, XML and GLSL though. If anybody wants to take a look, here it is: http://distorted.org/redmine/project...e_example_code

Parents
  • I have also asked this question in the generic OpenGL forum here:

    https://www.opengl.org/discussion_boards/showthread.php/200754-Flashes-on-ARM-Mali?p=1291723

    and one seasoned member over there says it might be a 'full pipeline flush' that my program somehow triggers. 

    Any advice on how I can use the Mali Graphics Debugger (or or any other tool) ? I have it connected, the phone is rooted, I just don't know what to look for in MGD's interface...

    EDIT: Sorry, I was wrong, it is actually even worse:

    1) I run the 'bug reproducing' app, flashes happen regularly about once-twice per second.

    2) I connect MGD, start tracing, flashes completely stop.

    3) I press the 'disable tracing temporarily' button in MGD - flashes immediately start again.

    4) I press the button again to restart tracing - flashes completely disappear...

Reply
  • I have also asked this question in the generic OpenGL forum here:

    https://www.opengl.org/discussion_boards/showthread.php/200754-Flashes-on-ARM-Mali?p=1291723

    and one seasoned member over there says it might be a 'full pipeline flush' that my program somehow triggers. 

    Any advice on how I can use the Mali Graphics Debugger (or or any other tool) ? I have it connected, the phone is rooted, I just don't know what to look for in MGD's interface...

    EDIT: Sorry, I was wrong, it is actually even worse:

    1) I run the 'bug reproducing' app, flashes happen regularly about once-twice per second.

    2) I connect MGD, start tracing, flashes completely stop.

    3) I press the 'disable tracing temporarily' button in MGD - flashes immediately start again.

    4) I press the button again to restart tracing - flashes completely disappear...

Children