Implement Display Layer Stats V0.1
Try to collect data for analyzing how many display controller layers we
need and what we use them for. This change will collect additional data
from per frame point of view.
Test: adb shell dumpsys SurfaceFlinger --enable-layer-stats
Test: adb shell dumpsys SurfaceFlinger --disable-layer-stats
Test: adb shell dumpsys SurfaceFlinger --clear-layer-stats
Test: adb shell dumpsys SurfaceFlinger --dump-layer-stats
Bug: b/75953772
Change-Id: Ib48777df7e1fed637be7eb1aefbdf1808d1daccd
Merged-In: Ib48777df7e1fed637be7eb1aefbdf1808d1daccd
diff --git a/services/surfaceflinger/layerproto/LayerProtoParser.cpp b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
index cef6c21..fcf42f0 100644
--- a/services/surfaceflinger/layerproto/LayerProtoParser.cpp
+++ b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
@@ -44,7 +44,12 @@
const LayerProtoParser::LayerGlobal LayerProtoParser::generateLayerGlobalInfo(
const LayersProto& layersProto) {
- return {{layersProto.resolution().w(), layersProto.resolution().h()}};
+ LayerGlobal layerGlobal;
+ layerGlobal.resolution = {layersProto.resolution().w(), layersProto.resolution().h()};
+ layerGlobal.colorMode = layersProto.color_mode();
+ layerGlobal.colorTransform = layersProto.color_transform();
+ layerGlobal.globalTransform = layersProto.global_transform();
+ return layerGlobal;
}
std::vector<std::unique_ptr<LayerProtoParser::Layer>> LayerProtoParser::generateLayerTree(
@@ -116,6 +121,8 @@
layer->hwcTransform = layerProto.hwc_transform();
layer->windowType = layerProto.window_type();
layer->appId = layerProto.app_id();
+ layer->hwcCompositionType = layerProto.hwc_composition_type();
+ layer->isProtected = layerProto.is_protected();
return layer;
}
diff --git a/services/surfaceflinger/layerproto/include/layerproto/LayerProtoParser.h b/services/surfaceflinger/layerproto/include/layerproto/LayerProtoParser.h
index fd893da..74a6f28 100644
--- a/services/surfaceflinger/layerproto/include/layerproto/LayerProtoParser.h
+++ b/services/surfaceflinger/layerproto/include/layerproto/LayerProtoParser.h
@@ -112,6 +112,8 @@
int32_t hwcTransform;
int32_t windowType;
int32_t appId;
+ int32_t hwcCompositionType;
+ bool isProtected;
std::string to_string() const;
};
@@ -119,6 +121,9 @@
class LayerGlobal {
public:
int2 resolution;
+ std::string colorMode;
+ std::string colorTransform;
+ int32_t globalTransform;
};
static const LayerGlobal generateLayerGlobalInfo(const LayersProto& layersProto);
diff --git a/services/surfaceflinger/layerproto/layers.proto b/services/surfaceflinger/layerproto/layers.proto
index 6675aae..77c6675 100644
--- a/services/surfaceflinger/layerproto/layers.proto
+++ b/services/surfaceflinger/layerproto/layers.proto
@@ -8,6 +8,9 @@
message LayersProto {
repeated LayerProto layers = 1;
optional SizeProto resolution = 2;
+ optional string color_mode = 3;
+ optional string color_transform = 4;
+ optional int32 global_transform = 5;
}
// Information about each layer.
@@ -73,6 +76,10 @@
optional int32 hwc_transform = 32;
optional int32 window_type = 33;
optional int32 app_id = 34;
+ // The layer's composition type
+ optional int32 hwc_composition_type = 35;
+ // If it's a buffer layer, indicate if the content is protected
+ optional bool is_protected = 36;
}
message PositionProto {