Commit 12bd84a1 authored by Saman Sami's avatar Saman Sami Committed by Commit Bot

viz: Relax child throttling

https://crrev.com/c/1539860 changed child throttling to allow only two
unembedded surfaces. However, this seems to have regressed latency so
revert back to allowing three unemedded surfaces.

Bug: 951992
Change-Id: I49f67d5299642063ef265aed34767f56f1706eb0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1598419
Commit-Queue: Saman Sami <samans@chromium.org>
Reviewed-by: default avatarJonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664461}
parent 4cd87ab1
...@@ -3496,6 +3496,7 @@ TEST_F(SurfaceSynchronizationTest, ...@@ -3496,6 +3496,7 @@ TEST_F(SurfaceSynchronizationTest,
const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1, 1); const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1, 1);
const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink1, 1, 2); const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink1, 1, 2);
const SurfaceId child_id3 = MakeSurfaceId(kChildFrameSink1, 1, 3); const SurfaceId child_id3 = MakeSurfaceId(kChildFrameSink1, 1, 3);
const SurfaceId child_id4 = MakeSurfaceId(kChildFrameSink1, 1, 4);
// |child_id1| Surface should immediately activate because one unembedded // |child_id1| Surface should immediately activate because one unembedded
// surface is allowed. // surface is allowed.
...@@ -3529,8 +3530,8 @@ TEST_F(SurfaceSynchronizationTest, ...@@ -3529,8 +3530,8 @@ TEST_F(SurfaceSynchronizationTest,
EXPECT_FALSE(child_surface2->HasPendingFrame()); EXPECT_FALSE(child_surface2->HasPendingFrame());
EXPECT_TRUE(child_surface2->HasActiveFrame()); EXPECT_TRUE(child_surface2->HasActiveFrame());
// The child submits to |child_id3|. Now again we have two unembedded surface // The child submits to |child_id3|. Throttling should still not kick in due
// so throttling should kick in. // to https://crbug.com/951992.
child_support1().SubmitCompositorFrame( child_support1().SubmitCompositorFrame(
child_id3.local_surface_id(), child_id3.local_surface_id(),
MakeCompositorFrame(empty_surface_ids(), empty_surface_ranges(), MakeCompositorFrame(empty_surface_ids(), empty_surface_ranges(),
...@@ -3538,8 +3539,19 @@ TEST_F(SurfaceSynchronizationTest, ...@@ -3538,8 +3539,19 @@ TEST_F(SurfaceSynchronizationTest,
MakeDeadline(1u))); MakeDeadline(1u)));
Surface* child_surface3 = GetSurfaceForId(child_id3); Surface* child_surface3 = GetSurfaceForId(child_id3);
ASSERT_NE(nullptr, child_surface3); ASSERT_NE(nullptr, child_surface3);
EXPECT_TRUE(child_surface3->HasPendingFrame()); EXPECT_FALSE(child_surface3->HasPendingFrame());
EXPECT_FALSE(child_surface3->HasActiveFrame()); EXPECT_TRUE(child_surface3->HasActiveFrame());
// The child submits to |child_id4|. Throttling should kick in.
child_support1().SubmitCompositorFrame(
child_id4.local_surface_id(),
MakeCompositorFrame(empty_surface_ids(), empty_surface_ranges(),
std::vector<TransferableResource>(),
MakeDeadline(1u)));
Surface* child_surface4 = GetSurfaceForId(child_id4);
ASSERT_NE(nullptr, child_surface4);
EXPECT_TRUE(child_surface4->HasPendingFrame());
EXPECT_FALSE(child_surface4->HasActiveFrame());
} }
} // namespace viz } // namespace viz
...@@ -744,17 +744,4 @@ void Surface::ActivatePendingFrameForInheritedDeadline() { ...@@ -744,17 +744,4 @@ void Surface::ActivatePendingFrameForInheritedDeadline() {
ActivatePendingFrameForDeadline(); ActivatePendingFrameForDeadline();
} }
void Surface::ResetBlockActivationOnParent() {
if (!block_activation_on_parent_)
return;
block_activation_on_parent_ = false;
if (!activation_dependencies_.empty() || !pending_frame_data_)
return;
// All blockers have been cleared. The surface can be activated now.
ActivatePendingFrame();
}
} // namespace viz } // namespace viz
...@@ -231,9 +231,6 @@ class VIZ_SERVICE_EXPORT Surface final { ...@@ -231,9 +231,6 @@ class VIZ_SERVICE_EXPORT Surface final {
void OnActivationDependencyResolved(const SurfaceId& activation_dependency, void OnActivationDependencyResolved(const SurfaceId& activation_dependency,
SurfaceAllocationGroup* group); SurfaceAllocationGroup* group);
// Called when this surface's activation no longer has to block on the parent.
void ResetBlockActivationOnParent();
// Notifies that this surface is no longer the primary surface of the // Notifies that this surface is no longer the primary surface of the
// embedder. All future CompositorFrames will activate as soon as they arrive // embedder. All future CompositorFrames will activate as soon as they arrive
// and if a pending frame currently exists it will immediately activate as // and if a pending frame currently exists it will immediately activate as
...@@ -312,8 +309,13 @@ class VIZ_SERVICE_EXPORT Surface final { ...@@ -312,8 +309,13 @@ class VIZ_SERVICE_EXPORT Surface final {
base::Optional<FrameData> active_frame_data_; base::Optional<FrameData> active_frame_data_;
bool seen_first_frame_activation_ = false; bool seen_first_frame_activation_ = false;
bool seen_first_surface_embedding_ = false; bool seen_first_surface_embedding_ = false;
// Indicates whether another surface adds this surface as a dependency. When
// set to true, this surface will be unthrottled and the surface that is
// created after it will also not be throttled.
bool seen_first_surface_dependency_ = false; bool seen_first_surface_dependency_ = false;
const bool needs_sync_tokens_; const bool needs_sync_tokens_;
// When false, this surface will not be subject to child throttling even if
// it's not embedded yet.
bool block_activation_on_parent_ = false; bool block_activation_on_parent_ = false;
// A set of all valid SurfaceIds contained |last_surface_id_for_range_| to // A set of all valid SurfaceIds contained |last_surface_id_for_range_| to
......
...@@ -255,7 +255,11 @@ void SurfaceAllocationGroup::UpdateLastReferenceAndMaybeActivate( ...@@ -255,7 +255,11 @@ void SurfaceAllocationGroup::UpdateLastReferenceAndMaybeActivate(
++it; ++it;
if (it == surfaces_.end()) if (it == surfaces_.end())
return; return;
(*it)->ResetBlockActivationOnParent(); // This ensures the next surface has its seen_first_surface_dependency_ bit
// set so that throttling doesn't kick in until 3 surfaces after the surface
// that was just embedded. We see regression if throttling kicks in sooner.
// See https://crbug.com/951992.
(*it)->OnSurfaceDependencyAdded();
} }
} // namespace viz } // namespace viz
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment