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

Side by Side Diff: cc/surfaces/surface_aggregator.h

Issue 1172883004: Don't aggregate quads outside of damage rect when using partial swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@predamage
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_ 5 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_
6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_ 6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 11 matching lines...) Expand all
22 class DelegatedFrameData; 22 class DelegatedFrameData;
23 class ResourceProvider; 23 class ResourceProvider;
24 class Surface; 24 class Surface;
25 class SurfaceDrawQuad; 25 class SurfaceDrawQuad;
26 class SurfaceManager; 26 class SurfaceManager;
27 27
28 class CC_SURFACES_EXPORT SurfaceAggregator { 28 class CC_SURFACES_EXPORT SurfaceAggregator {
29 public: 29 public:
30 typedef base::hash_map<SurfaceId, int> SurfaceIndexMap; 30 typedef base::hash_map<SurfaceId, int> SurfaceIndexMap;
31 31
32 SurfaceAggregator(SurfaceManager* manager, ResourceProvider* provider); 32 SurfaceAggregator(SurfaceManager* manager,
33 ResourceProvider* provider,
34 bool aggregate_only_damaged);
33 ~SurfaceAggregator(); 35 ~SurfaceAggregator();
34 36
35 scoped_ptr<CompositorFrame> Aggregate(SurfaceId surface_id); 37 scoped_ptr<CompositorFrame> Aggregate(SurfaceId surface_id);
36 void ReleaseResources(SurfaceId surface_id); 38 void ReleaseResources(SurfaceId surface_id);
37 SurfaceIndexMap& previous_contained_surfaces() { 39 SurfaceIndexMap& previous_contained_surfaces() {
38 return previous_contained_surfaces_; 40 return previous_contained_surfaces_;
39 } 41 }
40 void SetFullDamageForSurface(SurfaceId surface_id); 42 void SetFullDamageForSurface(SurfaceId surface_id);
41 43
42 private: 44 private:
(...skipping 10 matching lines...) Expand all
53 const ClipData& quad_clip, 55 const ClipData& quad_clip,
54 const gfx::Transform& target_transform); 56 const gfx::Transform& target_transform);
55 57
56 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, 58 RenderPassId RemapPassId(RenderPassId surface_local_pass_id,
57 SurfaceId surface_id); 59 SurfaceId surface_id);
58 60
59 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, 61 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
60 const gfx::Transform& target_transform, 62 const gfx::Transform& target_transform,
61 const ClipData& clip_rect, 63 const ClipData& clip_rect,
62 RenderPass* dest_pass); 64 RenderPass* dest_pass);
63 void CopySharedQuadState(const SharedQuadState* source_sqs, 65 SharedQuadState* CopySharedQuadState(const SharedQuadState* source_sqs,
64 const gfx::Transform& target_transform, 66 const gfx::Transform& target_transform,
65 const ClipData& clip_rect, 67 const ClipData& clip_rect,
66 RenderPass* dest_render_pass); 68 RenderPass* dest_render_pass);
67 void CopyQuadsToPass( 69 void CopyQuadsToPass(
68 const QuadList& source_quad_list, 70 const QuadList& source_quad_list,
69 const SharedQuadStateList& source_shared_quad_state_list, 71 const SharedQuadStateList& source_shared_quad_state_list,
70 const base::hash_map<ResourceId, ResourceId>& resource_to_child_map, 72 const base::hash_map<ResourceId, ResourceId>& resource_to_child_map,
71 const gfx::Transform& target_transform, 73 const gfx::Transform& target_transform,
72 const ClipData& clip_rect, 74 const ClipData& clip_rect,
73 RenderPass* dest_pass, 75 RenderPass* dest_pass,
74 SurfaceId surface_id); 76 SurfaceId surface_id);
75 gfx::Rect ValidateAndCalculateDamageRect(SurfaceId surface_id); 77 gfx::Rect PrewalkTree(SurfaceId surface_id);
76 void CopyPasses(const DelegatedFrameData* frame_data, Surface* surface); 78 void CopyPasses(const DelegatedFrameData* frame_data, Surface* surface);
77 79
78 // Remove Surfaces that were referenced before but aren't currently 80 // Remove Surfaces that were referenced before but aren't currently
79 // referenced from the ResourceProvider. 81 // referenced from the ResourceProvider.
80 void RemoveUnreferencedChildren(); 82 void RemoveUnreferencedChildren();
81 83
82 int ChildIdForSurface(Surface* surface); 84 int ChildIdForSurface(Surface* surface);
83 gfx::Rect DamageRectForSurface(const Surface* surface, 85 gfx::Rect DamageRectForSurface(const Surface* surface,
84 const RenderPass& source, 86 const RenderPass& source,
85 const gfx::Rect& full_rect); 87 const gfx::Rect& full_rect);
86 88
87 SurfaceManager* manager_; 89 SurfaceManager* manager_;
88 ResourceProvider* provider_; 90 ResourceProvider* provider_;
89 91
90 class RenderPassIdAllocator; 92 class RenderPassIdAllocator;
91 typedef base::ScopedPtrHashMap<SurfaceId, scoped_ptr<RenderPassIdAllocator>> 93 typedef base::ScopedPtrHashMap<SurfaceId, scoped_ptr<RenderPassIdAllocator>>
92 RenderPassIdAllocatorMap; 94 RenderPassIdAllocatorMap;
93 RenderPassIdAllocatorMap render_pass_allocator_map_; 95 RenderPassIdAllocatorMap render_pass_allocator_map_;
94 int next_render_pass_id_; 96 int next_render_pass_id_;
97 const bool aggregate_only_damaged_;
95 98
96 typedef base::hash_map<SurfaceId, int> SurfaceToResourceChildIdMap; 99 typedef base::hash_map<SurfaceId, int> SurfaceToResourceChildIdMap;
97 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; 100 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_;
98 101
99 // The following state is only valid for the duration of one Aggregate call 102 // The following state is only valid for the duration of one Aggregate call
100 // and is only stored on the class to avoid having to pass through every 103 // and is only stored on the class to avoid having to pass through every
101 // function call. 104 // function call.
102 105
103 // This is the set of surfaces referenced in the aggregation so far, used to 106 // This is the set of surfaces referenced in the aggregation so far, used to
104 // detect cycles. 107 // detect cycles.
105 typedef std::set<SurfaceId> SurfaceSet; 108 typedef std::set<SurfaceId> SurfaceSet;
106 SurfaceSet referenced_surfaces_; 109 SurfaceSet referenced_surfaces_;
107 110
108 // For each Surface used in the last aggregation, gives the frame_index at 111 // For each Surface used in the last aggregation, gives the frame_index at
109 // that time. 112 // that time.
110 SurfaceIndexMap previous_contained_surfaces_; 113 SurfaceIndexMap previous_contained_surfaces_;
111 SurfaceIndexMap contained_surfaces_; 114 SurfaceIndexMap contained_surfaces_;
112 115
113 // After surface validation, every Surface in this set is valid. 116 // After surface validation, every Surface in this set is valid.
114 base::hash_set<SurfaceId> valid_surfaces_; 117 base::hash_set<SurfaceId> valid_surfaces_;
115 118
116 // This is the pass list for the aggregated frame. 119 // This is the pass list for the aggregated frame.
117 RenderPassList* dest_pass_list_; 120 RenderPassList* dest_pass_list_;
118 121
122 // The root damage rect of the currently-aggregating frame.
123 gfx::Rect root_damage_rect_;
124
125 bool has_copy_requests_;
danakj 2015/07/13 20:15:15 Can you comment about the lifetime/use of this var
126
119 // Resource list for the aggregated frame. 127 // Resource list for the aggregated frame.
120 TransferableResourceArray* dest_resource_list_; 128 TransferableResourceArray* dest_resource_list_;
121 129
122 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); 130 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator);
123 }; 131 };
124 132
125 } // namespace cc 133 } // namespace cc
126 134
127 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ 135 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698