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

Commit 462f70fd authored by Jerome Gaillard's avatar Jerome Gaillard Committed by Android (Google) Code Review
Browse files

Merge "Replace CLOCK_MONOTONIC with SYSTEM_TIME_MONOTONIC"

parents ba06ef1a e218c692
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -485,7 +485,7 @@ static void setSurface(JNIEnv* env, jclass clazz, jlong rendererPtr, jlong surfa

static void draw(JNIEnv* env, jclass clazz, jlong rendererPtr) {
    RenderProxy* proxy = reinterpret_cast<RenderProxy*>(rendererPtr);
    nsecs_t vsync = systemTime(CLOCK_MONOTONIC);
    nsecs_t vsync = systemTime(SYSTEM_TIME_MONOTONIC);
    UiFrameInfoBuilder(proxy->frameInfo())
            .setVsync(vsync, vsync)
            .addFlag(FrameInfoFlags::SurfaceCanvas);
+1 −1
Original line number Diff line number Diff line
@@ -957,7 +957,7 @@ static jobject android_view_ThreadedRenderer_createHardwareBitmapFromRenderNode(
        // to all 0s.
        proxy.setLightAlpha(0, 0);
        proxy.setLightGeometry((Vector3){0, 0, 0}, 0);
        nsecs_t vsync = systemTime(CLOCK_MONOTONIC);
        nsecs_t vsync = systemTime(SYSTEM_TIME_MONOTONIC);
        UiFrameInfoBuilder(proxy.frameInfo())
                .setVsync(vsync, vsync)
                .addFlag(FrameInfoFlags::SurfaceCanvas);
+4 −4
Original line number Diff line number Diff line
@@ -100,15 +100,15 @@ class FrameInfo {
public:
    void importUiThreadInfo(int64_t* info);

    void markSyncStart() { set(FrameInfoIndex::SyncStart) = systemTime(CLOCK_MONOTONIC); }
    void markSyncStart() { set(FrameInfoIndex::SyncStart) = systemTime(SYSTEM_TIME_MONOTONIC); }

    void markIssueDrawCommandsStart() {
        set(FrameInfoIndex::IssueDrawCommandsStart) = systemTime(CLOCK_MONOTONIC);
        set(FrameInfoIndex::IssueDrawCommandsStart) = systemTime(SYSTEM_TIME_MONOTONIC);
    }

    void markSwapBuffers() { set(FrameInfoIndex::SwapBuffers) = systemTime(CLOCK_MONOTONIC); }
    void markSwapBuffers() { set(FrameInfoIndex::SwapBuffers) = systemTime(SYSTEM_TIME_MONOTONIC); }

    void markFrameCompleted() { set(FrameInfoIndex::FrameCompleted) = systemTime(CLOCK_MONOTONIC); }
    void markFrameCompleted() { set(FrameInfoIndex::FrameCompleted) = systemTime(SYSTEM_TIME_MONOTONIC); }

    void addFlag(int frameInfoFlag) {
        set(FrameInfoIndex::Flags) |= static_cast<uint64_t>(frameInfoFlag);
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ void ProfileData::reset() {
    mSlowFrameCounts.fill(0);
    mTotalFrameCount = 0;
    mJankFrameCount = 0;
    mStatStartTime = systemTime(CLOCK_MONOTONIC);
    mStatStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
}

void ProfileData::reportFrame(int64_t duration) {
+2 −8
Original line number Diff line number Diff line
@@ -24,12 +24,6 @@

#include <optional>

#ifdef __APPLE__
    // macOS SDK 10.10 does not support CLOCK_MONOTONIC, which is not an issue since
    // the value of the argument is not used in the host definition of systemTime
#define CLOCK_MONOTONIC
#endif

namespace android {

AnimatedImageDrawable::AnimatedImageDrawable(sk_sp<SkAnimatedImage> animatedImage, size_t bytesUsed)
@@ -70,7 +64,7 @@ bool AnimatedImageDrawable::nextSnapshotReady() const {
// Only called on the RenderThread while UI thread is locked.
bool AnimatedImageDrawable::isDirty(nsecs_t* outDelay) {
    *outDelay = 0;
    const nsecs_t currentTime = systemTime(CLOCK_MONOTONIC);
    const nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
    const nsecs_t lastWallTime = mLastWallTime;

    mLastWallTime = currentTime;
@@ -250,7 +244,7 @@ int AnimatedImageDrawable::drawStaging(SkCanvas* canvas) {

    bool update = false;
    {
        const nsecs_t currentTime = systemTime(CLOCK_MONOTONIC);
        const nsecs_t currentTime = systemTime(SYSTEM_TIME_MONOTONIC);
        std::unique_lock lock{mSwapLock};
        // mLastWallTime starts off at 0. If it is still 0, just update it to
        // the current time and avoid updating
Loading