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

Commit 1885bb78 authored by Alec Mouri's avatar Alec Mouri Committed by Automerger Merge Worker
Browse files

Merge "Receive refresh rate callbacks from DMS" into rvc-dev am: a511811b

Change-Id: Ia5036c94370bfcaa6e81780b0ef92fdceea9e355
parents 89a32780 a511811b
Loading
Loading
Loading
Loading
+9 −5
Original line number Original line Diff line number Diff line
@@ -75,14 +75,16 @@ AChoreographer* AChoreographer_getInstance() __INTRODUCED_IN(24);
 * Deprecated: Use AChoreographer_postFrameCallback64 instead.
 * Deprecated: Use AChoreographer_postFrameCallback64 instead.
 */
 */
void AChoreographer_postFrameCallback(AChoreographer* choreographer,
void AChoreographer_postFrameCallback(AChoreographer* choreographer,
        AChoreographer_frameCallback callback, void* data) __INTRODUCED_IN(24) __DEPRECATED_IN(29);
                                      AChoreographer_frameCallback callback, void* data)
        __INTRODUCED_IN(24) __DEPRECATED_IN(29);


/**
/**
 * Deprecated: Use AChoreographer_postFrameCallbackDelayed64 instead.
 * Deprecated: Use AChoreographer_postFrameCallbackDelayed64 instead.
 */
 */
void AChoreographer_postFrameCallbackDelayed(AChoreographer* choreographer,
void AChoreographer_postFrameCallbackDelayed(AChoreographer* choreographer,
                                             AChoreographer_frameCallback callback, void* data,
                                             AChoreographer_frameCallback callback, void* data,
                long delayMillis) __INTRODUCED_IN(24) __DEPRECATED_IN(29);
                                             long delayMillis) __INTRODUCED_IN(24)
        __DEPRECATED_IN(29);


#endif /* __ANDROID_API__ >= 24 */
#endif /* __ANDROID_API__ >= 24 */


@@ -95,7 +97,8 @@ void AChoreographer_postFrameCallbackDelayed(AChoreographer* choreographer,
 * Available since API level 29.
 * Available since API level 29.
 */
 */
void AChoreographer_postFrameCallback64(AChoreographer* choreographer,
void AChoreographer_postFrameCallback64(AChoreographer* choreographer,
                AChoreographer_frameCallback64 callback, void* data) __INTRODUCED_IN(29);
                                        AChoreographer_frameCallback64 callback, void* data)
        __INTRODUCED_IN(29);


/**
/**
 * Post a callback to be run on the frame following the specified delay.  The
 * Post a callback to be run on the frame following the specified delay.  The
@@ -105,7 +108,8 @@ void AChoreographer_postFrameCallback64(AChoreographer* choreographer,
 * Available since API level 29.
 * Available since API level 29.
 */
 */
void AChoreographer_postFrameCallbackDelayed64(AChoreographer* choreographer,
void AChoreographer_postFrameCallbackDelayed64(AChoreographer* choreographer,
                AChoreographer_frameCallback64 callback, void* data, uint32_t delayMillis) __INTRODUCED_IN(29);
                                               AChoreographer_frameCallback64 callback, void* data,
                                               uint32_t delayMillis) __INTRODUCED_IN(29);


#endif /* __ANDROID_API__ >= 29 */
#endif /* __ANDROID_API__ >= 29 */


+3 −10
Original line number Original line Diff line number Diff line
@@ -36,10 +36,7 @@ static const size_t EVENT_BUFFER_SIZE = 100;
DisplayEventDispatcher::DisplayEventDispatcher(const sp<Looper>& looper,
DisplayEventDispatcher::DisplayEventDispatcher(const sp<Looper>& looper,
                                               ISurfaceComposer::VsyncSource vsyncSource,
                                               ISurfaceComposer::VsyncSource vsyncSource,
                                               ISurfaceComposer::ConfigChanged configChanged)
                                               ISurfaceComposer::ConfigChanged configChanged)
      : mLooper(looper),
      : mLooper(looper), mReceiver(vsyncSource, configChanged), mWaitingForVsync(false) {
        mReceiver(vsyncSource, configChanged),
        mWaitingForVsync(false),
        mConfigChangeFlag(configChanged) {
    ALOGV("dispatcher %p ~ Initializing display event dispatcher.", this);
    ALOGV("dispatcher %p ~ Initializing display event dispatcher.", this);
}
}


@@ -92,16 +89,12 @@ status_t DisplayEventDispatcher::scheduleVsync() {
    return OK;
    return OK;
}
}


void DisplayEventDispatcher::toggleConfigEvents(ISurfaceComposer::ConfigChanged configChangeFlag) {
void DisplayEventDispatcher::requestLatestConfig() {
    if (mConfigChangeFlag == configChangeFlag) {
    status_t status = mReceiver.requestLatestConfig();
        return;
    }
    status_t status = mReceiver.toggleConfigEvents(configChangeFlag);
    if (status) {
    if (status) {
        ALOGW("Failed enable config events, status=%d", status);
        ALOGW("Failed enable config events, status=%d", status);
        return;
        return;
    }
    }
    mConfigChangeFlag = configChangeFlag;
}
}


