Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Issue 316103004: Mac ÜC: Enable GPU back-pressure from the browser to the renderer (Closed)

Created:
6 years, 6 months ago by ccameron
Modified:
6 years, 6 months ago
Reviewers:
jbauman
CC:
chromium-reviews, yusukes+watch_chromium.org, yukishiino+watch_chromium.org, jam, penghuang+watch_chromium.org, sievers+watch_chromium.org, jbauman+watch_chromium.org, nona+watch_chromium.org, darin-cc_chromium.org, kalyank, piman+watch_chromium.org, danakj+watch_chromium.org, James Su, miu+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@dip
Visibility:
Public.

Description

Mac ÜC: Enable GPU back-pressure from the browser to the renderer When the browser compositor does a SwapBuffers to its output surface, take a lock on the compositor until that swap is displayed on the screen. This prevents the renderer from running ahead of the browser. If the renderer sends a new frame (it can send at most one), then track this event, and request redraw as soon as the lock is released. BUG=314190 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=275478

Patch Set 1 #

Patch Set 2 : Clean up #

Patch Set 3 : Simplify #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+166 lines, -17 lines) Patch
M content/browser/compositor/browser_compositor_view_mac.h View 1 2 3 chunks +20 lines, -4 lines 0 comments Download
M content/browser/compositor/browser_compositor_view_mac.mm View 1 6 chunks +61 lines, -2 lines 0 comments Download
M content/browser/compositor/delegated_frame_host.h View 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/compositor/delegated_frame_host.cc View 1 chunk +3 lines, -2 lines 1 comment Download
M content/browser/renderer_host/compositing_iosurface_layer_mac.h View 1 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/render_widget_host_view_aura.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_mac.h View 1 2 6 chunks +19 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_mac.mm View 1 2 8 chunks +58 lines, -8 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
ccameron
This is the stuff we discussed earlier today. https://codereview.chromium.org/316103004/diff/30001/content/browser/compositor/delegated_frame_host.cc File content/browser/compositor/delegated_frame_host.cc (right): https://codereview.chromium.org/316103004/diff/30001/content/browser/compositor/delegated_frame_host.cc#newcode754 content/browser/compositor/delegated_frame_host.cc:754: client_->DelegatedCompositorDidSwapBuffers(); ...
6 years, 6 months ago (2014-06-05 01:31:51 UTC) #1
jbauman
Have you tested whether this actually works? It looks to me like CompositorLock doesn't do ...
6 years, 6 months ago (2014-06-05 20:34:10 UTC) #2
ccameron
On 2014/06/05 20:34:10, jbauman wrote: > Have you tested whether this actually works? It looks ...
6 years, 6 months ago (2014-06-05 20:41:57 UTC) #3
ccameron
On 2014/06/05 20:41:57, ccameron1 wrote: > On 2014/06/05 20:34:10, jbauman wrote: > > Have you ...
6 years, 6 months ago (2014-06-05 20:42:40 UTC) #4
jbauman
lgtm, I see how CompositorLock is working now.
6 years, 6 months ago (2014-06-05 20:44:46 UTC) #5
ccameron
Thanks!
6 years, 6 months ago (2014-06-05 20:48:38 UTC) #6
ccameron
The CQ bit was checked by ccameron@chromium.org
6 years, 6 months ago (2014-06-05 20:48:43 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ccameron@chromium.org/316103004/30001
6 years, 6 months ago (2014-06-05 20:50:41 UTC) #8
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_dbg_triggered_tests on tryserver.chromium ...
6 years, 6 months ago (2014-06-06 00:41:32 UTC) #9
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-06 00:47:20 UTC) #10
commit-bot: I haz the power
Try jobs failed on following builders: android_dbg_triggered_tests on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/android_dbg_triggered_tests/builds/160312)
6 years, 6 months ago (2014-06-06 00:47:21 UTC) #11
ccameron
The CQ bit was checked by ccameron@chromium.org
6 years, 6 months ago (2014-06-06 16:44:19 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ccameron@chromium.org/316103004/30001
6 years, 6 months ago (2014-06-06 16:46:18 UTC) #13
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_dbg_triggered_tests on tryserver.chromium ...
6 years, 6 months ago (2014-06-06 17:12:26 UTC) #14
commit-bot: I haz the power
Change committed as 275478
6 years, 6 months ago (2014-06-06 18:05:19 UTC) #15
ccameron
On 2014/06/06 18:05:19, I haz the power (commit-bot) wrote: > Change committed as 275478 Hmm, ...
6 years, 6 months ago (2014-06-06 18:09:07 UTC) #16
no sievers
On 2014/06/06 18:09:07, ccameron1 wrote: > On 2014/06/06 18:05:19, I haz the power (commit-bot) wrote: ...
6 years, 6 months ago (2014-06-06 20:06:39 UTC) #17
ccameron
6 years, 6 months ago (2014-06-06 20:17:11 UTC) #18
Message was sent while issue was closed.
On 2014/06/06 20:06:39, sievers wrote:
> On 2014/06/06 18:09:07, ccameron1 wrote:
> > On 2014/06/06 18:05:19, I haz the power (commit-bot) wrote:
> > > Change committed as 275478
> > 
> > Hmm, just now I was thinking that maybe I should roll this into
> > DelegatedFrameHost, cause it already has the state tracking in
> > CanLockCompositorState.
> > 
> > Well, in a follow-up.
> 
> Just out of curiosity: In Aura and Android we use the browser compositor's
> DidCommit() callback to delay sending the CompositorFrameAck to throttle
> renderer to browser frame rate. Is this achieving the same just in a different
> way? I guess I don't know how this 'lock' here works :)

It's true!
    The browser is the one that actually does the final Swap(). Before ÜC, we
just had the GPU process not complete its swap until the swap was acked by the
browser. This is a perfectly good way to induce backpressure.

But Mac is complicated.
    Except, with ÜC, doing so would introduce a potential deadlock -- the
browser process (UI thread) already may wait on the GPU process, and this would
make the GPU process wait on the browser process (UI thread).

But we can fix it!
    So, to work around this, I lock the compositor when the Swap is issued the
the GPU process, and hold the lock until the Swap is presented to the screen.

The fix complicates things.
    The renderer may still send us the next frame (cause it is unblocked after
the commit -- and that is a good thing), but it will get eaten and ignored by
the compositor. So we need to track if we need to force a commit.

But it gets better!
    So, on 10.9+, we can do the present inside the GPU process and save
ourselves all of these issues!

But not really.
    We're not deprecating 10.6, 10.7, or 10.8 any time soon.

Powered by Google App Engine
This is Rietveld 408576698