Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 488cb9b8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "SF: add traces for caching" into sc-dev am: 886b4e08

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14669182

Change-Id: Ib84b927e5604cf5d331c8b2fb3b17a1bbbb08a18
parents 3af8f68e 886b4e08
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
#undef LOG_TAG
#undef LOG_TAG
#define LOG_TAG "Planner"
#define LOG_TAG "Planner"
// #define LOG_NDEBUG 0
// #define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_GRAPHICS


#include <android-base/properties.h>
#include <android-base/properties.h>
#include <compositionengine/impl/OutputCompositionState.h>
#include <compositionengine/impl/OutputCompositionState.h>
@@ -25,6 +26,8 @@
#include <renderengine/DisplaySettings.h>
#include <renderengine/DisplaySettings.h>
#include <renderengine/RenderEngine.h>
#include <renderengine/RenderEngine.h>


#include <utils/Trace.h>

namespace android::compositionengine::impl::planner {
namespace android::compositionengine::impl::planner {


const bool CachedSet::sDebugHighlighLayers =
const bool CachedSet::sDebugHighlighLayers =
@@ -154,6 +157,7 @@ void CachedSet::updateAge(std::chrono::steady_clock::time_point now) {


void CachedSet::render(renderengine::RenderEngine& renderEngine,
void CachedSet::render(renderengine::RenderEngine& renderEngine,
                       const OutputCompositionState& outputState) {
                       const OutputCompositionState& outputState) {
    ATRACE_CALL();
    const Rect& viewport = outputState.layerStackSpace.content;
    const Rect& viewport = outputState.layerStackSpace.content;
    const ui::Dataspace& outputDataspace = outputState.dataspace;
    const ui::Dataspace& outputDataspace = outputState.dataspace;
    const ui::Transform::RotationFlags orientation =
    const ui::Transform::RotationFlags orientation =
+8 −0
Original line number Original line Diff line number Diff line
@@ -17,10 +17,13 @@
#undef LOG_TAG
#undef LOG_TAG
#define LOG_TAG "Planner"
#define LOG_TAG "Planner"
// #define LOG_NDEBUG 0
// #define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_GRAPHICS


#include <compositionengine/impl/planner/Flattener.h>
#include <compositionengine/impl/planner/Flattener.h>
#include <compositionengine/impl/planner/LayerState.h>
#include <compositionengine/impl/planner/LayerState.h>


#include <utils/Trace.h>

using time_point = std::chrono::steady_clock::time_point;
using time_point = std::chrono::steady_clock::time_point;
using namespace std::chrono_literals;
using namespace std::chrono_literals;


@@ -58,6 +61,7 @@ bool isSameStack(const std::vector<const LayerState*>& incomingLayers,


NonBufferHash Flattener::flattenLayers(const std::vector<const LayerState*>& layers,
NonBufferHash Flattener::flattenLayers(const std::vector<const LayerState*>& layers,
                                       NonBufferHash hash, time_point now) {
                                       NonBufferHash hash, time_point now) {
    ATRACE_CALL();
    const size_t unflattenedDisplayCost = calculateDisplayCost(layers);
    const size_t unflattenedDisplayCost = calculateDisplayCost(layers);
    mUnflattenedDisplayCost += unflattenedDisplayCost;
    mUnflattenedDisplayCost += unflattenedDisplayCost;


@@ -91,6 +95,7 @@ NonBufferHash Flattener::flattenLayers(const std::vector<const LayerState*>& lay


void Flattener::renderCachedSets(renderengine::RenderEngine& renderEngine,
void Flattener::renderCachedSets(renderengine::RenderEngine& renderEngine,
                                 const OutputCompositionState& outputState) {
                                 const OutputCompositionState& outputState) {
    ATRACE_CALL();
    if (!mNewCachedSet || mNewCachedSet->hasRenderedBuffer()) {
    if (!mNewCachedSet || mNewCachedSet->hasRenderedBuffer()) {
        return;
        return;
    }
    }
@@ -213,6 +218,7 @@ NonBufferHash Flattener::computeLayersHash() const{
// was already populated with these layers, i.e. on the second and following
// was already populated with these layers, i.e. on the second and following
// calls with the same geometry.
// calls with the same geometry.
bool Flattener::mergeWithCachedSets(const std::vector<const LayerState*>& layers, time_point now) {
bool Flattener::mergeWithCachedSets(const std::vector<const LayerState*>& layers, time_point now) {
    ATRACE_CALL();
    std::vector<CachedSet> merged;
    std::vector<CachedSet> merged;


    if (mLayers.empty()) {
    if (mLayers.empty()) {
@@ -328,6 +334,7 @@ bool Flattener::mergeWithCachedSets(const std::vector<const LayerState*>& layers
}
}


std::vector<Flattener::Run> Flattener::findCandidateRuns(time_point now) const {
std::vector<Flattener::Run> Flattener::findCandidateRuns(time_point now) const {
    ATRACE_CALL();
    std::vector<Run> runs;
    std::vector<Run> runs;
    bool isPartOfRun = false;
    bool isPartOfRun = false;
    Run::Builder builder;
    Run::Builder builder;
@@ -388,6 +395,7 @@ std::optional<Flattener::Run> Flattener::findBestRun(std::vector<Flattener::Run>
}
}


void Flattener::buildCachedSets(time_point now) {
void Flattener::buildCachedSets(time_point now) {
    ATRACE_CALL();
    if (mLayers.empty()) {
    if (mLayers.empty()) {
        ALOGV("[%s] No layers found, returning", __func__);
        ALOGV("[%s] No layers found, returning", __func__);
        return;
        return;
+6 −0
Original line number Original line Diff line number Diff line
@@ -18,12 +18,15 @@


#undef LOG_TAG
#undef LOG_TAG
#define LOG_TAG "Planner"
#define LOG_TAG "Planner"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS


#include <android-base/properties.h>
#include <android-base/properties.h>
#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
#include <compositionengine/impl/planner/Planner.h>
#include <compositionengine/impl/planner/Planner.h>


#include <utils/Trace.h>

namespace android::compositionengine::impl::planner {
namespace android::compositionengine::impl::planner {


Planner::Planner()
Planner::Planner()
@@ -41,6 +44,7 @@ void Planner::setDisplaySize(ui::Size size) {


void Planner::plan(
void Planner::plan(
        compositionengine::Output::OutputLayersEnumerator<compositionengine::Output>&& layers) {
        compositionengine::Output::OutputLayersEnumerator<compositionengine::Output>&& layers) {
    ATRACE_CALL();
    std::unordered_set<LayerId> removedLayers;
    std::unordered_set<LayerId> removedLayers;
    removedLayers.reserve(mPreviousLayers.size());
    removedLayers.reserve(mPreviousLayers.size());


@@ -119,6 +123,7 @@ void Planner::plan(


void Planner::reportFinalPlan(
void Planner::reportFinalPlan(
        compositionengine::Output::OutputLayersEnumerator<compositionengine::Output>&& layers) {
        compositionengine::Output::OutputLayersEnumerator<compositionengine::Output>&& layers) {
    ATRACE_CALL();
    if (!mPredictorEnabled) {
    if (!mPredictorEnabled) {
        return;
        return;
    }
    }
@@ -156,6 +161,7 @@ void Planner::reportFinalPlan(


void Planner::renderCachedSets(renderengine::RenderEngine& renderEngine,
void Planner::renderCachedSets(renderengine::RenderEngine& renderEngine,
                               const OutputCompositionState& outputState) {
                               const OutputCompositionState& outputState) {
    ATRACE_CALL();
    mFlattener.renderCachedSets(renderEngine, outputState);
    mFlattener.renderCachedSets(renderEngine, outputState);
}
}