Reland "Simple frame production"
This is a reland of commit 23a50951556c98fab168260ac37c32006fe546d1
Update OnBeginFrame call in tests to match new signature.
No other changes.
Original change's description:
> Simple frame production
>
> A simple frame production algorithm. Supports:
> * a single root render pass only
> * Layer position, transform
> * SetMaskToBounds for axis-aligned layer
>
> Add AppendQuads for SolidColorLayer as the simplest layer for unit
> testing.
>
> Notable missing features:
> * Non-axis aligned clip and filters (requires non-root pass)
> * Damage tracking
> * Quad occlusion culling
> * Visible rect on quads
>
> Add test harness to unit test frame generation.
>
> Bug: 1408128
> Change-Id: I5508292876ddc66b59b118742dbceacb2c6a7d8e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4245000
> Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
> Commit-Queue: Bo Liu <boliu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1106868}
Bug: 1408128
Change-Id: Ie004e2d0542ce99f0a23c5420b844162e6788dd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4265173
Auto-Submit: Bo Liu <boliu@chromium.org>
Commit-Queue: Bo Liu <boliu@chromium.org>
Commit-Queue: Kyle Charbonneau <kylechar@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1106946}
diff --git a/cc/slim/frame_sink_impl.cc b/cc/slim/frame_sink_impl.cc
index c83845b2..3efcf98 100644
--- a/cc/slim/frame_sink_impl.cc
+++ b/cc/slim/frame_sink_impl.cc
@@ -85,7 +85,8 @@
base::BindOnce(&FrameSinkImpl::OnContextLost, base::Unretained(this)));
client_receiver_.Bind(std::move(pending_client_receiver_), task_runner_);
- frame_sink_remote_->InitializeCompositorFrameSinkType(
+ frame_sink_ = frame_sink_remote_.get();
+ frame_sink_->InitializeCompositorFrameSinkType(
viz::mojom::CompositorFrameSinkType::kLayerTree);
#if BUILDFLAG(IS_ANDROID)
@@ -94,7 +95,7 @@
if (io_thread_id_ != base::kInvalidThreadId) {
thread_ids.push_back(io_thread_id_);
}
- frame_sink_remote_->SetThreadIds(thread_ids);
+ frame_sink_->SetThreadIds(thread_ids);
#endif
return true;
}
@@ -108,7 +109,7 @@
return;
}
needs_begin_frame_ = needs_begin_frame;
- frame_sink_remote_->SetNeedsBeginFrame(needs_begin_frame);
+ frame_sink_->SetNeedsBeginFrame(needs_begin_frame);
}
void FrameSinkImpl::UploadUIResource(cc::UIResourceId resource_id,
@@ -225,7 +226,7 @@
}
if (!local_surface_id_.is_valid()) {
- frame_sink_remote_->DidNotProduceFrame(
+ frame_sink_->DidNotProduceFrame(
viz::BeginFrameAck(begin_frame_args, false));
return;
}
@@ -235,11 +236,19 @@
viz::HitTestRegionList hit_test_region_list;
if (!client_->BeginFrame(begin_frame_args, frame, viz_resource_ids,
hit_test_region_list)) {
- frame_sink_remote_->DidNotProduceFrame(
+ frame_sink_->DidNotProduceFrame(
viz::BeginFrameAck(begin_frame_args, false));
return;
}
+ if (local_surface_id_ == last_submitted_local_surface_id_) {
+ DCHECK_EQ(last_submitted_device_scale_factor_, frame.device_scale_factor());
+ DCHECK_EQ(last_submitted_size_in_pixels_.height(),
+ frame.size_in_pixels().height());
+ DCHECK_EQ(last_submitted_size_in_pixels_.width(),
+ frame.size_in_pixels().width());
+ }
+
resource_provider_.PrepareSendToParent(std::move(viz_resource_ids).extract(),
&frame.resource_list,
context_provider_.get());
@@ -254,7 +263,7 @@
{
TRACE_EVENT0("cc", "SubmitCompositorFrame");
- frame_sink_remote_->SubmitCompositorFrame(
+ frame_sink_->SubmitCompositorFrame(
local_surface_id_, std::move(frame),
send_new_hit_test_region_list ? hit_test_region_list_ : absl::nullopt,
0);