Commit 5a639d16 authored by Andrey Kosyakov's avatar Andrey Kosyakov Committed by Commit Bot

Fix more stuck frames with external frame control (again)

- disable sending of missed frames to frame observers added after we
cancel frame in ExternalBeginFrameSourceMojo to avoid sending multiple
frames, or sending frames at the time when the client does not intend.

- force full frames (i.e. animation_only = false) till we have a first
frame drawn. We used to do this on the client side, but this really
belongs to the back-end (and maybe further down to the renderer).

Bug: 1149042
Change-Id: Id1d79fbd4d6f355ebf6b9a441a5df772c7cf3b4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2538488Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829122}
parent 9c82e516
......@@ -4,6 +4,8 @@
#include "components/viz/service/frame_sinks/external_begin_frame_source_mojo.h"
#include <utility>
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
namespace viz {
......@@ -31,7 +33,12 @@ void ExternalBeginFrameSourceMojo::IssueExternalBeginFrame(
DCHECK(!pending_frame_callback_) << "Got overlapping IssueExternalBeginFrame";
original_source_id_ = args.frame_id.source_id;
OnBeginFrame(args);
BeginFrameArgs args_copy(args);
// Force full frame till we have first real draw.
if (!last_frame_acknowledged_)
args_copy.animate_only = false;
last_frame_acknowledged_ = false;
OnBeginFrame(args_copy);
pending_frame_callback_ = std::move(callback);
......@@ -89,11 +96,16 @@ void ExternalBeginFrameSourceMojo::MaybeProduceFrameCallback() {
BeginFrameAck nak(last_begin_frame_args_.frame_id.source_id,
last_begin_frame_args_.frame_id.sequence_number,
/*has_damage=*/false);
// Prevent missing begin frames from being sent to sinks that came late,
// as this may result in two overlapping frames being sent, which is not
// supported with full pipeline mode.
last_begin_frame_args_ = BeginFrameArgs();
std::move(pending_frame_callback_).Run(nak);
}
void ExternalBeginFrameSourceMojo::OnDisplayDidFinishFrame(
const BeginFrameAck& ack) {
last_frame_acknowledged_ = true;
if (!pending_frame_callback_)
return;
std::move(pending_frame_callback_).Run(ack);
......
......@@ -82,6 +82,7 @@ class VIZ_SERVICE_EXPORT ExternalBeginFrameSourceMojo
// IssueExternalBeginFrame. Note this is likely to be different from our
// source id, but this is what will be reported to FrameSinkObserver methods.
uint64_t original_source_id_ = BeginFrameArgs::kStartingSourceId;
bool last_frame_acknowledged_ = false;
base::flat_set<FrameSinkId> pending_frame_sinks_;
Display* display_ = nullptr;
......
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