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

Commit eb577945 authored by Rachel Lee's avatar Rachel Lee Committed by Android (Google) Code Review
Browse files

Merge "Add frame timeline method to ASurfaceControl NDK."

parents c747fcaa ed511efb
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -595,6 +595,15 @@ void ASurfaceTransaction_setEnableBackPressure(ASurfaceTransaction* transaction,
                                               bool enableBackPressure)
                                               __INTRODUCED_IN(31);

/**
 * Sets the frame timeline to use.
 *
 * \param vsyncId The vsync ID received from AChoreographer, setting the frame's present target to
 * the corresponding expected present time and deadline from the frame to be rendered.
 */
void ASurfaceTransaction_setFrameTimeline(ASurfaceTransaction* transaction,
                                          int64_t vsyncId) __INTRODUCED_IN(33);

__END_DECLS

#endif // ANDROID_SURFACE_CONTROL_H
+5 −0
Original line number Diff line number Diff line
@@ -33,12 +33,14 @@ namespace android {
status_t FrameTimelineInfo::write(Parcel& output) const {
    SAFE_PARCEL(output.writeInt64, vsyncId);
    SAFE_PARCEL(output.writeInt32, inputEventId);
    SAFE_PARCEL(output.writeInt64, startTimeNanos);
    return NO_ERROR;
}

status_t FrameTimelineInfo::read(const Parcel& input) {
    SAFE_PARCEL(input.readInt64, &vsyncId);
    SAFE_PARCEL(input.readInt32, &inputEventId);
    SAFE_PARCEL(input.readInt64, &startTimeNanos);
    return NO_ERROR;
}

@@ -48,16 +50,19 @@ void FrameTimelineInfo::merge(const FrameTimelineInfo& other) {
        if (other.vsyncId > vsyncId) {
            vsyncId = other.vsyncId;
            inputEventId = other.inputEventId;
            startTimeNanos = other.startTimeNanos;
        }
    } else if (vsyncId == INVALID_VSYNC_ID) {
        vsyncId = other.vsyncId;
        inputEventId = other.inputEventId;
        startTimeNanos = other.startTimeNanos;
    }
}

void FrameTimelineInfo::clear() {
    vsyncId = INVALID_VSYNC_ID;
    inputEventId = IInputConstants::INVALID_INPUT_EVENT_ID;
    startTimeNanos = 0;
}

}; // namespace android
+2 −1
Original line number Diff line number Diff line
@@ -1846,9 +1846,10 @@ int Surface::dispatchSetFrameTimelineInfo(va_list args) {
    ATRACE_CALL();
    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));

    ALOGV("Surface::%s", __func__);
    return setFrameTimelineInfo({frameTimelineVsyncId, inputEventId});
    return setFrameTimelineInfo({frameTimelineVsyncId, inputEventId, startTimeNanos});
}

bool Surface::transformToDisplayInverse() const {
+3 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@ struct FrameTimelineInfo {
    // not directly vendor available.
    int32_t inputEventId = 0;

    // The current time in nanoseconds the application started to render the frame.
    int64_t startTimeNanos = 0;

    status_t write(Parcel& output) const;
    status_t read(const Parcel& input);

+5 −4
Original line number Diff line number Diff line
@@ -1026,9 +1026,10 @@ static inline int native_window_set_frame_rate(struct ANativeWindow* window, flo

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

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