Search Unity

PVRSRVEventObjectWait Timeout

Discussion in 'Android' started by zalogic, Jul 8, 2011.

  1. zalogic

    zalogic

    Joined:
    Oct 6, 2010
    Posts:
    273
    Hi Guys!
    This is the most weirdest thing ever on Android!

    My game hangs on Samsung Galaxy S (Android OS 2.2.1).
    I build for armv7 / OpenGL ES 2.0. And it goes past the splash screen, it loads the first scene, and then the second. It plays the animation from the second scene and suddenly the app hangs. (the OS too)
    At that moment the logs are filled with messages like these:
    "PVRSRVEventObjectWait Timeout!
    W/SharedBufferStack( 3149): waitForCondition(ReallocateCondition) timed out (identity=6, status=0). CPU may be pegged. trying again."

    Also the OS hangs and the only way to get it back working is by removing the phone battery.

    I'm still investigating the issue and if I find anything new I'll post it.

    Thanks for any advice.
     
    Last edited: Jul 13, 2011
  2. zalogic

    zalogic

    Joined:
    Oct 6, 2010
    Posts:
    273
    Ok this issue is really bad. I still didn't manage to find out the cause. And it seems to be random. I can't find a pattern to it.

    But the weird part is that after more experimenting the app freeze was generating this kind of message in the logs:
    And it kept writing the same messages over and over again. After about 1 min of waiting the Android OS shutdown.

    I'll keep you posted to anything new I find.

    Please, if anybody knows something related to this kind of issue I'll greatly appreciate any advice.
     
  3. zalogic

    zalogic

    Joined:
    Oct 6, 2010
    Posts:
    273
    Ok guys! After days and hours of digging around I found the root of my problem!

    First thing's first. I found 2 other links related to this problem that seem to point out an issue actually present in the Android OS:
    http://code.google.com/p/android/issues/detail?id=7432
    http://code.google.com/p/android/issues/detail?id=10505

    But most of the advices given at the above links did not seem to help in any way.

    So the problem in my case was generated by the following case:

    Somewhere in the game I had 3 cameras that were rendering something visible from a certain layer in 3 separate Render Textures.
    The render textures were set as mainTexture on the material of 3 quads that were being rendered by the main camera.
    When the application started the GameObjects of the 3 quads were set to inactive and thus they were not visible. But the 3 cameras
    that were rendering to the 3 render textures were still active and generating draw calls.
    THIS WAS THE PROBLEM FOR ANDROID! As soon as the app started it started rendering, it would start logging the above described timeout error.
    BUT if I would activate the gameobjects for those 3 quads in Awake() or Start() the app worked fine.

    So if a render texture rendered by a camera is used by another Renderer rendered by the main camera, but that renderer is inactive, on the Android (2.1, 2.2.1 - all I could test on) it generates something like a deadlock in the OS rendering API or something like that.

    Conclusion:
    So to keep those 3 quads hidden I had to disable the 3 cameras that were rendering to the render textures too. Which I should have done in the first place to avoid extra unnecessary draw calls.

    Hope this helps someone out there. It was a painful experience in a tight deadline.
     
    Last edited: Jul 13, 2011
  4. Papatsu

    Papatsu

    Joined:
    Apr 8, 2010
    Posts:
    32
    I can confirm having the same problems with Render Textures. But I have not yet found a solution to my particular problem. Disabling all cameras and models using the render textures did not help. But removing them completely from the game did.

    But I really need them for my menu-system so I'll have to keep banging my head at it.
     
  5. zalogic

    zalogic

    Joined:
    Oct 6, 2010
    Posts:
    273
    I'm sry that my solution did not help you.
    If you want maybe I can help. Try to isolate your problem in a simple Unity scene, make it a unitypackage and upload it here.
    I will take a look at it as soon as I can and get back to you with some feedback.
     
  6. emi-albu

    emi-albu

    Joined:
    Aug 15, 2012
    Posts:
    9
    I had the same problem. I was using NGUI and the program was crashing with "waitForCondition" error. After 2 days of testing and researching I found out that the problem was one of the shaders from the NGUI. Inside one of the shaders there was a call which made the error.

    fixed4 frag (v2f IN) : COLOR
    {
    float2 factor = abs(IN.worldPos);
    clip(1.0 - max(factor.x, factor.y));
    return tex2D(_MainTex, IN.texcoord) * IN.color;
    }

    After commented the clip method, it will not crash, but the shader will not work as expected. Now I have to find a solution to this.
    PS: the errors occours only on devices that have GPU - model: Adreno 205 .
     
  7. GianormousGames

    GianormousGames

    Joined:
    Jul 27, 2012
    Posts:
    2
    Same. Did you rework the shader?

    Someone really needs to bring this up with the NGUI dev if it hasn't been brought to his attention. 100% crash on HTC Thunderbolt.
     
  8. hz

    hz

    Joined:
    Jan 8, 2013
    Posts:
    1
    Try to use the "Alpha Clip" instead of the "Hard Clip" as the Clipping Mode in every UIPanel(s).
    Few old drivers of the GPUs like Adreno 205 doesn't support the clip() function in the fragment shader correctly.

    NGUI's "Alpha Clip" or "Soft Clip" shader has been implemented as replacing fragments with transparent color inside clipping areas.
    It has more compatibility, but it'll be much slower.