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

Commit 21b3d3f3 authored by Ady Abraham's avatar Ady Abraham Committed by Android (Google) Code Review
Browse files

Merge "SF: improve RenderThread jank classificaion" into udc-qpr-dev

parents 56c69744 5a3e356f
Loading
Loading
Loading
Loading
+12 −11
Original line number Original line Diff line number Diff line
@@ -1792,19 +1792,20 @@ int Surface::dispatchGetLastQueuedBuffer2(va_list args) {


int Surface::dispatchSetFrameTimelineInfo(va_list args) {
int Surface::dispatchSetFrameTimelineInfo(va_list args) {
    ATRACE_CALL();
    ATRACE_CALL();
    auto frameNumber = static_cast<uint64_t>(va_arg(args, uint64_t));
    auto frameTimelineVsyncId = static_cast<int64_t>(va_arg(args, int64_t));
    auto inputEventId = static_cast<int32_t>(va_arg(args, int32_t));
    auto startTimeNanos = static_cast<int64_t>(va_arg(args, int64_t));
    auto useForRefreshRateSelection = static_cast<bool>(va_arg(args, int32_t));

    ALOGV("Surface::%s", __func__);
    ALOGV("Surface::%s", __func__);

    const auto nativeWindowFtlInfo = static_cast<ANativeWindowFrameTimelineInfo>(
            va_arg(args, ANativeWindowFrameTimelineInfo));

    FrameTimelineInfo ftlInfo;
    FrameTimelineInfo ftlInfo;
    ftlInfo.vsyncId = frameTimelineVsyncId;
    ftlInfo.vsyncId = nativeWindowFtlInfo.frameTimelineVsyncId;
    ftlInfo.inputEventId = inputEventId;
    ftlInfo.inputEventId = nativeWindowFtlInfo.inputEventId;
    ftlInfo.startTimeNanos = startTimeNanos;
    ftlInfo.startTimeNanos = nativeWindowFtlInfo.startTimeNanos;
    ftlInfo.useForRefreshRateSelection = useForRefreshRateSelection;
    ftlInfo.useForRefreshRateSelection = nativeWindowFtlInfo.useForRefreshRateSelection;
    return setFrameTimelineInfo(frameNumber, ftlInfo);
    ftlInfo.skippedFrameVsyncId = nativeWindowFtlInfo.skippedFrameVsyncId;
    ftlInfo.skippedFrameStartTimeNanos = nativeWindowFtlInfo.skippedFrameStartTimeNanos;

    return setFrameTimelineInfo(nativeWindowFtlInfo.frameNumber, ftlInfo);
}
}


bool Surface::transformToDisplayInverse() const {
bool Surface::transformToDisplayInverse() const {
+3 −17
Original line number Original line Diff line number Diff line
@@ -1027,7 +1027,7 @@ void SurfaceComposerClient::Transaction::clear() {
    mEarlyWakeupEnd = false;
    mEarlyWakeupEnd = false;
    mDesiredPresentTime = 0;
    mDesiredPresentTime = 0;
    mIsAutoTimestamp = true;
    mIsAutoTimestamp = true;
    clearFrameTimelineInfo(mFrameTimelineInfo);
    mFrameTimelineInfo = {};
    mApplyToken = nullptr;
    mApplyToken = nullptr;
    mMergedTransactionIds.clear();
    mMergedTransactionIds.clear();
}
}
@@ -2279,27 +2279,13 @@ void SurfaceComposerClient::Transaction::mergeFrameTimelineInfo(FrameTimelineInf
    if (t.vsyncId != FrameTimelineInfo::INVALID_VSYNC_ID &&
    if (t.vsyncId != FrameTimelineInfo::INVALID_VSYNC_ID &&
        other.vsyncId != FrameTimelineInfo::INVALID_VSYNC_ID) {
        other.vsyncId != FrameTimelineInfo::INVALID_VSYNC_ID) {
        if (other.vsyncId > t.vsyncId) {
        if (other.vsyncId > t.vsyncId) {
            t.vsyncId = other.vsyncId;
            t = other;
            t.inputEventId = other.inputEventId;
            t.startTimeNanos = other.startTimeNanos;
            t.useForRefreshRateSelection = other.useForRefreshRateSelection;
        }
        }
    } else if (t.vsyncId == FrameTimelineInfo::INVALID_VSYNC_ID) {
    } else if (t.vsyncId == FrameTimelineInfo::INVALID_VSYNC_ID) {
        t.vsyncId = other.vsyncId;
        t = other;
        t.inputEventId = other.inputEventId;
        t.startTimeNanos = other.startTimeNanos;
        t.useForRefreshRateSelection = other.useForRefreshRateSelection;
    }
    }
}
}


// copied from FrameTimelineInfo::clear()
void SurfaceComposerClient::Transaction::clearFrameTimelineInfo(FrameTimelineInfo& t) {
    t.vsyncId = FrameTimelineInfo::INVALID_VSYNC_ID;
    t.inputEventId = os::IInputConstants::INVALID_INPUT_EVENT_ID;
    t.startTimeNanos = 0;
    t.useForRefreshRateSelection = false;
}

SurfaceComposerClient::Transaction&
SurfaceComposerClient::Transaction&
SurfaceComposerClient::Transaction::setTrustedPresentationCallback(
SurfaceComposerClient::Transaction::setTrustedPresentationCallback(
        const sp<SurfaceControl>& sc, TrustedPresentationCallback cb,
        const sp<SurfaceControl>& sc, TrustedPresentationCallback cb,
+6 −0
Original line number Original line Diff line number Diff line
@@ -37,4 +37,10 @@ parcelable FrameTimelineInfo {
    // Whether this vsyncId should be used to heuristically select the display refresh rate
    // Whether this vsyncId should be used to heuristically select the display refresh rate
    // TODO(b/281695725): Clean this up once TextureView use setFrameRate API
    // TODO(b/281695725): Clean this up once TextureView use setFrameRate API
    boolean useForRefreshRateSelection = false;
    boolean useForRefreshRateSelection = false;

    // The VsyncId of a frame that was not drawn and squashed into this frame.
    long skippedFrameVsyncId = INVALID_VSYNC_ID;

    // The start time of a frame that was not drawn and squashed into this frame.
    long skippedFrameStartTimeNanos = 0;
}
}
+0 −1
Original line number Original line Diff line number Diff line
@@ -410,7 +410,6 @@ public:
        static sp<IBinder> sApplyToken;
        static sp<IBinder> sApplyToken;
        void releaseBufferIfOverwriting(const layer_state_t& state);
        void releaseBufferIfOverwriting(const layer_state_t& state);
        static void mergeFrameTimelineInfo(FrameTimelineInfo& t, const FrameTimelineInfo& other);
        static void mergeFrameTimelineInfo(FrameTimelineInfo& t, const FrameTimelineInfo& other);
        static void clearFrameTimelineInfo(FrameTimelineInfo& t);


    protected:
    protected:
        std::unordered_map<sp<IBinder>, ComposerState, IBinderHash> mComposerStates;
        std::unordered_map<sp<IBinder>, ComposerState, IBinderHash> mComposerStates;
+26 −5
Original line number Original line Diff line number Diff line
@@ -1066,12 +1066,33 @@ static inline int native_window_set_frame_rate(struct ANativeWindow* window, flo
                           (int)compatibility, (int)changeFrameRateStrategy);
                           (int)compatibility, (int)changeFrameRateStrategy);
}
}


