[sf] Switch layer trace generator to use the new sf front end
Previously we used a mocked up flinger to playback the transactions
and then generate the layers trace. This was prone to data races
since layers were added on binder thread and transactions were
committed on the main thread. This would lead to invalid data
being generated or crashes.
This cl modifies the transaction traces to capture state changes
in the main thread and uses the new front end logic to generate
the layer snapshots. New front end has no dependencies to the rest
of surfaceflinger and will be more robust in recreating layer
snapshots .
Test: presubmit
Test: capture layers and transaction traces
Fixes: 255901752
Change-Id: I416bff27c90eae1ab8383cbfff4403b0e93c1006
diff --git a/services/surfaceflinger/layerproto/transactions.proto b/services/surfaceflinger/layerproto/transactions.proto
index 4c6a9cf..2c4eb10 100644
--- a/services/surfaceflinger/layerproto/transactions.proto
+++ b/services/surfaceflinger/layerproto/transactions.proto
@@ -40,6 +40,7 @@
/* offset between real-time clock and elapsed time clock in nanoseconds.
Calculated as: systemTime(SYSTEM_TIME_REALTIME) - systemTime(SYSTEM_TIME_MONOTONIC) */
fixed64 real_to_elapsed_time_offset_nanos = 3;
+ uint32 version = 4;
}
message TransactionTraceEntry {
@@ -47,18 +48,47 @@
int64 vsync_id = 2;
repeated TransactionState transactions = 3;
repeated LayerCreationArgs added_layers = 4;
- repeated int32 removed_layers = 5;
+ repeated uint32 destroyed_layers = 5;
repeated DisplayState added_displays = 6;
repeated int32 removed_displays = 7;
- repeated int32 removed_layer_handles = 8;
+ repeated uint32 destroyed_layer_handles = 8;
+ bool displays_changed = 9;
+ repeated DisplayInfo displays = 10;
+}
+
+message DisplayInfo {
+ uint32 layer_stack = 1;
+ int32 display_id = 2;
+ int32 logical_width = 3;
+ int32 logical_height = 4;
+ Transform transform_inverse = 5;
+ Transform transform = 6;
+ bool receives_input = 7;
+ bool is_secure = 8;
+ bool is_primary = 9;
+ bool is_virtual = 10;
+ int32 rotation_flags = 11;
+ int32 transform_hint = 12;
+
}
message LayerCreationArgs {
- int32 layer_id = 1;
+ uint32 layer_id = 1;
string name = 2;
uint32 flags = 3;
- int32 parent_id = 4;
- int32 mirror_from_id = 5;
+ uint32 parent_id = 4;
+ uint32 mirror_from_id = 5;
+ bool add_to_root = 6;
+ uint32 layer_stack_to_mirror = 7;
+}
+
+message Transform {
+ float dsdx = 1;
+ float dtdx = 2;
+ float dtdy = 3;
+ float dsdy = 4;
+ float tx = 5;
+ float ty = 6;
}
message TransactionState {
@@ -74,7 +104,7 @@
// Keep insync with layer_state_t
message LayerState {
- int64 layer_id = 1;
+ uint32 layer_id = 1;
// Changes are split into ChangesLsb and ChangesMsb. First 32 bits are in ChangesLsb
// and the next 32 bits are in ChangesMsb. This is needed because enums have to be
// 32 bits and there's no nice way to put 64bit constants into .proto files.
@@ -164,8 +194,8 @@
Matrix22 matrix = 11;
float corner_radius = 12;
uint32 background_blur_radius = 13;
- int64 parent_id = 14;
- int64 relative_parent_id = 15;
+ uint32 parent_id = 14;
+ uint32 relative_parent_id = 15;
float alpha = 16;
message Color3 {
@@ -220,14 +250,6 @@
ColorTransformProto color_transform = 25;
repeated BlurRegion blur_regions = 26;
- message Transform {
- float dsdx = 1;
- float dtdx = 2;
- float dtdy = 3;
- float dsdy = 4;
- float tx = 5;
- float ty = 6;
- }
message WindowInfo {
uint32 layout_params_flags = 1;
int32 layout_params_type = 2;
@@ -236,7 +258,7 @@
bool focusable = 5;
bool has_wallpaper = 6;
float global_scale_factor = 7;
- int64 crop_layer_id = 8;
+ uint32 crop_layer_id = 8;
bool replace_touchable_region_with_crop = 9;
RectProto touchable_region_crop = 10;
Transform transform = 11;