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

Commit 6520fdbf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "SurfaceFlinger: add debug information when vsync is not generated" into...

Merge "SurfaceFlinger: add debug information when vsync is not generated" into rvc-dev am: afa90192

Change-Id: I39de7384a422376eaf73ee37455c684369241d62
parents f58e368a afa90192
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@
#include "EventThread.h"
#include "EventThread.h"


namespace android {
namespace android {
using base::StringAppendF;


DispSyncSource::DispSyncSource(DispSync* dispSync, nsecs_t phaseOffset, bool traceVsync,
DispSyncSource::DispSyncSource(DispSync* dispSync, nsecs_t phaseOffset, bool traceVsync,
                               const char* name)
                               const char* name)
@@ -107,6 +108,12 @@ void DispSyncSource::onDispSyncEvent(nsecs_t when) {
    }
    }
}
}


void DispSyncSource::dump(std::string& result) const {
    std::lock_guard lock(mVsyncMutex);
    StringAppendF(&result, "DispSyncSource: %s(%s)\n", mName, mEnabled ? "enabled" : "disabled");
    mDispSync->dump(result);
}

} // namespace android
} // namespace android


// TODO(b/129481165): remove the #pragma below and fix conversion issues
// TODO(b/129481165): remove the #pragma below and fix conversion issues
+3 −1
Original line number Original line Diff line number Diff line
@@ -36,6 +36,8 @@ public:
    void setCallback(VSyncSource::Callback* callback) override;
    void setCallback(VSyncSource::Callback* callback) override;
    void setPhaseOffset(nsecs_t phaseOffset) override;
    void setPhaseOffset(nsecs_t phaseOffset) override;


    void dump(std::string&) const override;

private:
private:
    // The following method is the implementation of the DispSync::Callback.
    // The following method is the implementation of the DispSync::Callback.
    virtual void onDispSyncEvent(nsecs_t when);
    virtual void onDispSyncEvent(nsecs_t when);
@@ -52,7 +54,7 @@ private:
    std::mutex mCallbackMutex;
    std::mutex mCallbackMutex;
    VSyncSource::Callback* mCallback GUARDED_BY(mCallbackMutex) = nullptr;
    VSyncSource::Callback* mCallback GUARDED_BY(mCallbackMutex) = nullptr;


    std::mutex mVsyncMutex;
    mutable std::mutex mVsyncMutex;
    TracedOrdinal<nsecs_t> mPhaseOffset GUARDED_BY(mVsyncMutex);
    TracedOrdinal<nsecs_t> mPhaseOffset GUARDED_BY(mVsyncMutex);
    bool mEnabled GUARDED_BY(mVsyncMutex) = false;
    bool mEnabled GUARDED_BY(mVsyncMutex) = false;
};
};
+6 −1
Original line number Original line Diff line number Diff line
@@ -425,7 +425,12 @@ void EventThread::threadMain(std::unique_lock<std::mutex>& lock) {
            // display is off, keep feeding clients at 60 Hz.
            // display is off, keep feeding clients at 60 Hz.
            const auto timeout = mState == State::SyntheticVSync ? 16ms : 1000ms;
            const auto timeout = mState == State::SyntheticVSync ? 16ms : 1000ms;
            if (mCondition.wait_for(lock, timeout) == std::cv_status::timeout) {
            if (mCondition.wait_for(lock, timeout) == std::cv_status::timeout) {
                ALOGW_IF(mState == State::VSync, "Faking VSYNC due to driver stall");
                if (mState == State::VSync) {
                    ALOGW("Faking VSYNC due to driver stall for thread %s", mThreadName);
                    std::string debugInfo = "VsyncSource debug info:\n";
                    mVSyncSource->dump(debugInfo);
                    ALOGW("%s", debugInfo.c_str());
                }


                LOG_FATAL_IF(!mVSyncState);
                LOG_FATAL_IF(!mVSyncState);
                mPendingEvents.push_back(makeVSync(mVSyncState->displayId,
                mPendingEvents.push_back(makeVSync(mVSyncState->displayId,
+2 −0
Original line number Original line Diff line number Diff line
@@ -66,6 +66,8 @@ public:
    virtual void setVSyncEnabled(bool enable) = 0;
    virtual void setVSyncEnabled(bool enable) = 0;
    virtual void setCallback(Callback* callback) = 0;
    virtual void setCallback(Callback* callback) = 0;
    virtual void setPhaseOffset(nsecs_t phaseOffset) = 0;
    virtual void setPhaseOffset(nsecs_t phaseOffset) = 0;

    virtual void dump(std::string& result) const = 0;
};
};


class EventThreadConnection : public BnDisplayEventConnection {
class EventThreadConnection : public BnDisplayEventConnection {
+1 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ public:
    const char* getName() const override { return "inject"; }
    const char* getName() const override { return "inject"; }
    void setVSyncEnabled(bool) override {}
    void setVSyncEnabled(bool) override {}
    void setPhaseOffset(nsecs_t) override {}
    void setPhaseOffset(nsecs_t) override {}
    void dump(std::string&) const override {}


private:
private:
    std::mutex mCallbackMutex;
    std::mutex mCallbackMutex;
Loading