Enable leaf layer tracing in PaintContext#32383
Enable leaf layer tracing in PaintContext#32383fluttergithubbot merged 2 commits intoflutter:mainfrom
Conversation
The snapshots for the display list layer are recorded in `LayerSnapshotStore` This still needs to be wired via service protocol, but this patch is independently valid.
|
cc: @gaaclarke |
| } | ||
|
|
||
| if (context.enable_leaf_layer_tracing) { | ||
| const auto canvas_size = context.leaf_nodes_canvas->getBaseLayerSize(); |
There was a problem hiding this comment.
Will this be prohibitively expensive to do on a series of frames?
For example, what if instead of eagerly storing the rasterized leaf, we instead stored the leaf with enough information to rasterize it later.
Then, we could always record the time it takes to rasterize the whole layer tree. We could update the snapshot store with those times. Later, a user could request rasterizations of the top N frames with their broken down raster times (and the amount of time it actually took to rasterize the whole scene).
WDYT?
There was a problem hiding this comment.
I think this approach would also let us keep DRM on when this is enabled, but maybe I'm misunderstanding.
There was a problem hiding this comment.
Currently we expect enable_leaf_layer_tracing to be false, except when user types in j when the Flutter tool is attached. That way I'm not expecting to store more than 1 frames worth of data in LayerTree store ever. When we do make the change to print N frames worth of raster information, I think we should do something like storing the serialized display list somewhere on device and get the raster information out.
|
|
||
| std::unique_ptr<FrameDamage> damage; | ||
| if (frame->framebuffer_info().supports_partial_repaint) { | ||
| // when leaf layer tracing is enabled we wish to repaing the whole frame for |
There was a problem hiding this comment.
typo?
I also think this is probably going to make the performance metrics less helpful. For example, imagine you have a relatively expensive leaf (some kind of fancy drawing or SVG or something) that does not change from frame to frame. Enabling leaf layer tracing will make it artificially seem like that leaf layer is very expensive on every frame, when it's really only very expensive on the first one (maybe where you still have enough budget for it).
There was a problem hiding this comment.
(please fix the typo before landing)
|
Can you expand the description please? |
done! |
dnfield
left a comment
There was a problem hiding this comment.
LGTM.
We should file some follow up bugs to improve this by extending it to worst-K frames, enabling or disabling DRM optionally
During performance debugging of a flutter application, it is useful to have additional data around how long subcomponents of the displayed frame contributed to the overall raster performance. Towards this goal, this change allows for a layer tree to request leaf-layer tracing. When this is enabled, the leaf layers are rendered to an off-screen texture and the texture is then stored in the
LayerSnapshotStore.In later changed, this stored snapshots will be transferred to the Flutter tool using a service protocol.