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

Commit ee5894f8 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "Create a wrapper for atrace macros" into main

parents 19496401 be0ad90f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#include <cinttypes>

#include <android-base/stringprintf.h>
#include <gui/TraceUtils.h>
#include <common/trace.h>
#include <renderengine/impl/ExternalTexture.h>

#include "ClientCache.h"
+5 −5
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
 * limitations under the License.
 */

#include <common/trace.h>
#include <compositionengine/CompositionRefreshArgs.h>
#include <compositionengine/LayerFE.h>
#include <compositionengine/LayerFECompositionState.h>
@@ -23,7 +24,6 @@
#include <ui/DisplayMap.h>

#include <renderengine/RenderEngine.h>
#include <utils/Trace.h>

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
@@ -128,7 +128,7 @@ void offloadOutputs(Outputs& outputs) {
} // namespace

void CompositionEngine::present(CompositionRefreshArgs& args) {
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    preComposition(args);
@@ -155,7 +155,7 @@ void CompositionEngine::present(CompositionRefreshArgs& args) {
    }

    {
        ATRACE_NAME("Waiting on HWC");
        SFTRACE_NAME("Waiting on HWC");
        for (auto& future : presentFutures) {
            // TODO(b/185536303): Call ftl::Future::wait() once it exists, since
            // we do not need the return value of get().
@@ -177,7 +177,7 @@ void CompositionEngine::updateCursorAsync(CompositionRefreshArgs& args) {
}

void CompositionEngine::preComposition(CompositionRefreshArgs& args) {
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    bool needsAnotherUpdate = false;
@@ -199,7 +199,7 @@ void CompositionEngine::preComposition(CompositionRefreshArgs& args) {
// promises for buffer releases are fulfilled at the end of composition.
void CompositionEngine::postComposition(CompositionRefreshArgs& args) {
    if (FlagManager::getInstance().ce_fence_promise()) {
        ATRACE_CALL();
        SFTRACE_CALL();
        ALOGV(__FUNCTION__);

        for (auto& layerFE : args.layers) {
+2 −4
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

#include <android-base/stringprintf.h>
#include <common/trace.h>
#include <compositionengine/CompositionEngine.h>
#include <compositionengine/CompositionRefreshArgs.h>
#include <compositionengine/DisplayCreationArgs.h>
@@ -25,9 +26,6 @@
#include <compositionengine/impl/DumpHelpers.h>
#include <compositionengine/impl/OutputLayer.h>
#include <compositionengine/impl/RenderSurface.h>
#include <gui/TraceUtils.h>

#include <utils/Trace.h>

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
@@ -235,7 +233,7 @@ void Display::beginFrame() {

bool Display::chooseCompositionStrategy(
        std::optional<android::HWComposer::DeviceRequestedChanges>* outChanges) {
    ATRACE_FORMAT("%s for %s", __func__, getNamePlusId().c_str());
    SFTRACE_FORMAT("%s for %s", __func__, getNamePlusId().c_str());
    ALOGV(__FUNCTION__);

    if (mIsDisconnected) {
+17 −18
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <SurfaceFlingerProperties.sysprop.h>
#include <android-base/stringprintf.h>
#include <common/FlagManager.h>
#include <common/trace.h>
#include <compositionengine/CompositionEngine.h>
#include <compositionengine/CompositionRefreshArgs.h>
#include <compositionengine/DisplayColorProfile.h>
@@ -31,7 +32,6 @@
#include <compositionengine/impl/planner/Planner.h>
#include <ftl/algorithm.h>
#include <ftl/future.h>
#include <gui/TraceUtils.h>
#include <scheduler/FrameTargeter.h>
#include <scheduler/Time.h>

@@ -53,7 +53,6 @@
#include <android-base/properties.h>
#include <ui/DebugUtils.h>
#include <ui/HdrCapabilities.h>
#include <utils/Trace.h>

#include "TracedOrdinal.h"

@@ -424,7 +423,7 @@ void Output::setReleasedLayers(Output::ReleasedLayers&& layers) {

void Output::prepare(const compositionengine::CompositionRefreshArgs& refreshArgs,
                     LayerFESet& geomSnapshots) {
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    rebuildLayerStacks(refreshArgs, geomSnapshots);
@@ -453,7 +452,7 @@ ftl::Future<std::monostate> Output::present(
                })
                .value();
    };
    ATRACE_FORMAT("%s for %s%s", __func__, mNamePlusId.c_str(),
    SFTRACE_FORMAT("%s for %s%s", __func__, mNamePlusId.c_str(),
                   stringifyExpectedPresentTime().c_str());
    ALOGV(__FUNCTION__);

@@ -518,7 +517,7 @@ void Output::rebuildLayerStacks(const compositionengine::CompositionRefreshArgs&
    if (!outputState.isEnabled || CC_LIKELY(!refreshArgs.updatingOutputGeometryThisFrame)) {
        return;
    }
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    // Process the layers to determine visibility and coverage
@@ -804,7 +803,7 @@ void Output::setReleasedLayers(const compositionengine::CompositionRefreshArgs&)
}

void Output::updateCompositionState(const compositionengine::CompositionRefreshArgs& refreshArgs) {
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    if (!getState().isEnabled) {
@@ -831,14 +830,14 @@ void Output::planComposition() {
        return;
    }

    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    mPlanner->plan(getOutputLayersOrderedByZ());
}

void Output::writeCompositionState(const compositionengine::CompositionRefreshArgs& refreshArgs) {
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    if (!getState().isEnabled) {
@@ -1081,7 +1080,7 @@ void Output::beginFrame() {
}

void Output::prepareFrame() {
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    auto& outputState = editState();
@@ -1116,7 +1115,7 @@ std::future<bool> Output::chooseCompositionStrategyAsync(
}

GpuCompositionResult Output::prepareFrameAsync() {
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);
    auto& state = editState();
    const auto& previousChanges = state.previousDeviceRequestedChanges;
@@ -1146,7 +1145,7 @@ GpuCompositionResult Output::prepareFrameAsync() {
    state.strategyPrediction = predictionSucceeded ? CompositionStrategyPredictionState::SUCCESS
                                                   : CompositionStrategyPredictionState::FAIL;
    if (!predictionSucceeded) {
        ATRACE_NAME("CompositionStrategyPredictionMiss");
        SFTRACE_NAME("CompositionStrategyPredictionMiss");
        resetCompositionStrategy();
        if (chooseCompositionSuccess) {
            applyCompositionStrategy(changes);
@@ -1155,7 +1154,7 @@ GpuCompositionResult Output::prepareFrameAsync() {
        // Track the dequeued buffer to reuse so we don't need to dequeue another one.
        compositionResult.buffer = buffer;
    } else {
        ATRACE_NAME("CompositionStrategyPredictionHit");
        SFTRACE_NAME("CompositionStrategyPredictionHit");
    }
    state.previousDeviceRequestedChanges = std::move(changes);
    state.previousDeviceRequestedSuccess = chooseCompositionSuccess;
@@ -1187,7 +1186,7 @@ void Output::devOptRepaintFlash(const compositionengine::CompositionRefreshArgs&
}

void Output::finishFrame(GpuCompositionResult&& result) {
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);
    const auto& outputState = getState();
    if (!outputState.isEnabled) {
@@ -1276,7 +1275,7 @@ bool Output::dequeueRenderBuffer(base::unique_fd* bufferFence,
std::optional<base::unique_fd> Output::composeSurfaces(
        const Region& debugRegion, std::shared_ptr<renderengine::ExternalTexture> tex,
        base::unique_fd& fd) {
    ATRACE_CALL();
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    const auto& outputState = getState();
@@ -1317,13 +1316,13 @@ std::optional<base::unique_fd> Output::composeSurfaces(
        if (mClientCompositionRequestCache->exists(tex->getBuffer()->getId(),
                                                   clientCompositionDisplay,
                                                   clientCompositionLayers)) {
            ATRACE_NAME("ClientCompositionCacheHit");
            SFTRACE_NAME("ClientCompositionCacheHit");
            outputCompositionState.reusedClientComposition = true;
            setExpensiveRenderingExpected(false);
            // b/239944175 pass the fence associated with the buffer.
            return base::unique_fd(std::move(fd));
        }
        ATRACE_NAME("ClientCompositionCacheMiss");
        SFTRACE_NAME("ClientCompositionCacheMiss");
        mClientCompositionRequestCache->add(tex->getBuffer()->getId(), clientCompositionDisplay,
                                            clientCompositionLayers);
    }
@@ -1570,7 +1569,7 @@ bool Output::isPowerHintSessionGpuReportingEnabled() {
}

void Output::presentFrameAndReleaseLayers(bool flushEvenWhenDisabled) {
    ATRACE_FORMAT("%s for %s", __func__, mNamePlusId.c_str());
    SFTRACE_FORMAT("%s for %s", __func__, mNamePlusId.c_str());
    ALOGV(__FUNCTION__);

    if (!getState().isEnabled) {
+2 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <android-base/stringprintf.h>
#include <android/native_window.h>
#include <common/trace.h>
#include <compositionengine/CompositionEngine.h>
#include <compositionengine/Display.h>
#include <compositionengine/DisplaySurface.h>
@@ -32,7 +33,6 @@
#include <system/window.h>
#include <ui/GraphicBuffer.h>
#include <ui/Rect.h>
#include <utils/Trace.h>

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
@@ -149,7 +149,7 @@ void RenderSurface::prepareFrame(bool usesClientComposition, bool usesDeviceComp

std::shared_ptr<renderengine::ExternalTexture> RenderSurface::dequeueBuffer(
        base::unique_fd* bufferFence) {
    ATRACE_CALL();
    SFTRACE_CALL();
    int fd = -1;
    ANativeWindowBuffer* buffer = nullptr;

Loading