Commit 43a7801f authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

cc: Invalidate for needs_prepare_tiles

Problem is when CanDraw is false but needs_prepare_tiles is true
Scheduler will keep requesting begin frames but do nothing in a
begin frame since invalidate is blocked on CanDraw.

We already have an efficient shortcut that does not involve actually
producing a frame if invalidate is only requested for
needs_prepare_tiles. So the simple fix is simply allow invalidates for
this case.

Bug: 900557
Change-Id: Ib3c3e213e2e2461d7aa1b8dd8d2e91ab64042feb
Reviewed-on: https://chromium-review.googlesource.com/c/1334550
Commit-Queue: Bo <boliu@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607876}
parent 9fd73df9
......@@ -565,14 +565,12 @@ bool SchedulerStateMachine::ShouldInvalidateLayerTreeFrameSink() const {
if (begin_impl_frame_state_ != BeginImplFrameState::INSIDE_BEGIN_FRAME)
return false;
// Don't invalidate if we cannnot draw.
if (PendingDrawsShouldBeAborted())
return false;
// Don't invalidate for draw if we cannnot draw.
// TODO(sunnyps): needs_prepare_tiles_ is needed here because PrepareTiles is
// called only inside the deadline / draw phase. We could remove this if we
// allowed PrepareTiles to happen in OnBeginImplFrame.
return needs_redraw_ || needs_prepare_tiles_;
return (needs_redraw_ && !PendingDrawsShouldBeAborted()) ||
needs_prepare_tiles_;
}
SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const {
......
......@@ -3091,6 +3091,25 @@ TEST_F(SchedulerTest, InvalidateLayerTreeFrameSinkWhenCannotDraw) {
EXPECT_FALSE(scheduler_->RedrawPending());
}
TEST_F(SchedulerTest, NeedsPrepareTilesInvalidates) {
// This is to test that SetNeedsPrepareTiles causes invalidates even if
// CanDraw is false.
scheduler_settings_.using_synchronous_renderer_compositor = true;
SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetCanDraw(false);
scheduler_->SetNeedsPrepareTiles();
EXPECT_ACTIONS("AddObserver(this)");
client_->Reset();
// Do not invalidate in next BeginFrame.
EXPECT_SCOPED(AdvanceFrame());
EXPECT_ACTIONS("WillBeginImplFrame",
"ScheduledActionInvalidateLayerTreeFrameSink");
client_->Reset();
}
TEST_F(SchedulerTest, SetNeedsOneBeginImplFrame) {
SetUpScheduler(EXTERNAL_BFS);
......
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