Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2854163003: [cc] Plumb BeginFrameAcks through SurfaceManager to DisplayScheduler. (Closed)
Patch Set: Pass ack via SurfaceDamaged, add back tests. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/compositor_frame_sink_support.cc
diff --git a/cc/surfaces/compositor_frame_sink_support.cc b/cc/surfaces/compositor_frame_sink_support.cc
index 9d14ef0b72b647e6c8778270b7d96383fa85c3e9..f59ebaa934379b1aa43b8c898760c6bf06143fce 100644
--- a/cc/surfaces/compositor_frame_sink_support.cc
+++ b/cc/surfaces/compositor_frame_sink_support.cc
@@ -86,13 +86,16 @@ void CompositorFrameSinkSupport::SetNeedsBeginFrame(bool needs_begin_frame) {
}
void CompositorFrameSinkSupport::DidNotProduceFrame(const BeginFrameAck& ack) {
+ TRACE_EVENT2("cc", "CompositorFrameSinkSupport::DidNotProduceFrame",
+ "ack.source_id", ack.source_id, "ack.sequence_number",
+ ack.sequence_number);
DCHECK_GE(ack.sequence_number, BeginFrameArgs::kStartingFrameNumber);
// |has_damage| is not transmitted, but false by default.
DCHECK(!ack.has_damage);
- // TODO(eseckler): Forward |ack| via SurfaceObservers.
-
+ if (current_surface_)
+ surface_manager_->SurfaceModified(current_surface_->surface_id(), ack);
if (begin_frame_source_)
begin_frame_source_->DidFinishFrame(this);
}
@@ -165,8 +168,6 @@ bool CompositorFrameSinkSupport::SubmitCompositorFrame(
}
current_surface_ = std::move(surface);
- // TODO(eseckler): Forward |ack| via SurfaceObservers.
-
if (begin_frame_source_)
begin_frame_source_->DidFinishFrame(this);
@@ -297,6 +298,10 @@ void CompositorFrameSinkSupport::Init(SurfaceManager* surface_manager) {
void CompositorFrameSinkSupport::OnBeginFrame(const BeginFrameArgs& args) {
UpdateNeedsBeginFramesInternal();
+ if (current_surface_) {
+ surface_manager_->SurfaceDamageExpected(current_surface_->surface_id(),
+ args);
+ }
last_begin_frame_args_ = args;
if (client_)
client_->OnBeginFrame(args);
@@ -311,14 +316,12 @@ void CompositorFrameSinkSupport::OnBeginFrameSourcePausedChanged(bool paused) {}
void CompositorFrameSinkSupport::OnSurfaceActivated(Surface* surface) {
DCHECK(surface->HasActiveFrame());
+ const CompositorFrame& frame = surface->GetActiveFrame();
if (!seen_first_frame_activation_) {
+ // SurfaceCreated only applies for the first Surface activation.
seen_first_frame_activation_ = true;
- const CompositorFrame& frame = surface->GetActiveFrame();
gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
-
- // SurfaceCreated only applies for the first Surface activation. Thus,
- // SurfaceFactory stops observing new activations after the first one.
surface_manager_->SurfaceCreated(SurfaceInfo(
surface->surface_id(), frame.metadata.device_scale_factor, frame_size));
}
@@ -326,7 +329,8 @@ void CompositorFrameSinkSupport::OnSurfaceActivated(Surface* surface) {
// is potentially transformed into a real reference by the client.
ReferencedSurfacesChanged(surface->surface_id().local_surface_id(),
surface->active_referenced_surfaces());
- if (!surface_manager_->SurfaceModified(surface->surface_id())) {
+ if (!surface_manager_->SurfaceModified(surface->surface_id(),
+ frame.metadata.begin_frame_ack)) {
TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD);
surface->RunDrawCallback();
}
@@ -365,7 +369,9 @@ void CompositorFrameSinkSupport::RequestCopyOfSurface(
DCHECK(current_surface_->compositor_frame_sink_support().get() == this);
current_surface_->RequestCopyOfOutput(std::move(copy_request));
- surface_manager_->SurfaceModified(current_surface_->surface_id());
+ BeginFrameAck ack;
+ ack.has_damage = true;
+ surface_manager_->SurfaceModified(current_surface_->surface_id(), ack);
}
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698