int DisplayEventDispatcher::getFd() const {
int DisplayEventDispatcher::getFd() const {
+2 −3
Original line number Original line Diff line number Diff line
@@ -79,10 +79,9 @@ status_t DisplayEventReceiver::requestNextVsync() {
    return NO_INIT;
    return NO_INIT;
}
}


status_t DisplayEventReceiver::toggleConfigEvents(
status_t DisplayEventReceiver::requestLatestConfig() {
        ISurfaceComposer::ConfigChanged configChangeFlag) {
    if (mEventConnection != nullptr) {
    if (mEventConnection != nullptr) {
        mEventConnection->toggleConfigEvents(configChangeFlag);
        mEventConnection->requestLatestConfig();
        return NO_ERROR;
        return NO_ERROR;
    }
    }
    return NO_INIT;
    return NO_INIT;
+7 −8
Original line number Original line Diff line number Diff line
@@ -26,8 +26,8 @@ enum class Tag : uint32_t {
    STEAL_RECEIVE_CHANNEL = IBinder::FIRST_CALL_TRANSACTION,
    STEAL_RECEIVE_CHANNEL = IBinder::FIRST_CALL_TRANSACTION,
    SET_VSYNC_RATE,
    SET_VSYNC_RATE,
    REQUEST_NEXT_VSYNC,
    REQUEST_NEXT_VSYNC,
    TOGGLE_CONFIG_EVENTS,
    REQUEST_LATEST_CONFIG,
    LAST = TOGGLE_CONFIG_EVENTS,
    LAST = REQUEST_LATEST_CONFIG,
};
};


} // Anonymous namespace
} // Anonymous namespace
@@ -55,10 +55,9 @@ public:
                Tag::REQUEST_NEXT_VSYNC);
                Tag::REQUEST_NEXT_VSYNC);
    }
    }


    void toggleConfigEvents(ISurfaceComposer::ConfigChanged configChangeFlag) override {
    void requestLatestConfig() override {
        callRemoteAsync<decltype(
        callRemoteAsync<decltype(&IDisplayEventConnection::requestLatestConfig)>(
                &IDisplayEventConnection::toggleConfigEvents)>(Tag::TOGGLE_CONFIG_EVENTS,
                Tag::REQUEST_LATEST_CONFIG);
                                                               configChangeFlag);
    }
    }
};
};


@@ -81,8 +80,8 @@ status_t BnDisplayEventConnection::onTransact(uint32_t code, const Parcel& data,
            return callLocal(data, reply, &IDisplayEventConnection::setVsyncRate);
            return callLocal(data, reply, &IDisplayEventConnection::setVsyncRate);
        case Tag::REQUEST_NEXT_VSYNC:
        case Tag::REQUEST_NEXT_VSYNC:
            return callLocalAsync(data, reply, &IDisplayEventConnection::requestNextVsync);
            return callLocalAsync(data, reply, &IDisplayEventConnection::requestNextVsync);
        case Tag::TOGGLE_CONFIG_EVENTS:
        case Tag::REQUEST_LATEST_CONFIG:
            return callLocalAsync(data, reply, &IDisplayEventConnection::toggleConfigEvents);
            return callLocalAsync(data, reply, &IDisplayEventConnection::requestLatestConfig);
    }
    }
}
}


+1 −2
Original line number Original line Diff line number Diff line
@@ -31,7 +31,7 @@ public:
    status_t initialize();
    status_t initialize();
    void dispose();
    void dispose();
    status_t scheduleVsync();
    status_t scheduleVsync();
    void toggleConfigEvents(ISurfaceComposer::ConfigChanged configChangeFlag);
    void requestLatestConfig();
    int getFd() const;
    int getFd() const;
    virtual int handleEvent(int receiveFd, int events, void* data);
    virtual int handleEvent(int receiveFd, int events, void* data);


@@ -42,7 +42,6 @@ private:
    sp<Looper> mLooper;
    sp<Looper> mLooper;
    DisplayEventReceiver mReceiver;
    DisplayEventReceiver mReceiver;
    bool mWaitingForVsync;
    bool mWaitingForVsync;
    ISurfaceComposer::ConfigChanged mConfigChangeFlag;


    virtual void dispatchVsync(nsecs_t timestamp, PhysicalDisplayId displayId, uint32_t count) = 0;
    virtual void dispatchVsync(nsecs_t timestamp, PhysicalDisplayId displayId, uint32_t count) = 0;
    virtual void dispatchHotplug(nsecs_t timestamp, PhysicalDisplayId displayId,
    virtual void dispatchHotplug(nsecs_t timestamp, PhysicalDisplayId displayId,
Loading