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

Commit f810b29e authored by Brian C. Anderson's avatar Brian C. Anderson Committed by Android (Google) Code Review
Browse files

Merge changes from topic 'GPU_replace_GL'

* changes:
  Fix unexpected FrameEvents on BufferQueue reconnect
  Add FrameEvents::isValidTimestamp
  Change GL references to GPU for getFrameTimestamps.
  Clean up FrameTimestamp log messages.
parents 873e2eee 5ea5e590
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -62,11 +62,12 @@ public:
    public:
        explicit ProxyConsumerListener(const wp<ConsumerListener>& consumerListener);
        virtual ~ProxyConsumerListener();
        virtual void onFrameAvailable(const BufferItem& item) override;
        virtual void onFrameReplaced(const BufferItem& item) override;
        virtual void onBuffersReleased() override;
        virtual void onSidebandStreamChanged() override;
        virtual void addAndGetFrameTimestamps(
        void onDisconnect() override;
        void onFrameAvailable(const BufferItem& item) override;
        void onFrameReplaced(const BufferItem& item) override;
        void onBuffersReleased() override;
        void onSidebandStreamChanged() override;
        void addAndGetFrameTimestamps(
                const NewFrameEventsEntry* newTimestamps,
                FrameEventHistoryDelta* outDelta) override;
    private:
+28 −17
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ enum class FrameEvent {
    ACQUIRE,
    FIRST_REFRESH_START,
    LAST_REFRESH_START,
    GL_COMPOSITION_DONE,
    GPU_COMPOSITION_DONE,
    DISPLAY_PRESENT,
    DISPLAY_RETIRE,
    DEQUEUE_READY,
@@ -52,6 +52,16 @@ enum class FrameEvent {

// A collection of timestamps corresponding to a single frame.
struct FrameEvents {
    static constexpr auto EVENT_COUNT =
            static_cast<size_t>(FrameEvent::EVENT_COUNT);
    static_assert(EVENT_COUNT <= 32, "Event count sanity check failed.");
    static constexpr nsecs_t TIMESTAMP_PENDING =
            std::numeric_limits<nsecs_t>::max();

    static inline bool isValidTimestamp(nsecs_t time) {
        return time != TIMESTAMP_PENDING;
    }

    bool hasPostedInfo() const;
    bool hasRequestedPresentInfo() const;
    bool hasLatchInfo() const;
@@ -67,11 +77,8 @@ struct FrameEvents {
    void checkFencesForCompletion();
    void dump(String8& outString) const;

    static constexpr size_t EVENT_COUNT =
            static_cast<size_t>(FrameEvent::EVENT_COUNT);
    static_assert(EVENT_COUNT <= 32, "Event count sanity check failed.");

    bool valid{false};
    int connectId{0};
    uint64_t frameNumber{0};

    // Whether or not certain points in the frame's life cycle have been
@@ -81,12 +88,12 @@ struct FrameEvents {
    bool addRetireCalled{false};
    bool addReleaseCalled{false};

    nsecs_t postedTime{-1};
    nsecs_t requestedPresentTime{-1};
    nsecs_t latchTime{-1};
    nsecs_t firstRefreshStartTime{-1};
    nsecs_t lastRefreshStartTime{-1};
    nsecs_t dequeueReadyTime{-1};
    nsecs_t postedTime{TIMESTAMP_PENDING};
    nsecs_t requestedPresentTime{TIMESTAMP_PENDING};
    nsecs_t latchTime{TIMESTAMP_PENDING};
    nsecs_t firstRefreshStartTime{TIMESTAMP_PENDING};
    nsecs_t lastRefreshStartTime{TIMESTAMP_PENDING};
    nsecs_t dequeueReadyTime{TIMESTAMP_PENDING};

    std::shared_ptr<FenceTime> acquireFence{FenceTime::NO_FENCE};
    std::shared_ptr<FenceTime> gpuCompositionDoneFence{FenceTime::NO_FENCE};
@@ -206,6 +213,8 @@ class ConsumerFrameEventHistory : public FrameEventHistory {
public:
    ~ConsumerFrameEventHistory() override;

    void onDisconnect();

    void initializeCompositorTiming(const CompositorTiming& compositorTiming);

    void addQueue(const NewFrameEventsEntry& newEntry);
@@ -227,11 +236,13 @@ private:
            const std::array<FrameEvents, MAX_FRAME_HISTORY>::iterator& frame);

    std::array<FrameEventDirtyFields, MAX_FRAME_HISTORY> mFramesDirty;

    size_t mQueueOffset{0};
    size_t mCompositionOffset{0};
    size_t mRetireOffset{0};
    size_t mReleaseOffset{0};

    int mCurrentConnectId{0};
    bool mProducerWantsEvents{false};
};

@@ -273,12 +284,12 @@ private:
    bool mAddRetireCalled{0};
    bool mAddReleaseCalled{0};

    nsecs_t mPostedTime{0};
    nsecs_t mRequestedPresentTime{0};
    nsecs_t mLatchTime{0};
    nsecs_t mFirstRefreshStartTime{0};
    nsecs_t mLastRefreshStartTime{0};
    nsecs_t mDequeueReadyTime{0};
    nsecs_t mPostedTime{FrameEvents::TIMESTAMP_PENDING};
    nsecs_t mRequestedPresentTime{FrameEvents::TIMESTAMP_PENDING};
    nsecs_t mLatchTime{FrameEvents::TIMESTAMP_PENDING};
    nsecs_t mFirstRefreshStartTime{FrameEvents::TIMESTAMP_PENDING};
    nsecs_t mLastRefreshStartTime{FrameEvents::TIMESTAMP_PENDING};
    nsecs_t mDequeueReadyTime{FrameEvents::TIMESTAMP_PENDING};

    FenceTime::Snapshot mGpuCompositionDoneFence;
    FenceTime::Snapshot mDisplayPresentFence;
+3 −0
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ public:
    ConsumerListener() { }
    virtual ~ConsumerListener();

    // onDisconnect is called when a producer disconnects from the BufferQueue.
    virtual void onDisconnect() {} /* Asynchronous */

    // onFrameAvailable is called from queueBuffer each time an additional
    // frame becomes available for consumption. This means that frames that
    // are queued while in asynchronous mode only trigger the callback if no
+7 −0
Original line number Diff line number Diff line
@@ -31,6 +31,13 @@ BufferQueue::ProxyConsumerListener::ProxyConsumerListener(

BufferQueue::ProxyConsumerListener::~ProxyConsumerListener() {}

void BufferQueue::ProxyConsumerListener::onDisconnect() {
    sp<ConsumerListener> listener(mConsumerListener.promote());
    if (listener != NULL) {
        listener->onDisconnect();
    }
}

void BufferQueue::ProxyConsumerListener::onFrameAvailable(
        const BufferItem& item) {
    sp<ConsumerListener> listener(mConsumerListener.promote());
+1 −0
Original line number Diff line number Diff line
@@ -1275,6 +1275,7 @@ status_t BufferQueueProducer::disconnect(int api, DisconnectMode mode) {
    // Call back without lock held
    if (listener != NULL) {
        listener->onBuffersReleased();
        listener->onDisconnect();
    }

    return status;
Loading