New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 711948 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Surface synchronization: Reject CompositorFrames to an old LocalSurfaceId

Project Member Reported by fsam...@chromium.org, Apr 15 2017

Issue description

This popped into my head so I'm writing it down before I forget.

In DelegatedFrameHost's resize behavior today, we reject CompositorFrames of the wrong (old) size during a resize, and immediately send back a DidReceiveCompositorFrameAck to reduce latency for generating a new CompositorFrame. We can probably generalize this behavior with surface synchronization.

LocalSurfaceIds consist of two components: a local_id and a nonce. The nonce is random but the local_id is expected to be monotonically increasing. Perhaps if an embedder submits a CompositorFrame with a new LocalSurfaceId for the embedded surface, then cc can reject CompositorFrames to older LocalSurfaceIds. This frame rejection process might include:

1. Dropping the temporary reference if a corresponding surface does not yet exist.
2. Avoiding stashing the frame as a pending frame with dependencies.
3. Avoid adding a new CompositorFrame to an existing surface.
4. Immediately acking (DidReceiveCompositorFrameAck) and returning resources of the frame to the child.

This approach is not obviously better though:

On the positive side, we give the embedded child an opportunity to catch up quicker to the parent.

On the negative side, we might end up with larger gutters because we're rejecting intermediate frames between the last fallback and present state.

I think it's worth experimenting with this to see how this improves resize when surface sync is turned on.
 
Cc: kylec...@chromium.org staraz@chromium.org samans@chromium.org
Status: Available (was: Untriaged)

Comment 2 by danakj@chromium.org, Apr 18 2017

> In DelegatedFrameHost's resize behavior today, we reject CompositorFrames of 
> the wrong (old) size during a resize, and immediately send back a
> DidReceiveCompositorFrameAck to reduce latency for generating a new
> CompositorFrame. We can probably generalize this behavior with surface
> synchronization.

Just wanna point out that when we time out the lock, the UI makes a frame with gutters, and we allow the next single renderer frame thru with a wrong size.
Ohh interesting. Thanks for pointing that out Dana! I'm going to experiment with implementing this tomorrow to see the impact it has on resize performance and guttering.
Labels: Type-Feature

Comment 5 by fsamuel@google.com, Apr 20 2017

I've experimented with this yesterday. Surprisingly, we don't skip frames all that often. If we have an animated page and a bit of main thread jank, then sure we'll skip frames. Random side note: video inside a page while resizing makes me sad, we skip tons of frames...I can't wait until video lives in a Surface...
Cc: weiliangc@chromium.org
Project Member

Comment 7 by bugdroid1@chromium.org, May 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3ca7863c41560e94efdfdb21f0b1b4231e4a589e

commit 3ca7863c41560e94efdfdb21f0b1b4231e4a589e
Author: fsamuel <fsamuel@chromium.org>
Date: Thu May 04 21:48:53 2017

cc: Only add surface ID to embedded_surfaces if fallback does not match

A child surface ID is either a dependency (something the parents wants
to block its CompositorFrame on and may not exist in the display
compositor yet) or a reference (it is known to exist in the display
compositor).

Dependencies are held in CompositorFrameMetadata::embedded_surfaces, and
references are held in CompositorFrameMetadata::referenced_surfaces.

It was possible for a surface ID to end up in both places if the
primary and fallback SurfaceInfos in a SurfaceLayer matched. This
causes issues in an upcoming CL https://codereview.chromium.org/2831213004/
that "closes" an old fallback surface to receiving new CompositorFrames
if a new primary surface is being requested by a parent to reduce latency.

BUG= 672962 ,  711948 
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2861593002
Cr-Commit-Position: refs/heads/master@{#469482}

[modify] https://crrev.com/3ca7863c41560e94efdfdb21f0b1b4231e4a589e/cc/layers/surface_layer_impl.cc
[modify] https://crrev.com/3ca7863c41560e94efdfdb21f0b1b4231e4a589e/cc/layers/surface_layer_impl.h
[modify] https://crrev.com/3ca7863c41560e94efdfdb21f0b1b4231e4a589e/cc/layers/surface_layer_impl_unittest.cc

Project Member

Comment 8 by bugdroid1@chromium.org, May 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/980c8ee750096770976476654d13b5ecf412bee4

commit 980c8ee750096770976476654d13b5ecf412bee4
Author: fsamuel <fsamuel@chromium.org>
Date: Fri May 05 23:28:56 2017

cc: Reject CompositorFrames to old child surfaces

Currently, if a parent is blocked on a child SurfaceID that does not
yet have an active CompositorFrame, the child may continue to submit
CompositorFrames to the old SurfaceID. This eats up CPU cycles that
could be better spent letting the child catch up to the parent's
synchronization request.

With this CL, when a parent submits a CompositorFrame that is blocked
on unresolved dependencies, then existing referenced surfaces with
corresponding dependencies (of the same FrameSinkId) will be "closed",
preventing further CompositorFrames from being submitted to them.
Instead, resources will be immediately returned to the client, and a
DidReceiveCompositorFrameAck will be immediately issued. This reduces
the latency for a child client to catch up to the parent's request.

BUG= 672962 ,  711948 
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2831213004
Cr-Commit-Position: refs/heads/master@{#469798}

[modify] https://crrev.com/980c8ee750096770976476654d13b5ecf412bee4/cc/output/compositor_frame.cc
[modify] https://crrev.com/980c8ee750096770976476654d13b5ecf412bee4/cc/output/compositor_frame_metadata.h
[modify] https://crrev.com/980c8ee750096770976476654d13b5ecf412bee4/cc/surfaces/compositor_frame_sink_support_unittest.cc
[modify] https://crrev.com/980c8ee750096770976476654d13b5ecf412bee4/cc/surfaces/surface.cc
[modify] https://crrev.com/980c8ee750096770976476654d13b5ecf412bee4/cc/surfaces/surface.h
[modify] https://crrev.com/980c8ee750096770976476654d13b5ecf412bee4/cc/surfaces/surface_factory.cc
[modify] https://crrev.com/980c8ee750096770976476654d13b5ecf412bee4/cc/surfaces/surface_factory.h

Owner: fsam...@chromium.org
Status: Fixed (was: Available)
Blocking: -601863
Components: -Internals>MUS Internals>Services>WindowService

Sign in to add a comment