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

Unified Diff: cc/surfaces/surface_aggregator.cc

Issue 614073005: Allow CopyOutputRequests on all render passes of a surface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/surface_aggregator.cc
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index 35107e8363adf32ffef983cc32801b5e4d481163..0df781f2dc62d0dbaf0c48afca03beae44e83f8c 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -170,17 +170,22 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
if (!frame_data)
return;
+ ScopedPtrVector<ScopedPtrVector<CopyOutputRequest>> copy_requests;
+ surface->TakeCopyOutputRequests(&copy_requests);
+
RenderPassList render_pass_list;
bool invalid_frame = TakeResources(surface, frame_data, &render_pass_list);
- if (invalid_frame)
+ if (invalid_frame) {
+ for (auto* request_list : copy_requests) {
+ for (auto* request : *request_list)
+ request->SendEmptyResult();
+ }
return;
+ }
SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first;
- ScopedPtrVector<CopyOutputRequest> copy_requests;
- surface->TakeCopyOutputRequests(&copy_requests);
-
- bool merge_pass = copy_requests.empty();
+ bool merge_pass = copy_requests.back()->empty();
const RenderPassList& referenced_passes = render_pass_list;
size_t passes_to_copy =
@@ -198,6 +203,8 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
source.transform_to_root_target,
source.has_transparent_background);
+ copy_pass->copy_requests.swap(*copy_requests[j]);
+
// Contributing passes aggregated in to the pass list need to take the
// transform of the surface quad into account to update their transform to
// the root surface.
@@ -229,8 +236,6 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
} else {
RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id);
- dest_pass_list_->back()->copy_requests.swap(copy_requests);
-
SharedQuadState* shared_quad_state =
dest_pass->CreateAndAppendSharedQuadState();
shared_quad_state->CopyFrom(surface_quad->shared_quad_state);
@@ -323,13 +328,25 @@ void SurfaceAggregator::CopyQuadsToPass(
}
}
-void SurfaceAggregator::CopyPasses(const RenderPassList& source_pass_list,
- const Surface* surface) {
+void SurfaceAggregator::CopyPasses(const DelegatedFrameData* frame_data,
+ Surface* surface) {
+ RenderPassList source_pass_list;
+
+ // The root surface is allowed to have copy output requests, so grab them
+ // off its render passes.
+ ScopedPtrVector<ScopedPtrVector<CopyOutputRequest>> output_requests;
+ surface->TakeCopyOutputRequests(&output_requests);
+
+ bool invalid_frame = TakeResources(surface, frame_data, &source_pass_list);
+ DCHECK(!invalid_frame);
+
for (size_t i = 0; i < source_pass_list.size(); ++i) {
const RenderPass& source = *source_pass_list[i];
scoped_ptr<RenderPass> copy_pass(RenderPass::Create());
+ copy_pass->copy_requests.swap(*output_requests[i]);
+
RenderPassId remapped_pass_id =
RemapPassId(source.id, surface->surface_id());
@@ -363,20 +380,12 @@ scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) {
DCHECK(root_surface_frame->delegated_frame_data);
- RenderPassList source_pass_list;
-
SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first;
dest_resource_list_ = &frame->delegated_frame_data->resource_list;
dest_pass_list_ = &frame->delegated_frame_data->render_pass_list;
- bool invalid_frame =
- TakeResources(surface,
- root_surface_frame->delegated_frame_data.get(),
- &source_pass_list);
- DCHECK(!invalid_frame);
-
- CopyPasses(source_pass_list, surface);
+ CopyPasses(root_surface_frame->delegated_frame_data.get(), surface);
referenced_surfaces_.erase(it);
DCHECK(referenced_surfaces_.empty());

Powered by Google App Engine
This is Rietveld 408576698