anmar7889 / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

Mac: Bad OSR frame rate when linking 10.9+ SDK #1456

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reproduce by starting the cefclient app with "--off-screen-rendering-enabled".
NOTE: You must link against the OSX 10.9SDK (or 10.10SD) to reproduce. If you 
link against 10.8, then the problem does not occur.

Navigate to "interactive" HTML such as 
http://wicky.nillia.ms/react-simple-colorpicker/ and observe the frame rate 
when you modify the HTML state.

The observed frame rate is significantly slower than when using cef 3.2062

We are setting windowless_frame_rate to 30, but are observing a frame rate 
between 1 and 10.

By inspecting Chromioum traces we notice that pending frames are only 
acknowledged as a result of the IOSurface timer.
More specifically in the file:
    chromium/src/content/browser/compositor/io_surface_layer_mac.mm
DisplayIfNeededAndAck is only called from TimerFired and never from 
IOSurfaceLayerHelper::GotNewFrame (via SetNeedsDisplayAndDisplayAndAck) or from 
"helper_->DidDraw(draw_succeeded);" in drawInCGLContext

A contributing factor to this, is that for the OSR use case, 
client_->IOSurfaceLayerShouldAckImmediately always returns false, and if we 
"are not pumping frames", we then fail to acknowledge the current pending frame.
This appears to halt the render process and we get an effective frame rate that 
is 6 fps at the most (the timer interval for the IOSurfaceLayerHelper timer).

It seem as if the following change should be made:
Modify chromium/src/cef/libcef/browser/render_widget_host_view_osr_mac.mm:
Change CefRenderWidgetHostViewOSR::BrowserCompositorViewShouldAckImmediately to 
always return true

This will allow the render process to proceed to the next frame as soon as the 
current frame is handled.
The current API set has sufficient APIs to to prevent this change from causing 
unnecessary render operations:
- The frame rate is controllable via windowless_frame_rate (which is enforced 
on the "frame receive" end).
- A client can use CefBrowserHost::WasHidden to suspend rendering with the OSR 
view is hidden.

By using "show-fps-counter" we see that this change increases the frame rate 
for our use case by about a factor 10 (from 4-6 to 40-50 fps)

The following post contains a conversation that may or may not be related to 
the SDK issue https://codereview.chromium.org/474723002

Original issue reported on code.google.com by jsba...@gmail.com on 26 Nov 2014 at 9:15

GoogleCodeExporter commented 9 years ago

Original comment by magreenb...@gmail.com on 26 Nov 2014 at 9:30

GoogleCodeExporter commented 9 years ago
Issue 1453 has been merged into this issue.

Original comment by magreenb...@gmail.com on 26 Nov 2014 at 9:34

GoogleCodeExporter commented 9 years ago
Thanks, fixed in trunk revision 1943 and 2171 branch revision 1944.

Original comment by magreenb...@gmail.com on 1 Dec 2014 at 9:26

GoogleCodeExporter commented 9 years ago
Thanks, that was quick!

Original comment by mokafo...@gmail.com on 1 Dec 2014 at 6:02