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

Commit 5c86437a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "relocate-frametimeline" into main

* changes:
  SF: Subsume frametimeline namespace in scheduler
  SF: Move FrameTimeline into Scheduler
parents c6335db7 7d7e0f6e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -207,7 +207,6 @@ filegroup {
        "DisplayDevice.cpp",
        "DisplayDevice.cpp",
        "Effects/Daltonizer.cpp",
        "Effects/Daltonizer.cpp",
        "FpsReporter.cpp",
        "FpsReporter.cpp",
        "FrameTimeline/FrameTimeline.cpp",
        "FrameTracer/FrameTracer.cpp",
        "FrameTracer/FrameTracer.cpp",
        "FrameTracker.cpp",
        "FrameTracker.cpp",
        "FrontEnd/LayerCreationArgs.cpp",
        "FrontEnd/LayerCreationArgs.cpp",
@@ -230,6 +229,7 @@ filegroup {
        "RegionSamplingThread.cpp",
        "RegionSamplingThread.cpp",
        "Scheduler/EventThread.cpp",
        "Scheduler/EventThread.cpp",
        "Scheduler/FrameRateOverrideMappings.cpp",
        "Scheduler/FrameRateOverrideMappings.cpp",
        "Scheduler/FrameTimeline.cpp",
        "Scheduler/LayerHistory.cpp",
        "Scheduler/LayerHistory.cpp",
        "Scheduler/LayerInfo.cpp",
        "Scheduler/LayerInfo.cpp",
        "Scheduler/MessageQueue.cpp",
        "Scheduler/MessageQueue.cpp",
+1 −1
Original line number Original line Diff line number Diff line
@@ -26,7 +26,7 @@


namespace android {
namespace android {


FpsReporter::FpsReporter(frametimeline::FrameTimeline& frameTimeline, std::unique_ptr<Clock> clock)
FpsReporter::FpsReporter(scheduler::FrameTimeline& frameTimeline, std::unique_ptr<Clock> clock)
      : mFrameTimeline(frameTimeline), mClock(std::move(clock)) {
      : mFrameTimeline(frameTimeline), mClock(std::move(clock)) {
    LOG_ALWAYS_FATAL_IF(mClock == nullptr, "Passed in null clock when constructing FpsReporter!");
    LOG_ALWAYS_FATAL_IF(mClock == nullptr, "Passed in null clock when constructing FpsReporter!");
}
}
+4 −4
Original line number Original line Diff line number Diff line
@@ -23,8 +23,8 @@
#include <unordered_map>
#include <unordered_map>


#include "Clock.h"
#include "Clock.h"
#include "FrameTimeline/FrameTimeline.h"
#include "FrontEnd/LayerHierarchy.h"
#include "FrontEnd/LayerHierarchy.h"
#include "Scheduler/FrameTimeline.h"
#include "WpHash.h"
#include "WpHash.h"


namespace android {
namespace android {
@@ -34,7 +34,7 @@ class SurfaceFlinger;


class FpsReporter : public IBinder::DeathRecipient {
class FpsReporter : public IBinder::DeathRecipient {
public:
public:
    FpsReporter(frametimeline::FrameTimeline& frameTimeline,
    FpsReporter(scheduler::FrameTimeline& frameTimeline,
                std::unique_ptr<Clock> clock = std::make_unique<SteadyClock>());
                std::unique_ptr<Clock> clock = std::make_unique<SteadyClock>());


    // Dispatches updated layer fps values for the registered listeners
    // Dispatches updated layer fps values for the registered listeners
@@ -58,7 +58,7 @@ private:
        int32_t taskId;
        int32_t taskId;
    };
    };


    frametimeline::FrameTimeline& mFrameTimeline;
    scheduler::FrameTimeline& mFrameTimeline;
    static const constexpr std::chrono::steady_clock::duration kMinDispatchDuration =
    static const constexpr std::chrono::steady_clock::duration kMinDispatchDuration =
            std::chrono::milliseconds(500);
            std::chrono::milliseconds(500);
    std::unique_ptr<Clock> mClock;
    std::unique_ptr<Clock> mClock;
+3 −3
Original line number Original line Diff line number Diff line
@@ -25,9 +25,9 @@
#include <utils/Mutex.h>
#include <utils/Mutex.h>


namespace android {
namespace android {
namespace frametimeline {
namespace scheduler {
class FrameTimelineTest;
class FrameTimelineTest;
}
} // namespace scheduler


/**
/**
 * JankTracker maintains a backlog of frame jank classification and manages and notififies any
 * JankTracker maintains a backlog of frame jank classification and manages and notififies any
@@ -52,7 +52,7 @@ protected:
    static std::vector<gui::JankData> getCollectedJankDataForTesting(int32_t layerId);
    static std::vector<gui::JankData> getCollectedJankDataForTesting(int32_t layerId);
    static void clearAndStopCollectingAllJankDataForTesting();
    static void clearAndStopCollectingAllJankDataForTesting();


    friend class frametimeline::FrameTimelineTest;
    friend class scheduler::FrameTimelineTest;


private:
private:
    JankTracker() {}
    JankTracker() {}
+7 −7
Original line number Original line Diff line number Diff line
@@ -64,12 +64,12 @@


#include "DisplayDevice.h"
#include "DisplayDevice.h"
#include "DisplayHardware/HWComposer.h"
#include "DisplayHardware/HWComposer.h"
#include "FrameTimeline/FrameTimeline.h"
#include "FrameTracer/FrameTracer.h"
#include "FrameTracer/FrameTracer.h"
#include "FrontEnd/LayerCreationArgs.h"
#include "FrontEnd/LayerCreationArgs.h"
#include "FrontEnd/LayerHandle.h"
#include "FrontEnd/LayerHandle.h"
#include "Layer.h"
#include "Layer.h"
#include "LayerProtoHelper.h"
#include "LayerProtoHelper.h"
#include "Scheduler/FrameTimeline.h"
#include "SurfaceFlinger.h"
#include "SurfaceFlinger.h"
#include "TimeStats/TimeStats.h"
#include "TimeStats/TimeStats.h"
#include "TransactionCallbackInvoker.h"
#include "TransactionCallbackInvoker.h"
@@ -128,7 +128,7 @@ using gui::LayerMetadata;
using gui::WindowInfo;
using gui::WindowInfo;
using ui::Size;
using ui::Size;


using PresentState = frametimeline::SurfaceFrame::PresentState;
using PresentState = scheduler::SurfaceFrame::PresentState;


Layer::Layer(const surfaceflinger::LayerCreationArgs& args)
Layer::Layer(const surfaceflinger::LayerCreationArgs& args)
      : sequence(args.sequence),
      : sequence(args.sequence),
@@ -450,15 +450,15 @@ void Layer::setFrameTimelineVsyncForBufferlessTransaction(const FrameTimelineInf
    setFrameTimelineVsyncForSkippedFrames(info, postTime, mTransactionName, gameMode);
    setFrameTimelineVsyncForSkippedFrames(info, postTime, mTransactionName, gameMode);
}
}


void Layer::addSurfaceFrameDroppedForBuffer(
void Layer::addSurfaceFrameDroppedForBuffer(std::shared_ptr<scheduler::SurfaceFrame>& surfaceFrame,
        std::shared_ptr<frametimeline::SurfaceFrame>& surfaceFrame, nsecs_t dropTime) {
                                            nsecs_t dropTime) {
    surfaceFrame->setDropTime(dropTime);
    surfaceFrame->setDropTime(dropTime);
    surfaceFrame->setPresentState(PresentState::Dropped);
    surfaceFrame->setPresentState(PresentState::Dropped);
    mFlinger->mFrameTimeline->addSurfaceFrame(surfaceFrame);
    mFlinger->mFrameTimeline->addSurfaceFrame(surfaceFrame);
}
}


void Layer::addSurfaceFramePresentedForBuffer(
void Layer::addSurfaceFramePresentedForBuffer(
        std::shared_ptr<frametimeline::SurfaceFrame>& surfaceFrame, nsecs_t acquireFenceTime,
        std::shared_ptr<scheduler::SurfaceFrame>& surfaceFrame, nsecs_t acquireFenceTime,
        nsecs_t currentLatchTime) REQUIRES(mFlinger->mStateLock) {
        nsecs_t currentLatchTime) REQUIRES(mFlinger->mStateLock) {
    surfaceFrame->setAcquireFenceTime(acquireFenceTime);
    surfaceFrame->setAcquireFenceTime(acquireFenceTime);
    surfaceFrame->setPresentState(PresentState::Presented, mLastLatchTime);
    surfaceFrame->setPresentState(PresentState::Presented, mLastLatchTime);
@@ -466,7 +466,7 @@ void Layer::addSurfaceFramePresentedForBuffer(
    updateLastLatchTime(currentLatchTime);
    updateLastLatchTime(currentLatchTime);
}
}


std::shared_ptr<frametimeline::SurfaceFrame> Layer::createSurfaceFrameForTransaction(
std::shared_ptr<scheduler::SurfaceFrame> Layer::createSurfaceFrameForTransaction(
        const FrameTimelineInfo& info, nsecs_t postTime, gui::GameMode gameMode)
        const FrameTimelineInfo& info, nsecs_t postTime, gui::GameMode gameMode)
        REQUIRES(mFlinger->mStateLock) {
        REQUIRES(mFlinger->mStateLock) {
    auto surfaceFrame =
    auto surfaceFrame =
@@ -488,7 +488,7 @@ std::shared_ptr<frametimeline::SurfaceFrame> Layer::createSurfaceFrameForTransac
    return surfaceFrame;
    return surfaceFrame;
}
}


std::shared_ptr<frametimeline::SurfaceFrame> Layer::createSurfaceFrameForBuffer(
std::shared_ptr<scheduler::SurfaceFrame> Layer::createSurfaceFrameForBuffer(
        const FrameTimelineInfo& info, nsecs_t queueTime, std::string debugName,
        const FrameTimelineInfo& info, nsecs_t queueTime, std::string debugName,
        gui::GameMode gameMode) REQUIRES(mFlinger->mStateLock) {
        gui::GameMode gameMode) REQUIRES(mFlinger->mStateLock) {
    auto surfaceFrame =
    auto surfaceFrame =
Loading