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

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
« no previous file with comments | « cc/surfaces/surface_aggregator.h ('k') | cc/surfaces/surface_aggregator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_aggregator.cc
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index 620ada738264db8151307cfce4269c90a2352d05..88f320d5d3d499dba82618e222df4344c5736c70 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -21,6 +21,22 @@
#include "cc/trees/blocking_task_runner.h"
namespace cc {
+namespace {
+
+void MoveMatchingRequests(
+ RenderPassId id,
+ std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests,
+ ScopedPtrVector<CopyOutputRequest>* output_requests) {
+ auto request_range = copy_requests->equal_range(id);
+ for (auto it = request_range.first; it != request_range.second; ++it) {
+ DCHECK(it->second);
+ output_requests->push_back(scoped_ptr<CopyOutputRequest>(it->second));
+ it->second = nullptr;
+ }
+ copy_requests->erase(request_range.first, request_range.second);
+}
+
+} // namespace
SurfaceAggregator::SurfaceAggregator(SurfaceManager* manager,
ResourceProvider* provider)
@@ -165,16 +181,21 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
if (!frame_data)
return;
+ std::multimap<RenderPassId, 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 : copy_requests) {
+ request.second->SendEmptyResult();
+ delete request.second;
+ }
return;
+ }
SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first;
- ScopedPtrVector<CopyOutputRequest> copy_requests;
- surface->TakeCopyOutputRequests(&copy_requests);
-
bool merge_pass = copy_requests.empty();
const RenderPassList& referenced_passes = render_pass_list;
@@ -195,6 +216,8 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
source.transform_to_root_target,
source.has_transparent_background);
+ MoveMatchingRequests(source.id, &copy_requests, &copy_pass->copy_requests);
jamesr 2014/10/15 23:51:24 the RenderPassIds in copy_requests will be in the
+
// 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.
@@ -226,8 +249,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);
@@ -319,8 +340,18 @@ 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.
+ std::multimap<RenderPassId, CopyOutputRequest*> copy_requests;
+ surface->TakeCopyOutputRequests(&copy_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];
@@ -328,6 +359,8 @@ void SurfaceAggregator::CopyPasses(const RenderPassList& source_pass_list,
size_t dq_size = source.quad_list.size();
scoped_ptr<RenderPass> copy_pass(RenderPass::Create(sqs_size, dq_size));
+ MoveMatchingRequests(source.id, &copy_requests, &copy_pass->copy_requests);
+
RenderPassId remapped_pass_id =
RemapPassId(source.id, surface->surface_id());
@@ -361,20 +394,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());
« no previous file with comments | « cc/surfaces/surface_aggregator.h ('k') | cc/surfaces/surface_aggregator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698