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

Commit 23e195c2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[SfStats] Record vsync event connection count"

parents 49677c59 717bcb6e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -335,6 +335,11 @@ void EventThread::onConfigChanged(PhysicalDisplayId displayId, HwcConfigIndexTyp
    mCondition.notify_all();
}

size_t EventThread::getEventThreadConnectionCount() {
    std::lock_guard<std::mutex> lock(mMutex);
    return mDisplayEventConnections.size();
}

void EventThread::threadMain(std::unique_lock<std::mutex>& lock) {
    DisplayEventConsumers consumers;

+10 −7
Original line number Diff line number Diff line
@@ -16,7 +16,12 @@

#pragma once

#include <android-base/thread_annotations.h>
#include <gui/DisplayEventReceiver.h>
#include <gui/IDisplayEventConnection.h>
#include <private/gui/BitTube.h>
#include <sys/types.h>
#include <utils/Errors.h>

#include <condition_variable>
#include <cstdint>
@@ -26,13 +31,6 @@
#include <thread>
#include <vector>

#include <android-base/thread_annotations.h>

#include <gui/DisplayEventReceiver.h>
#include <gui/IDisplayEventConnection.h>
#include <private/gui/BitTube.h>

#include <utils/Errors.h>
#include "HwcStrongTypes.h"

// ---------------------------------------------------------------------------
@@ -134,6 +132,9 @@ public:
    // Usage of this method assumes that only the primary internal display
    // supports multiple display configurations.
    virtual void requestLatestConfig() = 0;

    // Retrieves the number of event connections tracked by this EventThread.
    virtual size_t getEventThreadConnectionCount() = 0;
};

namespace impl {
@@ -168,6 +169,8 @@ public:

    void setPhaseOffset(nsecs_t phaseOffset) override;

    size_t getEventThreadConnectionCount() override;

private:
    friend EventThreadTest;

+5 −0
Original line number Diff line number Diff line
@@ -230,6 +230,11 @@ void Scheduler::onConfigChanged(ConnectionHandle handle, PhysicalDisplayId displ
    mConnections[handle].thread->onConfigChanged(displayId, configId, vsyncPeriod);
}

size_t Scheduler::getEventThreadConnectionCount(ConnectionHandle handle) {
    RETURN_IF_INVALID_HANDLE(handle, 0);
    return mConnections[handle].thread->getEventThreadConnectionCount();
}

void Scheduler::dump(ConnectionHandle handle, std::string& result) const {
    RETURN_IF_INVALID_HANDLE(handle);
    mConnections.at(handle).thread->dump(result);
+2 −0
Original line number Diff line number Diff line
@@ -145,6 +145,8 @@ public:
    // Notifies the scheduler when the display size has changed. Called from SF's main thread
    void onPrimaryDisplayAreaChanged(uint32_t displayArea);

    size_t getEventThreadConnectionCount(ConnectionHandle handle);

private:
    friend class TestableScheduler;

+4 −0
Original line number Diff line number Diff line
@@ -2119,6 +2119,10 @@ void SurfaceFlinger::postComposition()

    mTimeStats->setPresentFenceGlobal(presentFenceTime);

    const size_t sfConnections = mScheduler->getEventThreadConnectionCount(mSfConnectionHandle);
    const size_t appConnections = mScheduler->getEventThreadConnectionCount(mAppConnectionHandle);
    mTimeStats->recordDisplayEventConnectionCount(sfConnections + appConnections);

    if (displayDevice && getHwComposer().isConnected(*displayDevice->getId()) &&
        !displayDevice->isPoweredOn()) {
        return;
Loading