From a9123c8b69422dfff377e3b07746dec48e91dc60 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 3 Oct 2024 03:56:44 +0000 Subject: Support floating point values for layer crop Flag: EXEMPT bug fix Fixes: 310950423 Test: presubmit Change-Id: I05feb4881a95bc8caad90a3d632b3c7881909bf3 --- services/surfaceflinger/LayerProtoHelper.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'services/surfaceflinger/LayerProtoHelper.cpp') diff --git a/services/surfaceflinger/LayerProtoHelper.cpp b/services/surfaceflinger/LayerProtoHelper.cpp index 5eea45b436..a0fbab0728 100644 --- a/services/surfaceflinger/LayerProtoHelper.cpp +++ b/services/surfaceflinger/LayerProtoHelper.cpp @@ -106,6 +106,13 @@ void LayerProtoHelper::readFromProto(const perfetto::protos::RectProto& proto, R outRect.right = proto.right(); } +void LayerProtoHelper::readFromProto(const perfetto::protos::RectProto& proto, FloatRect& outRect) { + outRect.left = proto.left(); + outRect.top = proto.top(); + outRect.bottom = proto.bottom(); + outRect.right = proto.right(); +} + void LayerProtoHelper::writeToProto( const FloatRect& rect, std::function getFloatRectProto) { @@ -427,7 +434,7 @@ void LayerProtoHelper::writeSnapshotToProto(perfetto::protos::LayerProto* layerI layerInfo->mutable_color_transform()); } - LayerProtoHelper::writeToProto(snapshot.croppedBufferSize.toFloatRect(), + LayerProtoHelper::writeToProto(snapshot.croppedBufferSize, [&]() { return layerInfo->mutable_source_bounds(); }); LayerProtoHelper::writeToProto(snapshot.transformedBounds, [&]() { return layerInfo->mutable_screen_bounds(); }); @@ -455,7 +462,7 @@ void LayerProtoHelper::writeSnapshotToProto(perfetto::protos::LayerProto* layerI return layerInfo->mutable_requested_position(); }); - LayerProtoHelper::writeToProto(requestedState.crop, + LayerProtoHelper::writeToProto(Rect(requestedState.crop), [&]() { return layerInfo->mutable_crop(); }); layerInfo->set_is_opaque(snapshot.contentOpaque); -- cgit v1.2.3-59-g8ed1b From 86bf84f8468f16e9d415f36c41c40a301652a335 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Mon, 14 Oct 2024 18:53:25 +0000 Subject: SF: Trace input info whenever it is present, even if input token is null The bug is that if inputInfo.token is null, the function will return early without writing anything to the proto. This is incorrect, as the proto should still be written even if inputInfo.token is null, since the input window can have a touchable region that can affect input dispatching. For example, the various "input sink" windows usually have input info, but set the NO_INPUT_CHANNEL flag and thus have null input channels and tokens. This CL fixes the bug by removing the if statement that checks if inputInfo.token is null. Bug: 373401882 Change-Id: Ide2ebf4a932139dac766101bb52921ff64b02899 Test: manual: take input trace with winscope, and look for input sinks Flag: EXEMPT bug fix --- services/surfaceflinger/LayerProtoHelper.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'services/surfaceflinger/LayerProtoHelper.cpp') diff --git a/services/surfaceflinger/LayerProtoHelper.cpp b/services/surfaceflinger/LayerProtoHelper.cpp index a0fbab0728..44cd3194bc 100644 --- a/services/surfaceflinger/LayerProtoHelper.cpp +++ b/services/surfaceflinger/LayerProtoHelper.cpp @@ -187,10 +187,6 @@ void LayerProtoHelper::writeToProto( void LayerProtoHelper::writeToProto( const WindowInfo& inputInfo, std::function getInputWindowInfoProto) { - if (inputInfo.token == nullptr) { - return; - } - perfetto::protos::InputWindowInfoProto* proto = getInputWindowInfoProto(); proto->set_layout_params_flags(inputInfo.layoutParamsFlags.get()); proto->set_input_config(inputInfo.inputConfig.get()); -- cgit v1.2.3-59-g8ed1b