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

Commit 7381d484 authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger: Emit TransactionCompleted callbacks directly." into sc-dev

parents 4d099486 9a803c3e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ filegroup {
        "SurfaceFlingerDefaultFactory.cpp",
        "SurfaceInterceptor.cpp",
        "SurfaceTracing.cpp",
        "TransactionCompletedThread.cpp",
        "TransactionCallbackInvoker.cpp",
    ],
}

+3 −3
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ void BufferStateLayer::releasePendingBuffer(nsecs_t dequeueReadyTime) {
                JankData(surfaceFrame->getToken(), surfaceFrame->getJankType().value()));
    }

    mFlinger->getTransactionCompletedThread().finalizePendingCallbackHandles(
    mFlinger->getTransactionCallbackInvoker().finalizePendingCallbackHandles(
            mDrawingState.callbackHandles, jankData);

    mDrawingState.callbackHandles = {};
@@ -455,14 +455,14 @@ bool BufferStateLayer::setTransactionCompletedListeners(

            // Notify the transaction completed thread that there is a pending latched callback
            // handle
            mFlinger->getTransactionCompletedThread().registerPendingCallbackHandle(handle);
            mFlinger->getTransactionCallbackInvoker().registerPendingCallbackHandle(handle);

            // Store so latched time and release fence can be set
            mCurrentState.callbackHandles.push_back(handle);

        } else { // If this layer will NOT need to be relatched and presented this frame
            // Notify the transaction completed thread this handle is done
            mFlinger->getTransactionCompletedThread().registerUnpresentedCallbackHandle(handle);
            mFlinger->getTransactionCallbackInvoker().registerUnpresentedCallbackHandle(handle);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@
#include "Scheduler/Seamlessness.h"
#include "SurfaceFlinger.h"
#include "SurfaceTracing.h"
#include "TransactionCompletedThread.h"
#include "TransactionCallbackInvoker.h"

using namespace android::surfaceflinger;

+8 −8
Original line number Diff line number Diff line
@@ -2195,8 +2195,8 @@ void SurfaceFlinger::postComposition() {
        }
    });

    mTransactionCompletedThread.addPresentFence(mPreviousPresentFences[0]);
    mTransactionCompletedThread.sendCallbacks();
    mTransactionCallbackInvoker.addPresentFence(mPreviousPresentFences[0]);
    mTransactionCallbackInvoker.sendCallbacks();

    if (display && display->isPrimary() && display->getPowerMode() == hal::PowerMode::ON &&
        presentFenceTime->isValid()) {
@@ -3555,8 +3555,8 @@ void SurfaceFlinger::applyTransactionState(const FrameTimelineInfo& frameTimelin
    // that listeners with SurfaceControls will start registration during setClientStateLocked
    // below.
    for (const auto& listener : listenerCallbacks) {
        mTransactionCompletedThread.startRegistration(listener);
        mTransactionCompletedThread.endRegistration(listener);
        mTransactionCallbackInvoker.startRegistration(listener);
        mTransactionCallbackInvoker.endRegistration(listener);
    }

    std::unordered_set<ListenerCallbacks, ListenerCallbacksHash> listenerCallbacksWithSurfaces;
@@ -3575,12 +3575,12 @@ void SurfaceFlinger::applyTransactionState(const FrameTimelineInfo& frameTimelin
    }

    for (const auto& listenerCallback : listenerCallbacksWithSurfaces) {
        mTransactionCompletedThread.endRegistration(listenerCallback);
        mTransactionCallbackInvoker.endRegistration(listenerCallback);
    }

    // If the state doesn't require a traversal and there are callbacks, send them now
    if (!(clientStateFlags & eTraversalNeeded) && hasListenerCallbacks) {
        mTransactionCompletedThread.sendCallbacks();
        mTransactionCallbackInvoker.sendCallbacks();
    }
    transactionFlags |= clientStateFlags;

@@ -3695,7 +3695,7 @@ uint32_t SurfaceFlinger::setClientStateLocked(
    for (auto& listener : s.listeners) {
        // note that startRegistration will not re-register if the listener has
        // already be registered for a prior surface control
        mTransactionCompletedThread.startRegistration(listener);
        mTransactionCallbackInvoker.startRegistration(listener);
        listenerCallbacks.insert(listener);
    }

@@ -3708,7 +3708,7 @@ uint32_t SurfaceFlinger::setClientStateLocked(
    }
    if (layer == nullptr) {
        for (auto& [listener, callbackIds] : s.listeners) {
            mTransactionCompletedThread.registerUnpresentedCallbackHandle(
            mTransactionCallbackInvoker.registerUnpresentedCallbackHandle(
                    new CallbackHandle(listener, callbackIds, s.surface));
        }
        return 0;
+4 −4
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@
#include "SurfaceFlingerFactory.h"
#include "SurfaceTracing.h"
#include "TracedOrdinal.h"
#include "TransactionCompletedThread.h"
#include "TransactionCallbackInvoker.h"

#include <atomic>
#include <cstdint>
@@ -319,8 +319,8 @@ public:

    void removeFromOffscreenLayers(Layer* layer);

    TransactionCompletedThread& getTransactionCompletedThread() {
        return mTransactionCompletedThread;
    TransactionCallbackInvoker& getTransactionCallbackInvoker() {
        return mTransactionCallbackInvoker;
    }

    // Converts from a binder handle to a Layer
@@ -1161,7 +1161,7 @@ private:
    std::atomic<uint32_t> mHwcFrameMissedCount = 0;
    std::atomic<uint32_t> mGpuFrameMissedCount = 0;

    TransactionCompletedThread mTransactionCompletedThread;
    TransactionCallbackInvoker mTransactionCallbackInvoker;

    // Restrict layers to use two buffers in their bufferqueues.
    bool mLayerTripleBufferingDisabled = false;
Loading