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

Issue 1749063002: Mozart: Improve internal scene graph representation. (Closed)

Created:
4 years, 9 months ago by jeffbrown
Modified:
4 years, 9 months ago
Reviewers:
abarth
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, darin (slow to review), gregsimon, mojo-reviews_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org
Base URL:
git@github.com:domokit/mojo.git@moz-0
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Mozart: Improve internal scene graph representation. This patch changes the internal scene graph representation into an immutable data structure which allows for multiple versions to be maintained simultaneously as well as for the node structure to be preserved during snapshot operations. Previously the node structure was traversed once during snapshot with the intent that all relevant information would be recorded info an immutable |RenderFrame| object for rasterization and for hit testing. However it proved prohibitively expensive to copy the necessary node structure information into the |RenderFrame| for hit testing. So this change does away with all of that. The compositor now keeps three levels of structural information to be generated and traversed as required. 1. |SceneDef| which holds a table of immutable |NodeDef| objects describing the currently presented state of the scene graph and pending updates which have yet to be applied. 2. |SceneContent| which is generated from a |SceneDef| when the scene graph is presented. It consists of an immutable index of |NodeDef| objects for a particular version of the scene graph as it existed at the time of presentation. This index contains sufficient linkage information to ensure that the scene does not contain any internal cross-node cycles and that all references resources and nodes are reachable. 3. |Snapshot| which is generated from a collection of |SceneContent| objects when the frame is snapshotted. When producing the snapshot, all scene references are resolved and combinator rules are evaluated to produce a final description of a single frame of graphical content to be rasterized. The |Snapshot| can also be traversed later for hit testing purposes since it retains a record of the disposition of each node (whether they were blocked). Altogether, these new representations resolve numerous issues with the old model such as how we can retain multiple versions of a scene for as long as required or how we can traverse particular versions or snapshots of the scene graph to execute queries such as hit testing. There are still many optimizations we could apply to the structure but it's already looking much better overall and there is significantly less wasted effort during snapshotting when blocked nodes are discovered. This also puts us in a nice position to start dealing with synchronization issues such as applications which publish scenes referencing textures which have yet to be produced: while walking the tree we can make a decision of whether to wait or to fallback on previously published content which may be already be ready with per-scene granularity. (To do later.) (Hit testing itself will be implemented in a later patch.) BUG= R=abarth@google.com Committed: https://chromium.googlesource.com/external/mojo/+/33eb773f692f9df5cf08d3bdc1e9e4569dfd1c67

Patch Set 1 #

Patch Set 2 : #

Total comments: 8

Patch Set 3 : avoid unnecessary hashtable lookups #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1322 lines, -945 lines) Patch
M mojo/services/gfx/composition/interfaces/nodes.mojom View 4 chunks +45 lines, -11 lines 0 comments Download
M mojo/services/gfx/composition/interfaces/scenes.mojom View 1 chunk +2 lines, -2 lines 0 comments Download
M services/gfx/compositor/BUILD.gn View 1 chunk +4 lines, -2 lines 0 comments Download
M services/gfx/compositor/compositor_engine.h View 1 chunk +2 lines, -2 lines 0 comments Download
M services/gfx/compositor/compositor_engine.cc View 3 chunks +9 lines, -16 lines 0 comments Download
M services/gfx/compositor/graph/node_def.h View 2 chunks +152 lines, -144 lines 0 comments Download
M services/gfx/compositor/graph/node_def.cc View 1 2 2 chunks +303 lines, -216 lines 0 comments Download
M services/gfx/compositor/graph/resource_def.h View 3 chunks +34 lines, -16 lines 0 comments Download
M services/gfx/compositor/graph/resource_def.cc View 1 chunk +12 lines, -2 lines 0 comments Download
A services/gfx/compositor/graph/scene_content.h View 1 1 chunk +117 lines, -0 lines 0 comments Download
A services/gfx/compositor/graph/scene_content.cc View 1 2 1 chunk +142 lines, -0 lines 0 comments Download
M services/gfx/compositor/graph/scene_def.h View 4 chunks +46 lines, -67 lines 0 comments Download
M services/gfx/compositor/graph/scene_def.cc View 14 chunks +109 lines, -192 lines 0 comments Download
A services/gfx/compositor/graph/scene_label.h View 1 chunk +37 lines, -0 lines 0 comments Download
A services/gfx/compositor/graph/scene_label.cc View 1 chunk +38 lines, -0 lines 0 comments Download
M services/gfx/compositor/graph/snapshot.h View 4 chunks +69 lines, -12 lines 0 comments Download
M services/gfx/compositor/graph/snapshot.cc View 1 2 3 chunks +178 lines, -16 lines 0 comments Download
M services/gfx/compositor/render/render_frame.h View 2 chunks +9 lines, -17 lines 0 comments Download
M services/gfx/compositor/render/render_frame.cc View 1 chunk +6 lines, -15 lines 0 comments Download
M services/gfx/compositor/render/render_image.h View 1 chunk +1 line, -1 line 0 comments Download
D services/gfx/compositor/render/render_layer.h View 1 chunk +0 lines, -108 lines 0 comments Download
D services/gfx/compositor/render/render_layer.cc View 1 chunk +0 lines, -99 lines 0 comments Download
M services/gfx/compositor/scene_state.h View 2 chunks +3 lines, -5 lines 0 comments Download
M services/gfx/compositor/scene_state.cc View 2 chunks +4 lines, -2 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 6 (2 generated)
jeffbrown
This isn't fully tested yet since I can't run it over remote desktop. I may ...
4 years, 9 months ago (2016-03-01 08:11:20 UTC) #2
abarth
LGTM The cycle detection logic looks tricky and I didn't try to verify it. It ...
4 years, 9 months ago (2016-03-01 17:21:26 UTC) #3
jeffbrown
https://codereview.chromium.org/1749063002/diff/20001/services/gfx/compositor/graph/node_def.cc File services/gfx/compositor/graph/node_def.cc (right): https://codereview.chromium.org/1749063002/diff/20001/services/gfx/compositor/graph/node_def.cc#newcode218 services/gfx/compositor/graph/node_def.cc:218: content, snapshot, [=](const NodeDef* child_node) -> bool { On ...
4 years, 9 months ago (2016-03-02 00:32:16 UTC) #4
jeffbrown
4 years, 9 months ago (2016-03-02 19:17:36 UTC) #6
Message was sent while issue was closed.
Committed patchset #3 (id:40001) manually as
33eb773f692f9df5cf08d3bdc1e9e4569dfd1c67 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698