diff options
| author | 2021-02-16 15:42:35 -0800 | |
|---|---|---|
| committer | 2021-02-17 20:33:43 +0000 | |
| commit | 621ec58b54f95a26d7a0b9bf29c5ac9c97d21368 (patch) | |
| tree | e84296691f5a22d6294bc850c62654e51545a440 /libs/gui/BLASTBufferQueue.cpp | |
| parent | e2edd2237bcb681222f2af201afd9016dc95827d (diff) | |
Notify BLAST layer when sideband stream is changed.
Bug: 180121385
Test: dumpsys SurfaceFlinger, manual test Live TV sideband HDMI input.
Change-Id: I821a9fdc6e5c1a446604b1a46dc2e5f720c7155b
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
| -rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 1e6fc2b217..82c9268feb 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -55,7 +55,7 @@ namespace android { ALOGE("[%s](f:%u,a:%u) " x, mName.c_str(), mNumFrameAvailable, mNumAcquired, ##__VA_ARGS__) void BLASTBufferItemConsumer::onDisconnect() { - Mutex::Autolock lock(mFrameEventHistoryMutex); + Mutex::Autolock lock(mMutex); mPreviouslyConnected = mCurrentlyConnected; mCurrentlyConnected = false; if (mPreviouslyConnected) { @@ -66,7 +66,7 @@ void BLASTBufferItemConsumer::onDisconnect() { void BLASTBufferItemConsumer::addAndGetFrameTimestamps(const NewFrameEventsEntry* newTimestamps, FrameEventHistoryDelta* outDelta) { - Mutex::Autolock lock(mFrameEventHistoryMutex); + Mutex::Autolock lock(mMutex); if (newTimestamps) { // BufferQueueProducer only adds a new timestamp on // queueBuffer @@ -90,7 +90,7 @@ void BLASTBufferItemConsumer::updateFrameTimestamps(uint64_t frameNumber, nsecs_ const sp<Fence>& prevReleaseFence, CompositorTiming compositorTiming, nsecs_t latchTime, nsecs_t dequeueReadyTime) { - Mutex::Autolock lock(mFrameEventHistoryMutex); + Mutex::Autolock lock(mMutex); // if the producer is not connected, don't bother updating, // the next producer that connects won't access this frame event @@ -108,7 +108,7 @@ void BLASTBufferItemConsumer::updateFrameTimestamps(uint64_t frameNumber, nsecs_ void BLASTBufferItemConsumer::getConnectionEvents(uint64_t frameNumber, bool* needsDisconnect) { bool disconnect = false; - Mutex::Autolock lock(mFrameEventHistoryMutex); + Mutex::Autolock lock(mMutex); while (!mDisconnectEvents.empty() && mDisconnectEvents.front() <= frameNumber) { disconnect = true; mDisconnectEvents.pop(); @@ -116,6 +116,19 @@ void BLASTBufferItemConsumer::getConnectionEvents(uint64_t frameNumber, bool* ne if (needsDisconnect != nullptr) *needsDisconnect = disconnect; } +void BLASTBufferItemConsumer::setBlastBufferQueue(BLASTBufferQueue* blastbufferqueue) { + Mutex::Autolock lock(mMutex); + mBLASTBufferQueue = blastbufferqueue; +} + +void BLASTBufferItemConsumer::onSidebandStreamChanged() { + Mutex::Autolock lock(mMutex); + if (mBLASTBufferQueue != nullptr) { + sp<NativeHandle> stream = getSidebandStream(); + mBLASTBufferQueue->setSidebandStream(stream); + } +} + BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const sp<SurfaceControl>& surface, int width, int height, int32_t format, bool enableTripleBuffering) @@ -145,6 +158,7 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const sp<SurfaceCont mBufferItemConsumer->setBufferFreedListener(this); mBufferItemConsumer->setDefaultBufferSize(mSize.width, mSize.height); mBufferItemConsumer->setDefaultBufferFormat(convertBufferFormat(format)); + mBufferItemConsumer->setBlastBufferQueue(this); mTransformHint = mSurfaceControl->getTransformHint(); mBufferItemConsumer->setTransformHint(mTransformHint); @@ -160,6 +174,7 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const sp<SurfaceCont } BLASTBufferQueue::~BLASTBufferQueue() { + mBufferItemConsumer->setBlastBufferQueue(nullptr); if (mPendingTransactions.empty()) { return; } @@ -557,6 +572,13 @@ status_t BLASTBufferQueue::setFrameTimelineInfo(const FrameTimelineInfo& frameTi return OK; } +void BLASTBufferQueue::setSidebandStream(const sp<NativeHandle>& stream) { + std::unique_lock _lock{mMutex}; + SurfaceComposerClient::Transaction t; + + t.setSidebandStream(mSurfaceControl, stream).apply(); +} + sp<Surface> BLASTBufferQueue::getSurface(bool includeSurfaceControlHandle) { std::unique_lock _lock{mMutex}; sp<IBinder> scHandle = nullptr; |