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

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

Merge "SurfaceFlinger: correctly pass desired present time for BLAST"

parents aba8e994 f0c5649f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -311,7 +311,9 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) {
    t->setCrop(mSurfaceControl, computeCrop(bufferItem));
    t->setTransform(mSurfaceControl, bufferItem.mTransform);
    t->setTransformToDisplayInverse(mSurfaceControl, bufferItem.mTransformToDisplayInverse);
    if (!bufferItem.mIsAutoTimestamp) {
        t->setDesiredPresentTime(bufferItem.mTimestamp);
    }
    t->setFrameNumber(mSurfaceControl, bufferItem.mFrameNumber);

    if (!mNextFrameTimelineVsyncIdQueue.empty()) {
+6 −3
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public:
    virtual status_t setTransactionState(
            int64_t frameTimelineVsyncId, const Vector<ComposerState>& state,
            const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken,
            const InputWindowCommands& commands, int64_t desiredPresentTime,
            const InputWindowCommands& commands, int64_t desiredPresentTime, bool isAutoTimestamp,
            const client_cache_t& uncacheBuffer, bool hasListenerCallbacks,
            const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId) {
        Parcel data, reply;
@@ -92,6 +92,7 @@ public:
        SAFE_PARCEL(data.writeStrongBinder, applyToken);
        SAFE_PARCEL(commands.write, data);
        SAFE_PARCEL(data.writeInt64, desiredPresentTime);
        SAFE_PARCEL(data.writeBool, isAutoTimestamp);
        SAFE_PARCEL(data.writeStrongBinder, uncacheBuffer.token.promote());
        SAFE_PARCEL(data.writeUint64, uncacheBuffer.id);
        SAFE_PARCEL(data.writeBool, hasListenerCallbacks);
@@ -1297,7 +1298,9 @@ status_t BnSurfaceComposer::onTransact(
            SAFE_PARCEL(inputWindowCommands.read, data);

            int64_t desiredPresentTime = 0;
            bool isAutoTimestamp = true;
            SAFE_PARCEL(data.readInt64, &desiredPresentTime);
            SAFE_PARCEL(data.readBool, &isAutoTimestamp);

            client_cache_t uncachedBuffer;
            sp<IBinder> tmpBinder;
@@ -1323,8 +1326,8 @@ status_t BnSurfaceComposer::onTransact(

            return setTransactionState(frameTimelineVsyncId, state, displays, stateFlags,
                                       applyToken, inputWindowCommands, desiredPresentTime,
                                       uncachedBuffer, hasListenerCallbacks, listenerCallbacks,
                                       transactionId);
                                       isAutoTimestamp, uncachedBuffer, hasListenerCallbacks,
                                       listenerCallbacks, transactionId);
        }
        case BOOT_FINISHED: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
+14 −4
Original line number Diff line number Diff line
@@ -395,6 +395,7 @@ SurfaceComposerClient::Transaction::Transaction(const Transaction& other)
        mExplicitEarlyWakeupEnd(other.mExplicitEarlyWakeupEnd),
        mContainsBuffer(other.mContainsBuffer),
        mDesiredPresentTime(other.mDesiredPresentTime),
        mIsAutoTimestamp(other.mIsAutoTimestamp),
        mFrameTimelineVsyncId(other.mFrameTimelineVsyncId) {
    mDisplayStates = other.mDisplayStates;
    mComposerStates = other.mComposerStates;
@@ -424,6 +425,7 @@ status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel
    const bool explicitEarlyWakeupEnd = parcel->readBool();
    const bool containsBuffer = parcel->readBool();
    const int64_t desiredPresentTime = parcel->readInt64();
    const bool isAutoTimestamp = parcel->readBool();
    const int64_t frameTimelineVsyncId = parcel->readInt64();

    size_t count = static_cast<size_t>(parcel->readUint32());
@@ -497,6 +499,7 @@ status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel
    mExplicitEarlyWakeupEnd = explicitEarlyWakeupEnd;
    mContainsBuffer = containsBuffer;
    mDesiredPresentTime = desiredPresentTime;
    mIsAutoTimestamp = isAutoTimestamp;
    mFrameTimelineVsyncId = frameTimelineVsyncId;
    mDisplayStates = displayStates;
    mListenerCallbacks = listenerCallbacks;
@@ -527,6 +530,7 @@ status_t SurfaceComposerClient::Transaction::writeToParcel(Parcel* parcel) const
    parcel->writeBool(mExplicitEarlyWakeupEnd);
    parcel->writeBool(mContainsBuffer);
    parcel->writeInt64(mDesiredPresentTime);
    parcel->writeBool(mIsAutoTimestamp);
    parcel->writeInt64(mFrameTimelineVsyncId);
    parcel->writeUint32(static_cast<uint32_t>(mDisplayStates.size()));
    for (auto const& displayState : mDisplayStates) {
@@ -628,7 +632,8 @@ void SurfaceComposerClient::Transaction::clear() {
    mEarlyWakeup = false;
    mExplicitEarlyWakeupStart = false;
    mExplicitEarlyWakeupEnd = false;
    mDesiredPresentTime = -1;
    mDesiredPresentTime = 0;
    mIsAutoTimestamp = true;
    mFrameTimelineVsyncId = ISurfaceComposer::INVALID_VSYNC_ID;
}

@@ -640,8 +645,9 @@ void SurfaceComposerClient::doUncacheBufferTransaction(uint64_t cacheId) {
    uncacheBuffer.id = cacheId;

    sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
    sf->setTransactionState(ISurfaceComposer::INVALID_VSYNC_ID, {}, {}, 0, applyToken, {}, -1,
                            uncacheBuffer, false, {}, 0 /* Undefined transactionId */);
    sf->setTransactionState(ISurfaceComposer::INVALID_VSYNC_ID, {}, {}, 0, applyToken, {},
                            systemTime(), true, uncacheBuffer, false, {},
                            0 /* Undefined transactionId */);
}

void SurfaceComposerClient::Transaction::cacheBuffers() {
@@ -759,7 +765,7 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous) {

    sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
    sf->setTransactionState(mFrameTimelineVsyncId, composerStates, displayStates, flags, applyToken,
                            mInputWindowCommands, mDesiredPresentTime,
                            mInputWindowCommands, mDesiredPresentTime, mIsAutoTimestamp,
                            {} /*uncacheBuffer - only set in doUncacheBufferTransaction*/,
                            hasListenerCallbacks, listenerCallbacks, mId);
    mId = generateId();
@@ -1201,6 +1207,9 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBuffe
    }
    s->what |= layer_state_t::eBufferChanged;
    s->buffer = buffer;
    if (mIsAutoTimestamp) {
        mDesiredPresentTime = systemTime();
    }

    registerSurfaceControlForCallback(sc);

@@ -1295,6 +1304,7 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setSideb
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesiredPresentTime(
        nsecs_t desiredPresentTime) {
    mDesiredPresentTime = desiredPresentTime;
    mIsAutoTimestamp = false;
    return *this;
}

+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ public:
            int64_t frameTimelineVsyncId, const Vector<ComposerState>& state,
            const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken,
            const InputWindowCommands& inputWindowCommands, int64_t desiredPresentTime,
            const client_cache_t& uncacheBuffer, bool hasListenerCallbacks,
            bool isAutoTimestamp, const client_cache_t& uncacheBuffer, bool hasListenerCallbacks,
            const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId) = 0;

    /* signal that we're done booting.
+5 −1
Original line number Diff line number Diff line
@@ -373,13 +373,17 @@ public:
        // to be presented. When it is not possible to present at exactly that time, it will be
        // presented after the time has passed.
        //
        // If the client didn't pass a desired presentation time, mDesiredPresentTime will be
        // populated to the time setBuffer was called, and mIsAutoTimestamp will be set to true.
        //
        // Desired present times that are more than 1 second in the future may be ignored.
        // When a desired present time has already passed, the transaction will be presented as soon
        // as possible.
        //
        // Transactions from the same process are presented in the same order that they are applied.
        // The desired present time does not affect this ordering.
        int64_t mDesiredPresentTime = -1;
        int64_t mDesiredPresentTime = 0;
        bool mIsAutoTimestamp = true;

        // The vsync Id provided by Choreographer.getVsyncId
        int64_t mFrameTimelineVsyncId = ISurfaceComposer::INVALID_VSYNC_ID;
Loading