summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/LayerProtoHelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/surfaceflinger/LayerProtoHelper.cpp')
-rw-r--r--services/surfaceflinger/LayerProtoHelper.cpp83
1 files changed, 35 insertions, 48 deletions
diff --git a/services/surfaceflinger/LayerProtoHelper.cpp b/services/surfaceflinger/LayerProtoHelper.cpp
index 144e1f5abf..341f041086 100644
--- a/services/surfaceflinger/LayerProtoHelper.cpp
+++ b/services/surfaceflinger/LayerProtoHelper.cpp
@@ -29,30 +29,28 @@ using gui::WindowInfo;
namespace surfaceflinger {
-void LayerProtoHelper::writePositionToProto(
- const float x, const float y,
- std::function<perfetto::protos::PositionProto*()> getPositionProto) {
+void LayerProtoHelper::writePositionToProto(const float x, const float y,
+ std::function<PositionProto*()> getPositionProto) {
if (x != 0 || y != 0) {
// Use a lambda do avoid writing the object header when the object is empty
- perfetto::protos::PositionProto* position = getPositionProto();
+ PositionProto* position = getPositionProto();
position->set_x(x);
position->set_y(y);
}
}
-void LayerProtoHelper::writeSizeToProto(
- const uint32_t w, const uint32_t h,
- std::function<perfetto::protos::SizeProto*()> getSizeProto) {
+void LayerProtoHelper::writeSizeToProto(const uint32_t w, const uint32_t h,
+ std::function<SizeProto*()> getSizeProto) {
if (w != 0 || h != 0) {
// Use a lambda do avoid writing the object header when the object is empty
- perfetto::protos::SizeProto* size = getSizeProto();
+ SizeProto* size = getSizeProto();
size->set_w(w);
size->set_h(h);
}
}
-void LayerProtoHelper::writeToProto(
- const Region& region, std::function<perfetto::protos::RegionProto*()> getRegionProto) {
+void LayerProtoHelper::writeToProto(const Region& region,
+ std::function<RegionProto*()> getRegionProto) {
if (region.isEmpty()) {
return;
}
@@ -60,8 +58,7 @@ void LayerProtoHelper::writeToProto(
writeToProto(region, getRegionProto());
}
-void LayerProtoHelper::writeToProto(const Region& region,
- perfetto::protos::RegionProto* regionProto) {
+void LayerProtoHelper::writeToProto(const Region& region, RegionProto* regionProto) {
if (region.isEmpty()) {
return;
}
@@ -75,8 +72,7 @@ void LayerProtoHelper::writeToProto(const Region& region,
}
}
-void LayerProtoHelper::readFromProto(const perfetto::protos::RegionProto& regionProto,
- Region& outRegion) {
+void LayerProtoHelper::readFromProto(const RegionProto& regionProto, Region& outRegion) {
for (int i = 0; i < regionProto.rect_size(); i++) {
Rect rect;
readFromProto(regionProto.rect(i), rect);
@@ -84,34 +80,32 @@ void LayerProtoHelper::readFromProto(const perfetto::protos::RegionProto& region
}
}
-void LayerProtoHelper::writeToProto(const Rect& rect,
- std::function<perfetto::protos::RectProto*()> getRectProto) {
+void LayerProtoHelper::writeToProto(const Rect& rect, std::function<RectProto*()> getRectProto) {
if (rect.left != 0 || rect.right != 0 || rect.top != 0 || rect.bottom != 0) {
// Use a lambda do avoid writing the object header when the object is empty
writeToProto(rect, getRectProto());
}
}
-void LayerProtoHelper::writeToProto(const Rect& rect, perfetto::protos::RectProto* rectProto) {
+void LayerProtoHelper::writeToProto(const Rect& rect, RectProto* rectProto) {
rectProto->set_left(rect.left);
rectProto->set_top(rect.top);
rectProto->set_bottom(rect.bottom);
rectProto->set_right(rect.right);
}
-void LayerProtoHelper::readFromProto(const perfetto::protos::RectProto& proto, Rect& outRect) {
+void LayerProtoHelper::readFromProto(const RectProto& proto, Rect& 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<perfetto::protos::FloatRectProto*()> getFloatRectProto) {
+void LayerProtoHelper::writeToProto(const FloatRect& rect,
+ std::function<FloatRectProto*()> getFloatRectProto) {
if (rect.left != 0 || rect.right != 0 || rect.top != 0 || rect.bottom != 0) {
// Use a lambda do avoid writing the object header when the object is empty
- perfetto::protos::FloatRectProto* rectProto = getFloatRectProto();
+ FloatRectProto* rectProto = getFloatRectProto();
rectProto->set_left(rect.left);
rectProto->set_top(rect.top);
rectProto->set_bottom(rect.bottom);
@@ -119,11 +113,10 @@ void LayerProtoHelper::writeToProto(
}
}
-void LayerProtoHelper::writeToProto(const half4 color,
- std::function<perfetto::protos::ColorProto*()> getColorProto) {
+void LayerProtoHelper::writeToProto(const half4 color, std::function<ColorProto*()> getColorProto) {
if (color.r != 0 || color.g != 0 || color.b != 0 || color.a != 0) {
// Use a lambda do avoid writing the object header when the object is empty
- perfetto::protos::ColorProto* colorProto = getColorProto();
+ ColorProto* colorProto = getColorProto();
colorProto->set_r(color.r);
colorProto->set_g(color.g);
colorProto->set_b(color.b);
@@ -132,7 +125,7 @@ void LayerProtoHelper::writeToProto(const half4 color,
}
void LayerProtoHelper::writeToProtoDeprecated(const ui::Transform& transform,
- perfetto::protos::TransformProto* transformProto) {
+ TransformProto* transformProto) {
const uint32_t type = transform.getType() | (transform.getOrientation() << 8);
transformProto->set_type(type);
@@ -148,7 +141,7 @@ void LayerProtoHelper::writeToProtoDeprecated(const ui::Transform& transform,
}
void LayerProtoHelper::writeTransformToProto(const ui::Transform& transform,
- perfetto::protos::TransformProto* transformProto) {
+ TransformProto* transformProto) {
const uint32_t type = transform.getType() | (transform.getOrientation() << 8);
transformProto->set_type(type);
@@ -163,13 +156,12 @@ void LayerProtoHelper::writeTransformToProto(const ui::Transform& transform,
}
}
-void LayerProtoHelper::writeToProto(
- const renderengine::ExternalTexture& buffer,
- std::function<perfetto::protos::ActiveBufferProto*()> getActiveBufferProto) {
+void LayerProtoHelper::writeToProto(const renderengine::ExternalTexture& buffer,
+ std::function<ActiveBufferProto*()> getActiveBufferProto) {
if (buffer.getWidth() != 0 || buffer.getHeight() != 0 || buffer.getUsage() != 0 ||
buffer.getPixelFormat() != 0) {
// Use a lambda do avoid writing the object header when the object is empty
- auto* activeBufferProto = getActiveBufferProto();
+ ActiveBufferProto* activeBufferProto = getActiveBufferProto();
activeBufferProto->set_width(buffer.getWidth());
activeBufferProto->set_height(buffer.getHeight());
activeBufferProto->set_stride(buffer.getUsage());
@@ -179,12 +171,12 @@ void LayerProtoHelper::writeToProto(
void LayerProtoHelper::writeToProto(
const WindowInfo& inputInfo, const wp<Layer>& touchableRegionBounds,
- std::function<perfetto::protos::InputWindowInfoProto*()> getInputWindowInfoProto) {
+ std::function<InputWindowInfoProto*()> getInputWindowInfoProto) {
if (inputInfo.token == nullptr) {
return;
}
- perfetto::protos::InputWindowInfoProto* proto = getInputWindowInfoProto();
+ InputWindowInfoProto* proto = getInputWindowInfoProto();
proto->set_layout_params_flags(inputInfo.layoutParamsFlags.get());
proto->set_input_config(inputInfo.inputConfig.get());
using U = std::underlying_type_t<WindowInfo::Type>;
@@ -217,8 +209,7 @@ void LayerProtoHelper::writeToProto(
}
}
-void LayerProtoHelper::writeToProto(const mat4 matrix,
- perfetto::protos::ColorTransformProto* colorTransformProto) {
+void LayerProtoHelper::writeToProto(const mat4 matrix, ColorTransformProto* colorTransformProto) {
for (int i = 0; i < mat4::ROW_SIZE; i++) {
for (int j = 0; j < mat4::COL_SIZE; j++) {
colorTransformProto->add_val(matrix[i][j]);
@@ -226,8 +217,7 @@ void LayerProtoHelper::writeToProto(const mat4 matrix,
}
}
-void LayerProtoHelper::readFromProto(
- const perfetto::protos::ColorTransformProto& colorTransformProto, mat4& matrix) {
+void LayerProtoHelper::readFromProto(const ColorTransformProto& colorTransformProto, mat4& matrix) {
for (int i = 0; i < mat4::ROW_SIZE; i++) {
for (int j = 0; j < mat4::COL_SIZE; j++) {
matrix[i][j] = colorTransformProto.val(i * mat4::COL_SIZE + j);
@@ -235,8 +225,7 @@ void LayerProtoHelper::readFromProto(
}
}
-void LayerProtoHelper::writeToProto(const android::BlurRegion region,
- perfetto::protos::BlurRegion* proto) {
+void LayerProtoHelper::writeToProto(const android::BlurRegion region, BlurRegion* proto) {
proto->set_blur_radius(region.blurRadius);
proto->set_corner_radius_tl(region.cornerRadiusTL);
proto->set_corner_radius_tr(region.cornerRadiusTR);
@@ -249,8 +238,7 @@ void LayerProtoHelper::writeToProto(const android::BlurRegion region,
proto->set_bottom(region.bottom);
}
-void LayerProtoHelper::readFromProto(const perfetto::protos::BlurRegion& proto,
- android::BlurRegion& outRegion) {
+void LayerProtoHelper::readFromProto(const BlurRegion& proto, android::BlurRegion& outRegion) {
outRegion.blurRadius = proto.blur_radius();
outRegion.cornerRadiusTL = proto.corner_radius_tl();
outRegion.cornerRadiusTR = proto.corner_radius_tr();
@@ -263,8 +251,7 @@ void LayerProtoHelper::readFromProto(const perfetto::protos::BlurRegion& proto,
outRegion.bottom = proto.bottom();
}
-perfetto::protos::LayersProto LayerProtoFromSnapshotGenerator::generate(
- const frontend::LayerHierarchy& root) {
+LayersProto LayerProtoFromSnapshotGenerator::generate(const frontend::LayerHierarchy& root) {
mLayersProto.clear_layers();
std::unordered_set<uint64_t> stackIdsToSkip;
if ((mTraceFlags & LayerTracing::TRACE_VIRTUAL_DISPLAYS) == 0) {
@@ -323,7 +310,7 @@ frontend::LayerSnapshot* LayerProtoFromSnapshotGenerator::getSnapshot(
void LayerProtoFromSnapshotGenerator::writeHierarchyToProto(
const frontend::LayerHierarchy& root, frontend::LayerHierarchy::TraversalPath& path) {
using Variant = frontend::LayerHierarchy::Variant;
- perfetto::protos::LayerProto* layerProto = mLayersProto.add_layers();
+ LayerProto* layerProto = mLayersProto.add_layers();
const frontend::RequestedLayerState& layer = *root.getLayer();
frontend::LayerSnapshot* snapshot = getSnapshot(path, layer);
LayerProtoHelper::writeSnapshotToProto(layerProto, layer, *snapshot, mTraceFlags);
@@ -362,7 +349,7 @@ void LayerProtoFromSnapshotGenerator::writeHierarchyToProto(
}
}
-void LayerProtoHelper::writeSnapshotToProto(perfetto::protos::LayerProto* layerInfo,
+void LayerProtoHelper::writeSnapshotToProto(LayerProto* layerInfo,
const frontend::RequestedLayerState& requestedState,
const frontend::LayerSnapshot& snapshot,
uint32_t traceFlags) {
@@ -459,9 +446,9 @@ void LayerProtoHelper::writeSnapshotToProto(perfetto::protos::LayerProto* layerI
[&]() { return layerInfo->mutable_destination_frame(); });
}
-google::protobuf::RepeatedPtrField<perfetto::protos::DisplayProto>
-LayerProtoHelper::writeDisplayInfoToProto(const frontend::DisplayInfos& displayInfos) {
- google::protobuf::RepeatedPtrField<perfetto::protos::DisplayProto> displays;
+google::protobuf::RepeatedPtrField<DisplayProto> LayerProtoHelper::writeDisplayInfoToProto(
+ const frontend::DisplayInfos& displayInfos) {
+ google::protobuf::RepeatedPtrField<DisplayProto> displays;
displays.Reserve(displayInfos.size());
for (const auto& [layerStack, displayInfo] : displayInfos) {
auto displayProto = displays.Add();