From bee470988bfe3694484f73294842c90faaf55e35 Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Fri, 16 Dec 2022 13:15:05 +0000 Subject: [PATCH] Pass through excludesCompositionState flag to layer creation So that Flicker lib components can fallback on the bounds when the composition information for visible region is known to not be available Test: collect a trace without composition enabled and make sure we still have visible layers Bug: 250998831 Change-Id: I74b6796a508cd4aa72bf0042bf9825434689f6e5 --- .../src/common/trace/flickerlib/layers/Layer.ts | 17 +++++++++-------- .../trace/flickerlib/layers/LayerTraceEntry.ts | 5 +++-- .../src/parsers/parser_surface_flinger.ts | 7 ++++--- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/tools/winscope-ng/src/common/trace/flickerlib/layers/Layer.ts b/tools/winscope-ng/src/common/trace/flickerlib/layers/Layer.ts index e9a02e800..bfc3da839 100644 --- a/tools/winscope-ng/src/common/trace/flickerlib/layers/Layer.ts +++ b/tools/winscope-ng/src/common/trace/flickerlib/layers/Layer.ts @@ -19,7 +19,7 @@ import { Layer, LayerProperties, Rect, toActiveBuffer, toColor, toRect, toRectF, import { shortenName } from '../mixin' import Transform from './Transform' -Layer.fromProto = function (proto: any): Layer { +Layer.fromProto = function (proto: any, excludesCompositionState = false): Layer { const visibleRegion = toRegion(proto.visibleRegion) const activeBuffer = toActiveBuffer(proto.activeBuffer) const bounds = toRectF(proto.bounds) @@ -45,11 +45,11 @@ Layer.fromProto = function (proto: any): Layer { const properties = new LayerProperties( visibleRegion, - activeBuffer, + activeBuffer, /* flags */ proto.flags, - bounds, - color, - /* isOpaque */ proto.isOpaque, + bounds, + color, + /* isOpaque */ proto.isOpaque, /* shadowRadius */ proto.shadowRadius, /* cornerRadius */ proto.cornerRadius, /* type */ proto.type ?? ``, @@ -70,13 +70,14 @@ Layer.fromProto = function (proto: any): Layer { requestedColor, cornerRadiusCrop, inputTransform, - inputRegion + inputRegion, + excludesCompositionState ); const entry = new Layer( - /* name */ proto.name ?? ``, + /* name */ proto.name ?? ``, /* id */ proto.id, - /*parentId */ proto.parent, + /*parentId */ proto.parent, /* z */ proto.z, /* currFrame */ proto.currFrame, properties diff --git a/tools/winscope-ng/src/common/trace/flickerlib/layers/LayerTraceEntry.ts b/tools/winscope-ng/src/common/trace/flickerlib/layers/LayerTraceEntry.ts index 649daf8af..fd60f3901 100644 --- a/tools/winscope-ng/src/common/trace/flickerlib/layers/LayerTraceEntry.ts +++ b/tools/winscope-ng/src/common/trace/flickerlib/layers/LayerTraceEntry.ts @@ -28,9 +28,10 @@ LayerTraceEntry.fromProto = function ( hwcBlob: string, where = "", realToElapsedTimeOffsetNs: bigint|undefined = undefined, - useElapsedTime = false + useElapsedTime = false, + excludesCompositionState = false ): LayerTraceEntry { - const layers = protos.map(it => Layer.fromProto(it)); + const layers = protos.map(it => Layer.fromProto(it, excludesCompositionState)); const displays = (displayProtos || []).map(it => newDisplay(it)); const builder = new LayerTraceEntryBuilder( `${elapsedTimestamp}`, diff --git a/tools/winscope-ng/src/parsers/parser_surface_flinger.ts b/tools/winscope-ng/src/parsers/parser_surface_flinger.ts index 359c9a7ea..2920c4978 100644 --- a/tools/winscope-ng/src/parsers/parser_surface_flinger.ts +++ b/tools/winscope-ng/src/parsers/parser_surface_flinger.ts @@ -37,8 +37,8 @@ class ParserSurfaceFlinger extends Parser { const decoded = LayersTraceFileProto.decode(buffer); if (Object.prototype.hasOwnProperty.call(decoded, "realToElapsedTimeOffsetNanos")) { this.realToElapsedTimeOffsetNs = BigInt(decoded.realToElapsedTimeOffsetNanos); - } - else { + } else { + console.warn("Missing realToElapsedTimeOffsetNanos property on SF trace proto"); this.realToElapsedTimeOffsetNs = undefined; } return decoded.entry; @@ -68,7 +68,8 @@ class ParserSurfaceFlinger extends Parser { entryProto.hwcBlob, entryProto.where, this.realToElapsedTimeOffsetNs, - timestampType === TimestampType.ELAPSED /*useElapsedTime*/ + timestampType === TimestampType.ELAPSED /*useElapsedTime*/, + entryProto.excludesCompositionState ?? false ); }