summaryrefslogtreecommitdiffstats
path: root/cc/surfaces/surface_aggregator.h
Commit message (Collapse)AuthorAgeFilesLines
* Hook up BeginFrameSource to SurfaceFactoryClient via SurfaceManagerenne2016-03-091-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SurfaceManager now maintains a dag of surface id namespaces. Optionally, a single BeginFrameSource input can be attached to a single namespace node. Every namespace node also has a SurfaceFactoryClient. This client is informed of a current BeginFrameSource, which is chosen from any BeginFrameSource attached to it or a parent of that node. Any children of that namespace also are able to use that source. SurfaceManager is responsible for picking which source to use, of which it currently just picks the first one until that source goes is removed after which it arbitrarily picks another valid one. In practice, this means that a window moved to another display in ChromeOS will switch its BeginFrameSource after the window is dropped onto the new window. Because the users of this dag all have very different requirements, the ordering of SurfaceFactoryClient registration, namespace hierarchy registration, and BeginFrameSource attaching are not particularly strict. BeginFrameSources, SurfaceFactoryClients, and hierarchies can be registered and unregistered in any order with respect to each other. BUG=401331 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1673783004 Cr-Commit-Position: refs/heads/master@{#379988}
* Add weak pointer to SurfaceAggregator to try to debug crashjbauman2016-02-111-0/+3
| | | | | | | | | | | There's a possible use-after-free in SurfaceAggregator, so add a weakptr and some checks to try to determine what could be freeing it. BUG=560181 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1677323003 Cr-Commit-Position: refs/heads/master@{#374853}
* Switch cc to std::unordered_*.davidben2016-01-281-4/+2
| | | | | | | | | | | | This removes all uses of base::hash_*, BASE_HASH_NAMESPACE, and base::ScopedPtrHashMap in favor of the C++11 versions. BUG=576864, 579229 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1587283002 Cr-Commit-Position: refs/heads/master@{#371937}
* Switch SurfaceId maps from base::hash_map to std::unordered_map.lfg2016-01-271-5/+10
| | | | | | | | | BUG=576864 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1640483003 Cr-Commit-Position: refs/heads/master@{#371705}
* Switch to standard integer types in cc/.avi2015-12-211-0/+1
| | | | | | | | | | BUG=138542 TBR=danakj@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1539203002 Cr-Commit-Position: refs/heads/master@{#366333}
* List all child surfaces (including occluded) in CompositorFramejbauman2015-12-091-1/+11
| | | | | | | | | | | | Then any occluded child surface with a copy request can be aggregated (and have its copy done) whenever its parent draws. BUG=529378 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1491743006 Cr-Commit-Position: refs/heads/master@{#363877}
* Revert of List all child surfaces (including occluded) in CompositorFrame ↵jbauman2015-11-251-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #7 id:120001 of https://codereview.chromium.org/1430363002/ ) Reason for revert: Seems to have broken resize of some OOPIF. BUG=560237 Original issue's description: > List all child surfaces (including occluded) in CompositorFrame > > Then any occluded child surface with a copy request can be aggregated > (and have its copy done) whenever its parent draws. > > BUG=529378 > CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel > > Committed: https://crrev.com/915e16b393182f9ccc0ddc4caadd5f7744b25fd4 > Cr-Commit-Position: refs/heads/master@{#360896} TBR=danakj@chromium.org,kenrb@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=529378 Review URL: https://codereview.chromium.org/1475643006 Cr-Commit-Position: refs/heads/master@{#361604}
* List all child surfaces (including occluded) in CompositorFramejbauman2015-11-201-1/+11
| | | | | | | | | | | | Then any occluded child surface with a copy request can be aggregated (and have its copy done) whenever its parent draws. BUG=529378 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1430363002 Cr-Commit-Position: refs/heads/master@{#360896}
* cc: Plumbing for BeginFrameSource based on Surfacesbrianderson2015-10-201-3/+15
| | | | | | | | | | | | | | | | | | | | | This patch makes a stable decision about which Display a Surface belongs to and notifies the corresponding SurfaceFactoryClient of the BeginFrameSource belonging to that Display. The stable decision is based on the sorted order of Display pointers that the Surface currently belongs to. This is only plumbing - the actual endpoints (BeginFrameSource to use and what to do with that BeginFrameSource) still need to be hooked up. R=jbauman,mithro BUG=401331, 471411 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1304063014 Cr-Commit-Position: refs/heads/master@{#355140}
* Don't aggregate quads outside of damage rect when using partial swap.jbauman2015-07-141-6/+16
| | | | | | | | | | | | The quads will be scissored out, so aggregating them is a waste. For me on a webpage with a tiny spinner this reduces DisplayScheduler::OnBeginFrameDeadline time by around 30%, and reduces the GPU process CPU time by around 50%. BUG=490447 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1172883004 Cr-Commit-Position: refs/heads/master@{#338619}
* Calculate damage rects before aggregating frame data.jbauman2015-07-071-2/+4
| | | | | | | | | | | Walk the entire Surface tree ahead of normal aggregation to determine Surface validity and calculate damage rect. This will later allow us to avoid aggregating quads that are outside the damage rect. BUG=490447 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1143403003 Cr-Commit-Position: refs/heads/master@{#337538}
* cc: Remove DrawQuad::IterateResorucesvmpstr2015-06-021-7/+8
| | | | | | | | | | | | | | | | | | | | | | This patch removes IterateResources function in favor of iterating resources directly on the quad. In order to accomplish this, each derived quad uses new resources object on the base class to store all of the resources it needs. This allows the calling code that used to call IterateResources with a callback to instead directly iterate all of the ids and manipulate them in any way that is required. This improves the performance of the IterateResources test by ~30%. BUG=492765 R=danakj, piman@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1152473006 Cr-Commit-Position: refs/heads/master@{#332476}
* [surfaces] rename content_to_target_transform to target_transformjbauman2015-05-061-4/+4
| | | | | | | | When given as the argument to a function, this is not the transform from the content space of a quad to its target space, but rather from the target space of the input quad to the target space of the output quad. Rename it to make it a bit more clear (particularly in HandleSurfaceQuad, where the quad itself has its own content_to_target_transform). Review URL: https://codereview.chromium.org/1121083003 Cr-Commit-Position: refs/heads/master@{#328466}
* Change ScopedPtrHashMap's 2nd template parameterkcwu2015-04-281-1/+1
| | | | | | | | | | | | | | | | Now ScopedPtrHashMap expect the 2nd parameter is scoped_ptr<T>. For example, old usage ScopedPtrHashMap<int, Value> new usage ScopedPtrHashMap<int, scoped_ptr<Value>> With this change, ScopedPtrHashMap support scoped_ptr's custom deleter. R=danakj@chromium.org, tzik@chromium.org BUG=none Review URL: https://codereview.chromium.org/1099383002 Cr-Commit-Position: refs/heads/master@{#327341}
* Implement SetFullRootLayerDamage for cc::Displayjbauman2015-04-201-0/+1
| | | | | | | | | | This causes the SurfaceAggregator to consider the entire root Surface as being completely damaged. BUG=477609 Review URL: https://codereview.chromium.org/1092183002 Cr-Commit-Position: refs/heads/master@{#325934}
* Avoid unnecessary renderpass copy in SurfaceAggregatorjbauman2015-04-101-3/+4
| | | | | | | | | | We can fold the IterateResources on a quad into the existing iteration over the copied quads. This gets rid of a copy. The code still needs to do a walk over all the quads before to ensure the resource references are valid. BUG=463996 Review URL: https://codereview.chromium.org/594993002 Cr-Commit-Position: refs/heads/master@{#324554}
* Clip quads in surfaces to the SurfaceDrawQuad's clip_rect and visible_rect.jbauman2014-12-171-0/+16
| | | | | | | | | | They should be clipped to the clip_rect for correctness, and to the visible_rect for performance in the case of partially-overlapping surfaces. BUG=439933,339260 Review URL: https://codereview.chromium.org/787763012 Cr-Commit-Position: refs/heads/master@{#308728}
* Accumulate content_to_target_transform for nested Surfaces.jbauman2014-12-161-0/+1
| | | | | | | | All the transforms need to be combined together if there are multiple layers in the nesting. Review URL: https://codereview.chromium.org/804903007 Cr-Commit-Position: refs/heads/master@{#308689}
* Avoid merging non-opaque Surface renderpasses.jbauman2014-12-161-2/+0
| | | | | | | | If a surface has overlapping quads then its will render incorrectly if its transparency is moved to its quads. Instead force all non-opaque Surfaces to use their own renderpasses. Review URL: https://codereview.chromium.org/811623003 Cr-Commit-Position: refs/heads/master@{#308526}
* Release resources from SurfaceAggregator when new frame arrives.jbauman2014-12-131-0/+1
| | | | | | | | | | The SurfaceAggregator will never need the resources for a frame after a new frame has been submitted for that Surface, so return the resources early. BUG=441698,441751,440213 Review URL: https://codereview.chromium.org/800133002 Cr-Commit-Position: refs/heads/master@{#308236}
* Remove size from Surfaces.jbauman2014-11-251-1/+2
| | | | | | | | This isn't really useful anywhere, as what really matters is the output_rect of the root render pass of the delegated frame data that's given to the surface. Review URL: https://codereview.chromium.org/750643005 Cr-Commit-Position: refs/heads/master@{#305534}
* Makes SurfaceAggregator properly pass through opacitysky2014-11-211-0/+2
| | | | | | | | | | BUG=434110 TEST=SurfaceAggregatorValidSurfaceTest.OpacityCopied R=jamesr@chromium.org Review URL: https://codereview.chromium.org/734813002 Cr-Commit-Position: refs/heads/master@{#305164}
* Release resources from Surfaces not aggregated in current frame.jbauman2014-11-181-0/+4
| | | | | | | | | | If a SurfaceAggregator stops referencing a surface, it should return all the resources it's referencing to that child so they can be destroyed. BUG=339257 Review URL: https://codereview.chromium.org/720083002 Cr-Commit-Position: refs/heads/master@{#304556}
* Use global index to remap RenderPassIds in SurfaceAggregator.jbauman2014-10-231-0/+1
| | | | | | | | SurfaceIds are 64-bits, while RenderPassId.layer_id is 32-bits, so we can't just use the SurfaceId as the layer_id. Instead just keep a global counter for allocating the RenderPassIds. Review URL: https://codereview.chromium.org/675603002 Cr-Commit-Position: refs/heads/master@{#300846}
* Allow CopyOutputRequests on all render passes of a surfacejbauman2014-10-161-2/+1
| | | | | | | | | | The browser compositor in content/ currently expects to be able to do copy output requests of arbitrary layers. The surface aggregator should allow ever render pass to contain copy requests, and move them to the aggregated frame. BUG=397730 Review URL: https://codereview.chromium.org/614073005 Cr-Commit-Position: refs/heads/master@{#299831}
* Aggregate damage rects in surface aggregatorjbauman2014-08-271-6/+14
| | | | | | | | | | | The surface aggregator should keep track of the last frame from each surface that was aggregated, and use that to determine what the appropriate damage rect is for the next aggregation. BUG= TEST=chrome --use-surfaces --disable-gpu Review URL: https://codereview.chromium.org/506273002 Cr-Commit-Position: refs/heads/master@{#292227}
* Make RenderPass::Id an isolated classweiliangc@chromium.org2014-08-221-2/+2
| | | | | | | | | | | | | Move RenderPass::Id out of RenderPass and make it an isolated class called RenderPassId, so RenderPassDrawQuad and AppendQuadsData will not need to depend on entire RenderPass class. BUG=344962 Review URL: https://codereview.chromium.org/404563005 Cr-Commit-Position: refs/heads/master@{#291403} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291403 0039d316-1c4b-4281-b951-d872f2087c98
* Enqueuing new frames in a Surface should cause Displays to reaggregate itjbauman@chromium.org2014-08-161-1/+6
| | | | | | | | | | | | | Keep track of which Surfaces were included in a Display last frame, so if a new frame is enqueued in a Surface the Displays containing it will tell their clients to redraw. This way the browser compositor doesn't have to commit if only the renderer contents changed. BUG= Review URL: https://codereview.chromium.org/432093003 Cr-Commit-Position: refs/heads/master@{#290103} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290103 0039d316-1c4b-4281-b951-d872f2087c98
* Make Surface::GetEligibleFrame constjbauman@chromium.org2014-07-251-1/+3
| | | | | | | | | | | The frame shouldn't be modified by the aggregator, or else it will be broken if GetEligibleFrame is called again. Also modify ScopedPtrVector::const_iterator to make it const-correct. BUG= Review URL: https://codereview.chromium.org/417843003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285431 0039d316-1c4b-4281-b951-d872f2087c98
* Use a SurfaceFactory and manage resources for that group of surfacesjamesr@chromium.org2014-06-271-7/+21
| | | | | | | | | | | | | This adds a SurfaceFactory by which a client (normally a compositor instance) can create and destroy surfaces that may want to reuse resources. All frames must be submitted through the factory, although a frame may reference surfaces from different factories. BUG=339257 Review URL: https://codereview.chromium.org/332293003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280189 0039d316-1c4b-4281-b951-d872f2087c98
* Use a struct for cc::Surface ids for more type safetyjamesr@chromium.org2014-06-131-2/+3
| | | | | | | | | | | | We currently represent surface ids as just an int, but may want to move to a richer data structure in the future. Identifiers that are ints are also pretty easy to confuse with other ints. R=piman@chromium.org Review URL: https://codereview.chromium.org/331533002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276923 0039d316-1c4b-4281-b951-d872f2087c98
* Create SharedQuadState on RenderPassweiliangc@chromium.org2014-05-071-2/+2
| | | | | | | | | | | | | | | Instead of creating SharedQuadState on layers and pass ownership around, create SharedQuadState on RenderPass and only pass the raw pointer to layers. Also let QuadCuller hold pointer to RenderPass instead of two points to DrawQuadList and SharedQuadStateList that is owned by RenderPass. BUG=344962 TEST=cc_unittests Review URL: https://codereview.chromium.org/265823015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268785 0039d316-1c4b-4281-b951-d872f2087c98
* Pixel tests and some shared quad state fixupsjamesr@chromium.org2014-02-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds some pixel tests for the output of SurfaceAggregator and fixes several issues related to shared quad state management. This also concatenates the transform for the surface draw quad with the quads aggregated into the root draw pass of the referenced surface. Shared quad state mapping is a little bit nontrivial when doing aggregation since we copy the shared quad state entries from the aggregated frame's root pass into the shared quad state list of the pass containing the surface quad. When doing multiple levels of aggregation the relationship between the shared quad list offset from the aggregated pass to the destination pass gets tricky. Here's how this patch handles things: Root surface root pass: shared_quad_state_list: [A], [B] quad_list: [Quad using (A)], [Quad using (A)], [Surface 1], [Quad using (B)] Surface 1 root pass: shared_quad_state_list: [C], [D] quad_list: [Quad using (C)], [Surface 2], [Surface 3], [Quad using (D)] Surface 2 root pass: shared_quad_state_list: [E] quad_list: [Quad using (E)] Surface 3 root pass: shared_quad_state_list: [F] quad_list: [Quad using (F)] We append the shared quad stats to the aggregated pass' list as we encounter the quads that reference them, so the final aggregated frame looks like this: Aggregated frame root pass: shared_quad_state_list: [A], [C], [E], [F], [D], [B] quad_list: [Quad using (A)], [Quad using (A)], [Quad using (C)], [Quad using (E)], [Quad using (F)], [Quad using (D)], [Quad using (B)] Note that there's no shared quad state for the surface quads in the final shared quad state list. We use the transform and other properties from the surface quad's shared quad state when aggregating, but don't need them beyond aggregation. BUG=334876 Review URL: https://codereview.chromium.org/142863015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250484 0039d316-1c4b-4281-b951-d872f2087c98
* Initial surface aggregator implementationjamesr@chromium.org2014-01-291-0/+65
BUG=334876 Review URL: https://codereview.chromium.org/139763003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247598 0039d316-1c4b-4281-b951-d872f2087c98