diff options
author | 2022-11-12 12:48:38 +0000 | |
---|---|---|
committer | 2022-11-12 12:48:38 +0000 | |
commit | 7ccb22dba3001f19de7363701b9aab08b63e3e77 (patch) | |
tree | 9b182b616b1e9a771e3fd046a92c65eb99264e04 | |
parent | b9262123561e07c3dbc721fd2e1ee4db6160d92e (diff) | |
parent | 5a655b8d00ba8fbd0c876ed0c075e2e8b649935d (diff) |
Merge "Add display name and id to traces"
5 files changed, 23 insertions, 6 deletions
diff --git a/libs/renderengine/include/renderengine/DisplaySettings.h b/libs/renderengine/include/renderengine/DisplaySettings.h index 25fe9f2d8e..8d7c13cb18 100644 --- a/libs/renderengine/include/renderengine/DisplaySettings.h +++ b/libs/renderengine/include/renderengine/DisplaySettings.h @@ -23,17 +23,24 @@ #include <math/mat4.h> #include <renderengine/PrintMatrix.h> #include <renderengine/BorderRenderInfo.h> +#include <ui/DisplayId.h> #include <ui/GraphicTypes.h> #include <ui/Rect.h> #include <ui/Region.h> #include <ui/Transform.h> +#include <optional> + namespace android { namespace renderengine { // DisplaySettings contains the settings that are applicable when drawing all // layers for a given display. struct DisplaySettings { + // A string containing the name of the display, along with its id, if it has + // one. + std::string namePlusId; + // Rectangle describing the physical display. We will project from the // logical clip onto this rectangle. Rect physicalDisplay = Rect::INVALID_RECT; @@ -85,8 +92,8 @@ struct DisplaySettings { }; static inline bool operator==(const DisplaySettings& lhs, const DisplaySettings& rhs) { - return lhs.physicalDisplay == rhs.physicalDisplay && lhs.clip == rhs.clip && - lhs.maxLuminance == rhs.maxLuminance && + return lhs.namePlusId == rhs.namePlusId && lhs.physicalDisplay == rhs.physicalDisplay && + lhs.clip == rhs.clip && lhs.maxLuminance == rhs.maxLuminance && lhs.currentLuminanceNits == rhs.currentLuminanceNits && lhs.outputDataspace == rhs.outputDataspace && lhs.colorTransform == rhs.colorTransform && @@ -121,6 +128,7 @@ static const char* orientation_to_string(uint32_t orientation) { static inline void PrintTo(const DisplaySettings& settings, ::std::ostream* os) { *os << "DisplaySettings {"; + *os << "\n .display = " << settings.namePlusId; *os << "\n .physicalDisplay = "; PrintTo(settings.physicalDisplay, os); *os << "\n .clip = "; diff --git a/libs/renderengine/skia/SkiaRenderEngine.cpp b/libs/renderengine/skia/SkiaRenderEngine.cpp index b9aa5acd30..fca6c0e486 100644 --- a/libs/renderengine/skia/SkiaRenderEngine.cpp +++ b/libs/renderengine/skia/SkiaRenderEngine.cpp @@ -636,7 +636,7 @@ void SkiaRenderEngine::drawLayersInternal( const DisplaySettings& display, const std::vector<LayerSettings>& layers, const std::shared_ptr<ExternalTexture>& buffer, const bool /*useFramebufferCache*/, base::unique_fd&& bufferFence) { - ATRACE_NAME("SkiaGL::drawLayersInternal"); + ATRACE_FORMAT("%s for %s", __func__, display.namePlusId.c_str()); std::lock_guard<std::mutex> lock(mRenderingMutex); diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/Output.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/Output.h index e06da33025..9ca5da95bb 100644 --- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/Output.h +++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/Output.h @@ -155,6 +155,8 @@ protected: bool mustRecompose() const; + const std::string& getNamePlusId() const { return mNamePlusId; } + private: void dirtyEntireOutput(); void updateCompositionStateForBorder(const compositionengine::CompositionRefreshArgs&); @@ -165,6 +167,7 @@ private: const compositionengine::CompositionRefreshArgs&) const; std::string mName; + std::string mNamePlusId; std::unique_ptr<compositionengine::DisplayColorProfile> mDisplayColorProfile; std::unique_ptr<compositionengine::RenderSurface> mRenderSurface; diff --git a/services/surfaceflinger/CompositionEngine/src/Display.cpp b/services/surfaceflinger/CompositionEngine/src/Display.cpp index 1c5cbedd88..24669c2ff5 100644 --- a/services/surfaceflinger/CompositionEngine/src/Display.cpp +++ b/services/surfaceflinger/CompositionEngine/src/Display.cpp @@ -25,6 +25,7 @@ #include <compositionengine/impl/DumpHelpers.h> #include <compositionengine/impl/OutputLayer.h> #include <compositionengine/impl/RenderSurface.h> +#include <gui/TraceUtils.h> #include <utils/Trace.h> @@ -235,7 +236,7 @@ void Display::beginFrame() { bool Display::chooseCompositionStrategy( std::optional<android::HWComposer::DeviceRequestedChanges>* outChanges) { - ATRACE_CALL(); + ATRACE_FORMAT("%s for %s", __func__, getNamePlusId().c_str()); ALOGV(__FUNCTION__); if (mIsDisconnected) { diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp index d1daca6090..3ee8017d39 100644 --- a/services/surfaceflinger/CompositionEngine/src/Output.cpp +++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp @@ -29,6 +29,7 @@ #include <compositionengine/impl/OutputLayerCompositionState.h> #include <compositionengine/impl/planner/Planner.h> #include <ftl/future.h> +#include <gui/TraceUtils.h> #include <thread> @@ -116,6 +117,9 @@ const std::string& Output::getName() const { void Output::setName(const std::string& name) { mName = name; + auto displayIdOpt = getDisplayId(); + mNamePlusId = base::StringPrintf("%s (%s)", mName.c_str(), + displayIdOpt ? to_string(*displayIdOpt).c_str() : "NA"); } void Output::setCompositionEnabled(bool enabled) { @@ -427,7 +431,7 @@ void Output::prepare(const compositionengine::CompositionRefreshArgs& refreshArg } void Output::present(const compositionengine::CompositionRefreshArgs& refreshArgs) { - ATRACE_CALL(); + ATRACE_FORMAT("%s for %s", __func__, mNamePlusId.c_str()); ALOGV(__FUNCTION__); updateColorProfile(refreshArgs); @@ -1322,6 +1326,7 @@ renderengine::DisplaySettings Output::generateClientCompositionDisplaySettings() const auto& outputState = getState(); renderengine::DisplaySettings clientCompositionDisplay; + clientCompositionDisplay.namePlusId = mNamePlusId; clientCompositionDisplay.physicalDisplay = outputState.framebufferSpace.getContent(); clientCompositionDisplay.clip = outputState.layerStackSpace.getContent(); clientCompositionDisplay.orientation = @@ -1488,7 +1493,7 @@ bool Output::isPowerHintSessionEnabled() { } void Output::postFramebuffer() { - ATRACE_CALL(); + ATRACE_FORMAT("%s for %s", __func__, mNamePlusId.c_str()); ALOGV(__FUNCTION__); if (!getState().isEnabled) { |