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.

What's the "Optimized Frame Pacing" feature?

Discussion in '2019.2 Beta' started by Peter77, Feb 28, 2019.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,356
    From the 2019.2.0a6 release notes:
    What is that and how does it work?
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    9,958
    Yeah, I’m also interested to know what changed.
     
    mahdi_jeddi likes this.
  3. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    935
    Me too :D
     
  4. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    380
    Also interested in it.
     
    ArtuomGameStudio likes this.
  5. hutch_jl

    hutch_jl

    Joined:
    Jan 8, 2013
    Posts:
    40
    I was involved in the early consultation on this feature and I don't know how much I'm allowed to say about it so I'll have to be vague, but the key point is that it improves synchronization with the Android display pipeline when rendering. The upshot is more even frame timing and less input latency. As far as I'm aware it should just be an automatic improvement.
     
    FROS7 likes this.
  6. JC-Cimetiere

    JC-Cimetiere

    Unity Technologies

    Joined:
    May 8, 2014
    Posts:
    123
    Hello,
    sorry about the delayed reply, I missed the thread!
    We're working on a blog post which will explain in detail what this feature is and how it works, and we expect to publish it during Unity 2019.2 beta cycle.

    Meanwhile we'd like to share a brief overview of the new “Optimized Frame pacing” feature:

    The goal is to delivers consistency of frame rate by enabling frames to be distributed with less variance between them, creating smoother gameplay.

    Optimized Frame Pacing prevents a queue of frames building up by synchronizing the time at which a game submits a frame with the time at which the display hardware consumes that frame. With Optimized Frame Pacing enabled, frames spend less time in the queue, decreasing input latency. The effects of a player's input events are reflected sooner on the screen.

    This is achieved by wrapping rendering calls and employing a variety of techniques which combine the use of APIs such as the Java Choreographer, the Native Choreographer and the EGL_ANDROID_presentation_time GL extension on devices where these are available in order to provide a consistent API from the perspective of the Engine Developer.

    On devices where these techniques are not possible Optimized Frame Pacing will fall back to the original implementations of the wrapped functions, providing no regression of framerate on those devices (i.e. Frame Pacing will remain non-optimal but the code will function as before).

    One more thing to mention is that this feature was developed in collaboration with Google's Android Gaming and Graphics team.
     
  7. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,356
    Thank you for the explanation!

    Is there an API where I can query whether it's supported, like SystemInfo.supportsOprimizedFramePacing or so?
     
  8. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,742
    Not at the moment. What would you like to have it for?
     
  9. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,742
    @jrumps At the moment this is Android only, I'm not aware about the iOS part.
     
    phobos2077 likes this.
  10. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,025
    The "Optimized Frame Pacing" is working like a charm on all Samsung devices I tested on but when testing on a OnePlus 2 device application.tergetframerate is not working anymore. Setting the application to 30fps is not affecting the frame rate.
     
    blocovin likes this.
  11. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,742
    @Opeth001 can you please submit a bug report?
     
    Opeth001 likes this.
  12. danteswap

    danteswap

    Joined:
    Oct 27, 2013
    Posts:
    163
    When Optimize Frame Pacing Is enabled My Game Freezes After 5- 10 min on my one plus 3T Test Device,For Debugging I Disabled All The Objects From My Scene And Added Just A Plane And A Camera And Deployed The build On Device with auto connect profiler on , And Still With An empty scene with just a camera and a plane the game freezes on the device after 5- 15 minutes , Fortunatily the profiler was connected and In There The Player Loop Was at 60,000ms ,here is the link to my post
    " https://forum.unity.com/threads/and...h-playerloop-in-profiler-at-60-000-ms.863143/"
    here is link on Answers section "https://answers.unity.com/questions/1716017/android-build-project-freezes-after-5-minutes-with.html"
    Finally After building and deploying like 100 time with enabling and disabling player settings I Found That With Optimized Frame Pacing Disabled The Scene No Longer Freezes But When Reenabled Then Scene Starts To Freeze.
     
  13. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,742
    @danteswap can you please submit a bug report as well?
     
  14. nimscraze

    nimscraze

    Joined:
    Jan 26, 2020
    Posts:
    1
    Hi there. I'm a total newbie and have been attempting at my first game since the last couple of months; so, please excuse my nuisance. I'm using Unity 2019.3.2f1 and am loving it.. whilst tryna optimize my game, I tried fidgeting with all the settings and options as much as my brain could assist me. Yup, I'm a total noob-saibot! I miserably failed multiple times (almost 2 weeks experimentation) and got my end result as pathetic as it could've been.
    By now I had all of my textures compressed online and then, crunched under low quality (256) in Unity as well (imagine that view, horrible yeah?).. I dunno how many curses I'd have put on Unity in the last couple of weeks (true story) and was so broken..
    Now, while my game was in that condition, I noticed that my game was kinda lagging. I had Optimized Frame Pacing set to enabled, which did exact same thing as danteswap mentioned above; just that for me, the built was kinda getting frozen after like 10 mins of gameplay; the background music however, continued smoothly.
    Upon every build, I kept getting the warning that Anti-Aliasing is not recommended for mobile devices, asking me to change that under Quality Settings, which ofcourse, is not where AA resides anymore. I'd already selected none under my Camera for AA but had no clue that there was AA option under the URP quality settings as well.
    Removing AA from there fixed everything for me and my game is running like a stallion with 0 lags or any other bugs as such (that under no compression whatsoever). I dunno if this might be of any help but that's what solved my problem and I'm in love with Unity, once again ;) :D :)

    EDIT:
    I forgot to mention that while building, the URP Lit Shader would try to resolve the vertices program which kept showing about 19132 vp which changed drastically to 2436 vp :)
    apart from those, I also kept Dynamic Resolution On with no GI whatsoever..
    As anyone could guess that I don't really know what and how but yeah, my game runs like a charm!
     
    Last edited: Apr 17, 2020
  15. AVK79

    AVK79

    Joined:
    Oct 18, 2016
    Posts:
    4
    Unity 2019.3.13f1 - Black screen on Android 4.4 (Sony Xperia Z3 Compact)
    with Frame Pacing ON.
    Here is what logcat says:

    ...
    I Unity SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 4, Memory = 1732mb
    I Unity SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf), 0 little (mask: 0x0)
    I Unity ApplicationInfo com.megabozz.Marble version 0.01 build 95d81962-dfe5-4e77-b772-e768fb3991bc
    I Unity Built from '2019.3/release' branch, Version '2019.3.13f1 (d4ddf0d95db9)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a', Stripping 'Disabled'
    E GraphResponse {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Object with ID '2186643678312739' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api}
    I Adreno-EGL <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: RGURRAM_AU_LINUX_ANDROID_LNX.LA.3.5.2.2_RB1.04.04.04.087.030+PATCH[ES]_msm8974_LNX.LA.3.5.2.2_RB1__release_ENGG ()
    I Adreno-EGL OpenGL ES Shader Compiler Version: E031.24.00.15
    I Adreno-EGL Build Date: 08/12/14 Tue
    I Adreno-EGL Local Branch:
    I Adreno-EGL Remote Branch: quic/LNX.LA.3.5.2.2_rb1
    I Adreno-EGL Local Patches: 8b00bd16f3c1d9d35a2fa902df5e679888d2b2e3 Fixes an llvm crash with mini dEQP apk
    I Adreno-EGL 38bad22e162dead4e008444520a0144c78a347bd Fixes a potential dEQP crash.
    I Adreno-EGL ce345e1c45c2ae2d1fb2cb125c8d2574f1af5f95 Rev
    W Adreno-EGL <qeglDrvAPI_eglGetConfigAttrib:632>: EGL_BAD_ATTRIBUTE
    W Adreno-EGL <qeglDrvAPI_eglGetConfigAttrib:632>: EGL_BAD_ATTRIBUTE
    W Adreno-EGL <qeglDrvAPI_eglGetConfigAttrib:632>: EGL_BAD_ATTRIBUTE
    D Unity GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_texture_sRGB_de
    D Unity code GL_EXT_texture_filter_anisotropic GL_EXT_multisampled_render_to_texture GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query
    W ContextImpl Failed to ensure directory: /storage/sdcard1/Android/data/com.megabozz.Marble/cache
    I SwappyCommon SDK version = 19
    E SwappyCommon Error while getting method: getAppVsyncOffsetNanos
    E Swappy SwappyCommon could not initialize correctly.
    E Swappy Failed to initialize SwappyGL
    E Swappy Failed to get SwappyGL instance in setMaxAutoSwapIntervalNS
    E Swappy Failed to get SwappyGL instance in setAutoSwapInterval
    E Swappy Failed to get SwappyGL instance in setAutoPipelineMode
    E Swappy Failed to get SwappyGL instance in enableStats
    E Swappy Failed to get SwappyGL instance in setMaxAutoSwapIntervalNS
    W Adreno-ES20 <core_glCompressedTexImage2D:471>: GL_INVALID_VALUE
    I Trace Unable to load NDK tracing APIs
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    ...
    and eventually app crashes (after about 30-60 sec)
    ...
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    E Swappy Failed to get SwappyGL instance in swap
    W Adreno-GSL <sharedmem_gpumem_alloc_id:1489>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
    E Adreno-GSL <ioctl_kgsl_sharedmem_alloc:1590>: ioctl_kgsl_sharedmem_alloc: FATAL ERROR : (null)
    E qdmemalloc ion: Failed to map memory in the client: Out of memory
    E qdgralloc Could not mmap handle 0x7183eee8, fd=107 (Out of memory)
    E qdgralloc gralloc_register_buffer: gralloc_map failed
    W GraphicBufferMapper registerBuffer(0x7183eee8) failed -12 (Out of memory)
    E GraphicBuffer unflatten: registerBuffer failed: Out of memory (-12)
    E Surface dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -12
    W Adreno-EGLSUB <DequeueBuffer:606>: dequeue native buffer fail: Out of memory, buffer=0x0, handle=0x0
    E mono-rt /proc/self/maps:
    E mono-rt 40018000-4001a000 r-xp 00000000 b3:17 382 /system/bin/app_process
    E mono-rt 4001a000-4001b000 r--p 00001000 b3:17 382 /system/bin/app_process
    E mono-rt 4001b000-4001c000 rw-p 00000000 00:00 0
    E mono-rt 4001c000-4002b000 r-xp 00000000 b3:17 495 /system/bin/linker
    E mono-rt 4002b000-4002c000 r--p 0000e000 b3:17 495 /system/bin/linker
    E mono-rt 4002c000-4002d000 rw-p 0000f000 b3:17 495 /system/bin/linker
    E mono-rt 4002d000-4002e000 rw-p 00000000 00:00 0
    E mono-rt 4002e000-4002f000 r-xp 00000000 00:00 0 [sigpage]
    E mono-rt 4002f000-40031000 rw-p 00000000 00:00 0
    E mono-rt 40031000-40032000 r--p 00000000 00:00 0

    With Optimized Frame Pacing OFF the game works just fine, so I guess the feature is still buggy / not yet ready for production.
     
  16. cristofer-oswald

    cristofer-oswald

    Joined:
    Oct 29, 2019
    Posts:
    9
    Got this exact problem. Enabling Optimized Frame Pacing makes the games a black screen after the splash screen.
    Tested on a Xperia T3 (Android 4.4), higher-end devices, works well tho.
    Unity version 2019.3.13f1, scripting backend IL2CPP.
     
  17. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    9,958
    As an outsider that doesn't have this option ON but maybe would like to, and this thread kinda tells me that I shouldn't, what is the status report on this? Were bugs fixed? Is it more stable now? (I'm not finding anything on the issuetracker)
     
  18. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,742
    I see just a single bug report on Optimised Frame Pacing in the issue tracker, and it's not related to this thread.
     
  19. cLick1338

    cLick1338

    Joined:
    Feb 23, 2017
    Posts:
    55
    It doesn't seem to play well with on-demand rendering. (I didn't do extensive testing and probably won't as it's not a critical issue to me now; Could also depend on the way it's implemented - I do my ODR checks on Update in case it matters).

    In my case with the render interval at 60 (practically 1 FPS/"idle" mode) the response delay on input is usually maximum (~1 sec until game becomes responsive) whereas with optimised frame pacing disabled the response is instant.
     
    Akeolab likes this.
  20. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,742