Use the BeginFrame signal to drive OffscreenCanvas animations. |
||||||
Issue descriptionI am attempting to use OffscreenCanvasFrameDispatcherImpl::OnBeginFrame to drive OffscreenCanvas animations in workers. Unfortunately, this method is currently never called. If I understand the code correctly, The key to fixing this is in the constructor of OffscreenCanvasCompositorFrameSink. It currently passes a nullptr as the "display" argument to the CompositorFrameSinkSupport constructor. A display seems to be required for driving BeginFrame events. I attempted to create or retrieve a cc:Display object in OffscreenCanvasCompositorFrameSink::Create, but this seems to be a highly non-trivial thing (at least for someone unfamiliar with this area)
,
Dec 15 2016
What needs to be done is to add the OffscreenCanvasCompositorFrameSink to the BeginFrame hierarchy via AddChildSink...I'll explain further later tonight.
,
Dec 16 2016
Actually, I'm looking again at this: in a nutshell you need to call SurfaceManager::RegisterFrameSinkHierarchy(top level page's FrameSinkId, canvas' FrameSinkId) in the display compositor (in the browser). In this patch: https://codereview.chromium.org/2584643002/patch/100001/110024 CanvasSurfaceLayerBridge gets a FrameSinkId. One solution is to plumb that newly created FrameSinkId back through content. Perhaps we can expose the Renderer interface in Blink or some place? There could be a Renderer::AddChildFrameSink(and pass in the canvas FrameSinkId). That will cause BeginFrames to be pumped at the same rate they're pumped to the main thread. We can chat more about details tomorrow.
,
Dec 16 2016
Thanks for the tips. I just want to make sure what it means for "BeginFrames to be pumped at the same rate they're pumped to the main thread". The BeginFrame signal will be dispatched to the OffscreenCanvasCompositorFrameSink without interruption, even if the main frame is busy and unable to produce frames for a period of time, right? Just making sure because this is sort of the whole point of OffscreenCanvas.
,
Dec 16 2016
Ohh yea, absolutely. What I mean is the display compositor will send BeginFrame IPCs to the canvas along with the main page. The main page can be slow, but the beginframes will be sent regardless. The beginframes will be sent from either the browser or mus and won't be throttled by the main page.
,
Dec 16 2016
,
Jan 16 2017
,
Jan 25 2017
,
Jan 28 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d0df339711fb34c94decb02ac90e0d9fddc1e8d1 commit d0df339711fb34c94decb02ac90e0d9fddc1e8d1 Author: xlai <xlai@chromium.org> Date: Sat Jan 28 03:24:49 2017 Make OffscreenCanvas animation in sync with its placeholder canvas's parent frame rate This CL makes OffscreenCanvasFrameDispatcherImpl::OnBeginFrame get fired when the OffscreenCanvas's corresponding placeholder canvas's parent frame is starting a new frame. In this way, we make sure that OffscreenCanvas animation matches the frame rate of display, which is part of the spec requirement in OffscreenCanvas (https://wiki.whatwg.org/wiki/OffscreenCanvas.requestAnimationFrame). Implementation in this CL can be broadly seen as two parts: 1. Registration of OffscreenCanvas's frame sink id to the FrameSinkHierarchy of its parent frame's frame sink id. The parent frame sink id is obtained by plumbing into WebLayerTreeView from HTMLCanvasElement; it is then sent to OffscreenCanvasSurfaceImpl and cached there. When OffscreenCanvasCompositorFrameSink is created (together with the support_), we then register this parent-child hierarchy to SurfaceManager. 2. OffscreenCanvas signals that it needs BeginFrame when users invoke commit(). This allows OffscreenCanvas.beginFrame() to be triggered to either resolve an existing promise and doCommit on the last overdraw compositorFrame sent by the user in the same frame window. When a promise is resolved, OffscreenCanvas signals that it no longer needs BeginFrame, so as to avoid overhead from its parent frame. BUG= 674744 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel Review-Url: https://codereview.chromium.org/2644653003 Cr-Commit-Position: refs/heads/master@{#446898} [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.cc [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_surface_impl.cc [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_surface_impl.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_surface_manager.cc [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_surface_manager.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/browser/renderer_host/offscreen_canvas_surface_manager_unittest.cc [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/renderer/gpu/render_widget_compositor.cc [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/renderer/gpu/render_widget_compositor.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/test/data/gpu/pixel_offscreenCanvas_2d_commit_main.html [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/test/data/gpu/pixel_offscreenCanvas_2d_commit_worker.html [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_main.html [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html [add] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-commit-frameless-doc.html [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/core/page/ChromeClient.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcher.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/web/ChromeClientImpl.cpp [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/Source/web/ChromeClientImpl.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/public/platform/WebLayerTreeView.h [modify] https://crrev.com/d0df339711fb34c94decb02ac90e0d9fddc1e8d1/third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
,
Jan 31 2017
,
Feb 26 2018
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by junov@chromium.org
, Dec 15 2016