struct ANativeWindowFrameTimelineInfo {
    // Frame Id received from ANativeWindow_getNextFrameId.
    uint64_t frameNumber;

    // VsyncId received from the Choreographer callback that started this frame.
    int64_t frameTimelineVsyncId;

    // Input Event ID received from the input event that started this frame.
    int32_t inputEventId;

    // The time which this frame rendering started (i.e. when Choreographer callback actually run)
    int64_t startTimeNanos;

    // Whether or not to use the vsyncId to determine the refresh rate. Used for TextureView only.
    int32_t useForRefreshRateSelection;

    // The VsyncId of a frame that was not drawn and squashed into this frame.
    // Used for UI thread updates that were not picked up by RenderThread on time.
    int64_t skippedFrameVsyncId;

    // The start time of a frame that was not drawn and squashed into this frame.
    int64_t skippedFrameStartTimeNanos;
};

static inline int native_window_set_frame_timeline_info(
static inline int native_window_set_frame_timeline_info(
        struct ANativeWindow* window, uint64_t frameNumber, int64_t frameTimelineVsyncId,
        struct ANativeWindow* window, struct ANativeWindowFrameTimelineInfo frameTimelineInfo) {
        int32_t inputEventId, int64_t startTimeNanos, int32_t useForRefreshRateSelection) {
    return window->perform(window, NATIVE_WINDOW_SET_FRAME_TIMELINE_INFO, frameTimelineInfo);
    return window->perform(window, NATIVE_WINDOW_SET_FRAME_TIMELINE_INFO, frameNumber,
                           frameTimelineVsyncId, inputEventId, startTimeNanos,
                           useForRefreshRateSelection);
}
}


// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
Loading