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

Commit 9b611b7f authored by Robert Carr's avatar Robert Carr
Browse files

BLASTBufferQueue: Support setFrameTimelineVsync

Surface::setFrameTimelineVsync calls through to SurfaceFlinger
using the IGBP as a token. But of course in the case of BBQ
we have no IGBP on the server side, and this will produce errors.
To fix this we continue overriding Surface methods in the BBQSurface
, and forward through to the SurfaceControl variants of the function.
Unlike the previous CL for setFrameRate, this is a currently un-released
API, and so I'd also like to investigate as a follow-up...can we go
SurfaceControl path only?

Bug: 170890018
Test: Existing tests pass
Change-Id: I5316c38f462c3808d5769ede6666594b911c8242
parent 9c006e03
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -381,6 +381,10 @@ public:
        }
        return mBbq->setFrameRate(frameRate, compatibility);
    }

    status_t setFrameTimelineVsync(int64_t frameTimelineVsyncId) override {
        return mBbq->setFrameTimelineVsync(frameTimelineVsyncId);
    }
};

// TODO: Can we coalesce this with frame updates? Need to confirm
@@ -393,6 +397,14 @@ status_t BLASTBufferQueue::setFrameRate(float frameRate, int8_t compatibility) {
        .apply();
}

status_t BLASTBufferQueue::setFrameTimelineVsync(int64_t frameTimelineVsyncId) {
    std::unique_lock _lock{mMutex};
    SurfaceComposerClient::Transaction t;

    return t.setFrameTimelineVsync(mSurfaceControl, frameTimelineVsyncId)
        .apply();
}

sp<Surface> BLASTBufferQueue::getSurface() {
    return new BBQSurface(mProducer, true, this);
}
+2 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ status_t layer_state_t::write(Parcel& output) const
    SAFE_PARCEL(output.writeByte, frameRateCompatibility);
    SAFE_PARCEL(output.writeUint32, fixedTransformHint);
    SAFE_PARCEL(output.writeUint64, frameNumber);
    SAFE_PARCEL(output.writeInt64, frameTimelineVsyncId);
    return NO_ERROR;
}

@@ -250,6 +251,7 @@ status_t layer_state_t::read(const Parcel& input)
    SAFE_PARCEL(input.readUint32, &tmpUint32);
    fixedTransformHint = static_cast<ui::Transform::RotationFlags>(tmpUint32);
    SAFE_PARCEL(input.readUint64, &frameNumber);
    SAFE_PARCEL(input.readInt64, &frameTimelineVsyncId);
    return NO_ERROR;
}

+6 −1
Original line number Diff line number Diff line
@@ -1521,7 +1521,7 @@ int Surface::dispatchSetFrameTimelineVsync(va_list args) {
    auto frameTimelineVsyncId = static_cast<int64_t>(va_arg(args, int64_t));

    ALOGV("Surface::dispatchSetFrameTimelineVsync");
    return composerService()->setFrameTimelineVsync(mGraphicBufferProducer, frameTimelineVsyncId);
    return setFrameTimelineVsync(frameTimelineVsyncId);
}

bool Surface::transformToDisplayInverse() {
@@ -2288,4 +2288,9 @@ status_t Surface::setFrameRate(float frameRate, int8_t compatibility) {
    return composerService()->setFrameRate(mGraphicBufferProducer, frameRate, compatibility);
}

status_t Surface::setFrameTimelineVsync(int64_t frameTimelineVsyncId) {
    return composerService()->setFrameTimelineVsync(mGraphicBufferProducer,
        frameTimelineVsyncId);
}

}; // namespace android
+13 −0
Original line number Diff line number Diff line
@@ -1510,6 +1510,19 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFrame
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFrameTimelineVsync(
        const sp<SurfaceControl>& sc, int64_t frameTimelineVsyncId) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }

    s->what |= layer_state_t::eFrameTimelineVsyncChanged;
    s->frameTimelineVsyncId = frameTimelineVsyncId;
    return *this;
}

// ---------------------------------------------------------------------------

DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ public:
    void flushShadowQueue() { mFlushShadowQueue = true; }

    status_t setFrameRate(float frameRate, int8_t compatibility);
    status_t setFrameTimelineVsync(int64_t frameTimelineVsyncId);

    virtual ~BLASTBufferQueue() = default;

Loading