Commit c907a8f5 authored by Kazuki Takise's avatar Kazuki Takise Committed by Commit Bot

Reset orientation lock after receiving compositor frame ack

Even if a client sends the post-rotation buffer and new orientation
at the same time during screen rotation, currently the orientation
lock is reset before the frame with the buffer isn't completely
processed.

This CL moves the reset logic from OnPostWidgetCommit() to
DidReceiveCompositorFrameAck();

BUG=b:118493249
TEST=Manually confirmed display rotation didn't cause black flashes
     for ARC apps.

Change-Id: I470bef456345b67cfee396c80157cc97e852b603
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089562
Commit-Queue: Kazuki Takise <takise@chromium.org>
Auto-Submit: Kazuki Takise <takise@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748084}
parent b86b0b45
......@@ -595,6 +595,15 @@ void ClientControlledShellSurface::SetClientAccessibilityId(
}
}
void ClientControlledShellSurface::DidReceiveCompositorFrameAck() {
orientation_ = pending_orientation_;
// Unlock the compositor after the frame is received by viz so that
// screenshot contain the correct frame.
if (expected_orientation_ == orientation_)
orientation_compositor_lock_.reset();
SurfaceTreeHost::DidReceiveCompositorFrameAck();
}
void ClientControlledShellSurface::OnBoundsChangeEvent(
ash::WindowStateType current_state,
ash::WindowStateType requested_state,
......@@ -1124,10 +1133,6 @@ void ClientControlledShellSurface::OnPostWidgetCommit() {
// Update surface scale.
CommitPendingScale();
orientation_ = pending_orientation_;
if (expected_orientation_ == orientation_)
orientation_compositor_lock_.reset();
widget_->GetNativeWindow()->SetProperty(aura::client::kZOrderingKey,
pending_always_on_top_
? ui::ZOrderLevel::kFloatingWindow
......
......@@ -213,6 +213,9 @@ class ClientControlledShellSurface : public ShellSurfaceBase,
// |accessibility_id| is negative value, it will unset the ID.
void SetClientAccessibilityId(int32_t accessibility_id);
// Overridden from SurfaceTreeHost:
void DidReceiveCompositorFrameAck() override;
// Overridden from SurfaceDelegate:
bool IsInputEnabled(Surface* surface) const override;
void OnSetFrame(SurfaceFrameType type) override;
......
......@@ -704,6 +704,7 @@ TEST_F(ClientControlledShellSurfaceTest, CompositorLockInRotation) {
shell_surface->SetOrientation(Orientation::PORTRAIT);
surface->Commit();
shell_surface->DidReceiveCompositorFrameAck();
EXPECT_FALSE(compositor->IsLocked());
}
......
......@@ -48,7 +48,7 @@ class SurfaceTreeHost : public SurfaceDelegate,
// Call this to indicate that the previous CompositorFrame is processed and
// the surface is being scheduled for a draw.
void DidReceiveCompositorFrameAck();
virtual void DidReceiveCompositorFrameAck();
// Call this to indicate that the CompositorFrame with given
// |presentation_token| has been first time presented to user.
......
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