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

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

Merge "Rename to VsyncCallback & presentation time."

parents 7c1174b9 f4dc39f6
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ typedef void (*AChoreographer_frameCallback64)(int64_t frameTimeNanos, void* dat
 * It's passed the frame data that should not outlive the callback, as well as the data pointer
 * provided by the application that registered a callback.
 */
typedef void (*AChoreographer_extendedFrameCallback)(
typedef void (*AChoreographer_vsyncCallback)(
        const AChoreographerFrameCallbackData* callbackData, void* data);

/**
@@ -134,8 +134,8 @@ void AChoreographer_postFrameCallbackDelayed64(AChoreographer* choreographer,
 * Posts a callback to run on the next frame. The data pointer provided will
 * be passed to the callback function when it's called.
 */
void AChoreographer_postExtendedFrameCallback(AChoreographer* choreographer,
                                        AChoreographer_extendedFrameCallback callback, void* data)
void AChoreographer_postVsyncCallback(AChoreographer* choreographer,
                                        AChoreographer_vsyncCallback callback, void* data)
        __INTRODUCED_IN(33);

/**
@@ -215,7 +215,7 @@ AVsyncId AChoreographerFrameCallbackData_getFrameTimelineVsyncId(
/**
 * The time in nanoseconds which the frame at given index is expected to be presented.
 */
int64_t AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentTimeNanos(
int64_t AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos(
        const AChoreographerFrameCallbackData* data, size_t index) __INTRODUCED_IN(33);

/**
+18 −19
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ using gui::VsyncEventData;
struct FrameCallback {
    AChoreographer_frameCallback callback;
    AChoreographer_frameCallback64 callback64;
    AChoreographer_extendedFrameCallback extendedCallback;
    AChoreographer_vsyncCallback vsyncCallback;
    void* data;
    nsecs_t dueTime;

@@ -121,7 +121,7 @@ public:
    explicit Choreographer(const sp<Looper>& looper) EXCLUDES(gChoreographers.lock);
    void postFrameCallbackDelayed(AChoreographer_frameCallback cb,
                                  AChoreographer_frameCallback64 cb64,
                                  AChoreographer_extendedFrameCallback extendedCallback, void* data,
                                  AChoreographer_vsyncCallback vsyncCallback, void* data,
                                  nsecs_t delay);
    void registerRefreshRateCallback(AChoreographer_refreshRateCallback cb, void* data)
            EXCLUDES(gChoreographers.lock);
@@ -230,10 +230,10 @@ Choreographer::~Choreographer() {

void Choreographer::postFrameCallbackDelayed(AChoreographer_frameCallback cb,
                                             AChoreographer_frameCallback64 cb64,
                                             AChoreographer_extendedFrameCallback extendedCallback,
                                             void* data, nsecs_t delay) {
                                             AChoreographer_vsyncCallback vsyncCallback, void* data,
                                             nsecs_t delay) {
    nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
    FrameCallback callback{cb, cb64, extendedCallback, data, now + delay};
    FrameCallback callback{cb, cb64, vsyncCallback, data, now + delay};
    {
        std::lock_guard<std::mutex> _l{mLock};
        mFrameCallbacks.push(callback);
@@ -389,11 +389,11 @@ void Choreographer::dispatchVsync(nsecs_t timestamp, PhysicalDisplayId, uint32_t
    }
    mLastVsyncEventData = vsyncEventData;
    for (const auto& cb : callbacks) {
        if (cb.extendedCallback != nullptr) {
        if (cb.vsyncCallback != nullptr) {
            const ChoreographerFrameCallbackDataImpl frameCallbackData =
                    createFrameCallbackData(timestamp);
            mInCallback = true;
            cb.extendedCallback(reinterpret_cast<const AChoreographerFrameCallbackData*>(
            cb.vsyncCallback(reinterpret_cast<const AChoreographerFrameCallbackData*>(
                                     &frameCallbackData),
                             cb.data);
            mInCallback = false;
@@ -522,10 +522,9 @@ void AChoreographer_routePostFrameCallbackDelayed64(AChoreographer* choreographe
                                                    void* data, uint32_t delayMillis) {
    return AChoreographer_postFrameCallbackDelayed64(choreographer, callback, data, delayMillis);
}
void AChoreographer_routePostExtendedFrameCallback(AChoreographer* choreographer,
                                                   AChoreographer_extendedFrameCallback callback,
                                                   void* data) {
    return AChoreographer_postExtendedFrameCallback(choreographer, callback, data);
void AChoreographer_routePostVsyncCallback(AChoreographer* choreographer,
                                           AChoreographer_vsyncCallback callback, void* data) {
    return AChoreographer_postVsyncCallback(choreographer, callback, data);
}
void AChoreographer_routeRegisterRefreshRateCallback(AChoreographer* choreographer,
                                                     AChoreographer_refreshRateCallback callback,
@@ -553,9 +552,10 @@ AVsyncId AChoreographerFrameCallbackData_routeGetFrameTimelineVsyncId(
        const AChoreographerFrameCallbackData* data, size_t index) {
    return AChoreographerFrameCallbackData_getFrameTimelineVsyncId(data, index);
}
int64_t AChoreographerFrameCallbackData_routeGetFrameTimelineExpectedPresentTimeNanos(
int64_t AChoreographerFrameCallbackData_routeGetFrameTimelineExpectedPresentationTimeNanos(
        const AChoreographerFrameCallbackData* data, size_t index) {
    return AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentTimeNanos(data, index);
    return AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos(data,
                                                                                         index);
}
int64_t AChoreographerFrameCallbackData_routeGetFrameTimelineDeadlineNanos(
        const AChoreographerFrameCallbackData* data, size_t index) {
@@ -589,9 +589,8 @@ void AChoreographer_postFrameCallbackDelayed(AChoreographer* choreographer,
    AChoreographer_to_Choreographer(choreographer)
            ->postFrameCallbackDelayed(callback, nullptr, nullptr, data, ms2ns(delayMillis));
}
void AChoreographer_postExtendedFrameCallback(AChoreographer* choreographer,
                                              AChoreographer_extendedFrameCallback callback,
                                              void* data) {
void AChoreographer_postVsyncCallback(AChoreographer* choreographer,
                                      AChoreographer_vsyncCallback callback, void* data) {
    AChoreographer_to_Choreographer(choreographer)
            ->postFrameCallbackDelayed(nullptr, nullptr, callback, data, 0);
}
@@ -650,7 +649,7 @@ AVsyncId AChoreographerFrameCallbackData_getFrameTimelineVsyncId(
    LOG_ALWAYS_FATAL_IF(index >= VsyncEventData::kFrameTimelinesLength, "Index out of bounds");
    return frameCallbackData->vsyncEventData.frameTimelines[index].vsyncId;
}
int64_t AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentTimeNanos(
int64_t AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos(
        const AChoreographerFrameCallbackData* data, size_t index) {
    const ChoreographerFrameCallbackDataImpl* frameCallbackData =
            AChoreographerFrameCallbackData_to_ChoreographerFrameCallbackDataImpl(data);
+3 −4
Original line number Diff line number Diff line
@@ -50,9 +50,8 @@ void AChoreographer_routePostFrameCallback64(AChoreographer* choreographer,
void AChoreographer_routePostFrameCallbackDelayed64(AChoreographer* choreographer,
                                                    AChoreographer_frameCallback64 callback,
                                                    void* data, uint32_t delayMillis);
void AChoreographer_routePostExtendedFrameCallback(AChoreographer* choreographer,
                                                   AChoreographer_extendedFrameCallback callback,
                                                   void* data);
void AChoreographer_routePostVsyncCallback(AChoreographer* choreographer,
                                           AChoreographer_vsyncCallback callback, void* data);
void AChoreographer_routeRegisterRefreshRateCallback(AChoreographer* choreographer,
                                                     AChoreographer_refreshRateCallback callback,
                                                     void* data);
@@ -67,7 +66,7 @@ size_t AChoreographerFrameCallbackData_routeGetPreferredFrameTimelineIndex(
        const AChoreographerFrameCallbackData* data);
AVsyncId AChoreographerFrameCallbackData_routeGetFrameTimelineVsyncId(
        const AChoreographerFrameCallbackData* data, size_t index);
int64_t AChoreographerFrameCallbackData_routeGetFrameTimelineExpectedPresentTimeNanos(
int64_t AChoreographerFrameCallbackData_routeGetFrameTimelineExpectedPresentationTimeNanos(
        const AChoreographerFrameCallbackData* data, size_t index);
int64_t AChoreographerFrameCallbackData_routeGetFrameTimelineDeadlineNanos(
        const AChoreographerFrameCallbackData* data, size_t index);
+4 −4
Original line number Diff line number Diff line
@@ -7,12 +7,12 @@ LIBNATIVEDISPLAY {
    AChoreographer_postFrameCallbackDelayed64; # apex # introduced=30
    AChoreographer_registerRefreshRateCallback; # apex # introduced=30
    AChoreographer_unregisterRefreshRateCallback; # apex # introduced=30
    AChoreographer_postExtendedFrameCallback; # apex # introduced=33
    AChoreographer_postVsyncCallback; # apex # introduced=33
    AChoreographerFrameCallbackData_getFrameTimeNanos; # apex # introduced=33
    AChoreographerFrameCallbackData_getFrameTimelinesLength; # apex # introduced=33
    AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex; # apex # introduced=33
    AChoreographerFrameCallbackData_getFrameTimelineVsyncId; # apex # introduced=33
    AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentTimeNanos; # apex # introduced=33
    AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos; # apex # introduced=33
    AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos; # apex # introduced=33
    AChoreographer_create; # apex # introduced=30
    AChoreographer_destroy; # apex # introduced=30
@@ -35,12 +35,12 @@ LIBNATIVEDISPLAY_PLATFORM {
      android::AChoreographer_routePostFrameCallbackDelayed64*;
      android::AChoreographer_routeRegisterRefreshRateCallback*;
      android::AChoreographer_routeUnregisterRefreshRateCallback*;
      android::AChoreographer_routePostExtendedFrameCallback*;
      android::AChoreographer_routePostVsyncCallback*;
      android::AChoreographerFrameCallbackData_routeGetFrameTimeNanos*;
      android::AChoreographerFrameCallbackData_routeGetFrameTimelinesLength*;
      android::AChoreographerFrameCallbackData_routeGetPreferredFrameTimelineIndex*;
      android::AChoreographerFrameCallbackData_routeGetFrameTimelineVsyncId*;
      android::AChoreographerFrameCallbackData_routeGetFrameTimelineExpectedPresentTimeNanos*;
      android::AChoreographerFrameCallbackData_routeGetFrameTimelineExpectedPresentationTimeNanos*;
      android::AChoreographerFrameCallbackData_routeGetFrameTimelineDeadlineNanos*;
      android::AChoreographer_signalRefreshRateCallbacks*;
      android::AChoreographer_getFrameInterval*;