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

Commit d0afe44a authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: add traces for caching

Bug: 188825465
Test: enable caching and observe traces
Change-Id: I9dfd4ef22d1532553e94ed28a66aae2e4ec4a68b
parent 9a049d86
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#undef LOG_TAG
#define LOG_TAG "Planner"
// #define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

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

#include <utils/Trace.h>

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

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

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

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

#include <utils/Trace.h>

using time_point = std::chrono::steady_clock::time_point;
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 hash, time_point now) {
    ATRACE_CALL();
    const size_t unflattenedDisplayCost = calculateDisplayCost(layers);
    mUnflattenedDisplayCost += unflattenedDisplayCost;

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

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

    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 {
    ATRACE_CALL();
    std::vector<Run> runs;
    bool isPartOfRun = false;
    Run::Builder builder;
@@ -388,6 +395,7 @@ std::optional<Flattener::Run> Flattener::findBestRun(std::vector<Flattener::Run>
}

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

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

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

#include <utils/Trace.h>

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

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

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

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

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

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