Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

bad UI performance on android in PutGeometryJobFence

Discussion in 'UGUI & TextMesh Pro' started by frg_kova, Dec 1, 2015.

  1. frg_kova

    frg_kova

    Joined:
    Jul 16, 2015
    Posts:
    16
    Hello everybody,

    I'm optimizing UI and I noticed I can't get beyond ~10 fps on my Nexus 7, android 6.0 device. Can you help me track down the source of the problem? We have quite a few UI elements such as big background images, images, buttons with text, overlay images and such, but nothing that could eat nearly as much of gpu.

    Profiler (Nexus 7):
    OpenGLES2, multithread rendering on: Gfx.WaitForDevice ~70ms.
    OpenGLES2, multithread rendering off: PutGeometryJobFence ~100ms
    OpenGLES3, multithread rendering off: Device.Present ~300ms
    I have Unity Pro and these are all from the device, example screenshot: http://screencast.com/t/tE8fufGB

    Running an empty scene with few UI elements gives me fully 30 or 60 fps, vsync is forced on by device.
    At first I thought it was just too much for the GPU so I optimized from ~130 batch calls to ~40, but nothing has changed. I tried 5.2.2f1 and now 5.2.3f1.

    Can someone tell me what PutGeometryJobFence actually means? Any ideas in general what it could be? Googling it doesn't help. It seems to me we are exposing some kind of unity bug and can't get around it.
    iOS runs fine at 30 fps on iphone5 or ipad air2.
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Please report a bug :)
     
  3. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    I'm having the same issue, just filed a bug report

    Just upgraded to 5.3.0f4 today.

    At first glance in the editor things looked good, but once we built to devices and profiled we noticed the same issue "PutGeometryJobFence" causing a major cpu hit. It seems pretty constant during our gameplay. For us this was not a problem in 5.2.3. Here is a shot from our profiler:
    Profiler.PNG

    Our project is a 2D game, and it seems the issue appears when our character sprites are present (which is almost always).
     
    edJT and eirikwahlitema like this.
  4. frg_kova

    frg_kova

    Joined:
    Jul 16, 2015
    Posts:
    16
    Our problem was it was custom shaders that distorted texture to make it look animated. As soon as I turned that off fps jumped. The overall ui performance in unity is not satisfactory still having in mind only few materials are used and just 2d textures, but what can you do.

    So in some conclusion, the profiler message means gpu is hogged and you just don't know why? I would like unity team to clarify some of them.
     
    eirikwahlitema likes this.
  5. eirikwahlitema

    eirikwahlitema

    Joined:
    Oct 23, 2015
    Posts:
    5
    TitanUnity: We are also having the same issue with PutGeometryJobFence using very long time on Android devices, after upgrading from 5.2.3 to 5.3.0.

    Can you please post a link to the bug report, so we can follow it, and possibly help with more information and/or additional test-case to reproduce the issue?
     
    edJT likes this.
  6. edJT

    edJT

    Joined:
    Apr 29, 2015
    Posts:
    2
    TitanUnity: We are also in the same boat with our project, so a link or a case number would be really helpful.
     
    eirikwahlitema likes this.
  7. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
  8. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    If you guys hear any updates on this, or find a workaround please share. We would love to go live on 5.3, but we may need to revert. Unfortunately I'm not sure what version we could revert to as there hasn't been a stable build of Unity for us for several versions now, so we're in a tough spot.
     
    eirikwahlitema likes this.
  9. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    COPIED FROM CONVERATION WITH QA TEAM:

    I was able to isolate the assets that cause this new sustained performance problem for us. Maybe you can help us figure out why this occurs.

    I've attached 2 screenshots and a simple project extracted from our game. In the scene of the sample project I've added one of our game map backgrounds that is now performing poorly. To be clear, all of our maps were previously optimized and ran smooth in both 5.1.4 and in 5.2.3...

    In fact, the performance was so well optimized we wrote about it on our blog back in October:
    http://biobeasts.artix.com/2d-background-performance-in-unity/

    Now that we've upgraded to 5.3, we see what appears to be normal looking performance when profiling from the Editor (below):


    However, when the exact same project is built to an Android device we see terrible performance (below):


    We saw this poor performance on several devices, including: Droid Maxx, Samsung S6, and Nexus 7 tablet.
    The simple project is attached, please keep me updated:
    https://drive.google.com/file/d/0BwL7QqsvL2_EaWhvd1Y1MFlDeU0/view?usp=sharing
     
    eirikwahlitema likes this.
  10. edJT

    edJT

    Joined:
    Apr 29, 2015
    Posts:
    2
  11. Shkeek

    Shkeek

    Joined:
    Oct 10, 2015
    Posts:
    2
    I would like to add, I have 2 Android devices, a newer Samsung Galaxy Core and a Samsung Galaxy Note (1st generation). I have the same issue as described, since I upgraded to 5.3 the same game plays very slowly on my Core (even though it's 3 years newer than the Note 1). On the note, the same game runs fine. It seems like the new versions of Android might have an effect. I wanted to add this detail in case it helps root causing.

    This PutGeometryJobOnFence is a subset of the BatchRenderer.Flush, which alone is taking 100ms. Again, this only happens on the Samsung Galaxy Core (the slowdown). On the Galaxy Note 1, no issue.
     
  12. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Anyone have an update on this issue?
     
  13. Testudo

    Testudo

    Joined:
    Aug 9, 2014
    Posts:
    2
    I have got the same problem on my Nexus 7. Noticed my build file is very big also, but not sure it's related to 5.3 though since I did not check for a while.
     
  14. Reaven99

    Reaven99

    Joined:
    Oct 3, 2015
    Posts:
    39
    Is there any news about this?
    I am having the same problem, a big fps drop on android caused by PutGeometryJobFence.
     
  15. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    I contacted QA again just now regarding this issue I'll post if I hear anything.
     
    Deleted User and eirikwahlitema like this.
  16. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Still no word yet... has anyone been able to pinpoint the exact cause of this sustained performance drop? What is particularly odd is that our characters and enemies all have alpha and don't seem to cause this problem... but our map backgrounds do. All of them are setup in a similar fashion with Sprite Renderers.

    So far I've been unsuccessful at identifying exactly what about our map backgrounds causes the issue to appear. Will continue looking..
     
  17. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Things we know so far about the PutGeometryJobFence performance problem:
    We will continue digging for a solution, this is the only issue between us and an app submission.
     
  18. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Pretty sure we may have just found a solution.. will post shortly.
     
  19. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Ok, after reading this article I realized that our profiler view didn't look quite like the profiler images in the post:
    http://blogs.unity3d.com/2015/09/07/making-the-ui-backend-faster/

    Turns out we did NOT have 'Multithreaded Rendering' enabled in the player settings. I'm not sure when that option appeared, but prior to 5.3 our performance on Android was fine.

    Anyway, after checking that box and rebuilding, we found the SpriteRender.RenderGeometry and PutGeometryJobFence hangs mostly disappear. Performance on Android instantly returned to normal levels.

    Now, I would be jumping for joy and dancing on my desk, except that we now have encountered a new issues... with 'Multithreaded Rendering' enabled, we're experiencing a full screen flicker that I've read in other posts seems to have something to due with swapping out assets at runtime:
    http://forum.unity3d.com/threads/multi-threaded-rendering-flickering-the-whole-scene.299838/

    Let me know if Multithreaded Rendering works for anyone. Also, if anyone has ideas about how to eliminate the flickering please share.
     
    Last edited: Dec 16, 2015
  20. Testudo

    Testudo

    Joined:
    Aug 9, 2014
    Posts:
    2
    Hi Titan,

    I did the same and it fixed the bug for me as well.

    Thanks a lot, I am back to 60 fps :)
     
    TitanUnity likes this.
  21. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
  22. eirikwahlitema

    eirikwahlitema

    Joined:
    Oct 23, 2015
    Posts:
    5
    Thanks for sharing your workarounds! But it did not work for me, I had to do something else:

    On my Sony Xperia Z (also known as "Sony C6603") enabling "Multithreaded Rendering" has no effect on the performance bug (still 16 fps). But if I instead turn off "Auto Graphics API" and force rendering to use OpenGLES2 (and not use OpenGLES3), then I get normal performance again (60 fps).
     
    jiangjibin and Deleted User like this.
  23. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Yup, we also saw significant improvements by disabling OpenGLES 3. Downloading 5.3.1 now, should have the fixes we need for this and other issues.
     
  24. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    With 5.3.1 I was able to restore OpenGLES 3 and performance seems to be normal. We're currently now building without multithreaded rendering enabled, and I've selected automatic in the Player Settings > Other Settings panel.
     
    eirikwahlitema likes this.
  25. Deleted User

    Deleted User

    Guest

    Forcing OpenGLES2 restores my apps performance from 10-15fps back up to 60fps on a Galaxy S4. I haven't seen my game looking this good for months. Can't believe how much time I've lost chasing a bug I would never be able to fix, but usage of OpenGLES3 cripples my Galaxy S4. thankyou eirikwahlitema :)
     
    eirikwahlitema likes this.
  26. Shkeek

    Shkeek

    Joined:
    Oct 10, 2015
    Posts:
    2
    I enabled Multithreaded Rendering, it did increase the FPS a little. But when I unchecked "Auto Graphics API" and removed OpenGLES3 (that way it only uses OpenGLES2), the game is silky smooth now!

    I might just make it to launch :D Thank you for the great suggestions!
     
  27. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,969
    Did you log a bug? UT is upgrading the gfx guts and that's introducing a bunch of perf regressions.

     
  28. CL_HG

    CL_HG

    Joined:
    Mar 5, 2014
    Posts:
    6
    I just encountered a similar issue in Unity 5.3.1p2.. I'm developing an app for the Oculus GearVR, therefore my only target device is the Samsung Galaxy S6. Oculus has some specific expectations for the Unity Player Settings and requirements for the framerates (60+, 75 would be best).. This is why I need to use OpenGLES3 and Multithreaded Rendering (Oculus Player Settings)
    .
    When I use OpenGLES3 I have some profiler spikes for BatchRenderer.Flush (every 3-5 seconds for 30-60ms).
    If I use OpenGLES2 the spikes still appear but now for Camera.Renderer -> SceneCulling -> CullSendEvents -> WaitingForJob.

    Do you have any idea how to figure out what causes this problems and achieving my deadline? That would be awesome ;)