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

Commit 5b9dfbdb authored by Sungtak Lee's avatar Sungtak Lee
Browse files

C2AIDL: Provide rendered frame history

Bug: 362409150
Test: presubmit
Change-Id: Ib65f46096efdc69f8a0977ac423f5b43c91d15b5
parent 359ce7c3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -96,6 +96,10 @@ void GraphicBufferAllocator::onBufferAttached(uint32_t generation) {
    mGraphicsTracker->onAttached(generation);
}

void GraphicBufferAllocator::pollForRenderedFrames(FrameEventHistoryDelta* delta) {
    mGraphicsTracker->pollForRenderedFrames(delta);
}

c2_status_t GraphicBufferAllocator::allocate(
        uint32_t width, uint32_t height, ::android::PixelFormat format, uint64_t usage,
        AHardwareBuffer **buf, ::android::sp<::android::Fence> *fence) {
+13 −0
Original line number Diff line number Diff line
@@ -1003,6 +1003,19 @@ c2_status_t GraphicsTracker::render(const C2ConstGraphicBlock& blk,
    return C2_OK;
}

void GraphicsTracker::pollForRenderedFrames(FrameEventHistoryDelta* delta) {
    sp<IGraphicBufferProducer> igbp;
    {
        std::unique_lock<std::mutex> l(mLock);
        if (mBufferCache) {
            igbp = mBufferCache->mIgbp;
        }
    }
    if (igbp) {
        igbp->getFrameTimestamps(delta);
    }
}

void GraphicsTracker::onReleased(uint32_t generation) {
    bool updateDequeue = false;
    {
+5 −1
Original line number Diff line number Diff line
@@ -3407,7 +3407,11 @@ uint64_t Codec2Client::Component::configConsumerUsage(

void Codec2Client::Component::pollForRenderedFrames(FrameEventHistoryDelta* delta) {
    if (mAidlBase) {
        // TODO b/311348680
        std::shared_ptr<AidlGraphicBufferAllocator> gba =
                mGraphicBufferAllocators->current();
        if (gba) {
            gba->pollForRenderedFrames(delta);
        }
        return;
    }
    mOutputBufferQueue->pollForRenderedFrames(delta);
+5 −0
Original line number Diff line number Diff line
@@ -84,6 +84,11 @@ public:
     */
    void onBufferAttached(uint32_t generation);

    /**
     * Retrieve frame event history from the crurrent surface if any.
     */
    void pollForRenderedFrames(::android::FrameEventHistoryDelta* delta);

    /**
     * Allocates a buffer.
     *
+6 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ namespace aidl::android::hardware::media::c2::implementation {

using ::android::IGraphicBufferProducer;
using ::android::GraphicBuffer;
using ::android::FrameEventHistoryDelta;
using ::android::Fence;
using ::android::PixelFormat;
using ::android::sp;
@@ -132,6 +133,11 @@ public:
                       const IGraphicBufferProducer::QueueBufferInput& input,
                       IGraphicBufferProducer::QueueBufferOutput *output);

    /**
     * Retrieve frame event history from the crurrent surface if any.
     */
    void pollForRenderedFrames(FrameEventHistoryDelta* delta);

    /**
     * Notifies when a Buffer is ready to allocate from Graphics.
     * If generation does not match to the current, notifications via the interface