Loading libs/gui/BLASTBufferQueue.cpp +19 −0 Original line number Original line Diff line number Diff line Loading @@ -630,7 +630,10 @@ bool BLASTBufferQueue::maxBuffersAcquired(bool includeExtraAcquire) const { class BBQSurface : public Surface { class BBQSurface : public Surface { private: private: std::mutex mMutex; sp<BLASTBufferQueue> mBbq; sp<BLASTBufferQueue> mBbq; bool mDestroyed = false; public: public: BBQSurface(const sp<IGraphicBufferProducer>& igbp, bool controlledByApp, BBQSurface(const sp<IGraphicBufferProducer>& igbp, bool controlledByApp, const sp<IBinder>& scHandle, const sp<BLASTBufferQueue>& bbq) const sp<IBinder>& scHandle, const sp<BLASTBufferQueue>& bbq) Loading @@ -650,6 +653,10 @@ public: status_t setFrameRate(float frameRate, int8_t compatibility, status_t setFrameRate(float frameRate, int8_t compatibility, int8_t changeFrameRateStrategy) override { int8_t changeFrameRateStrategy) override { std::unique_lock _lock{mMutex}; if (mDestroyed) { return DEAD_OBJECT; } if (!ValidateFrameRate(frameRate, compatibility, changeFrameRateStrategy, if (!ValidateFrameRate(frameRate, compatibility, changeFrameRateStrategy, "BBQSurface::setFrameRate")) { "BBQSurface::setFrameRate")) { return BAD_VALUE; return BAD_VALUE; Loading @@ -658,8 +665,20 @@ public: } } status_t setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInfo) override { status_t setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInfo) override { std::unique_lock _lock{mMutex}; if (mDestroyed) { return DEAD_OBJECT; } return mBbq->setFrameTimelineInfo(frameTimelineInfo); return mBbq->setFrameTimelineInfo(frameTimelineInfo); } } void destroy() override { Surface::destroy(); std::unique_lock _lock{mMutex}; mDestroyed = true; mBbq = nullptr; } }; }; // TODO: Can we coalesce this with frame updates? Need to confirm // TODO: Can we coalesce this with frame updates? Need to confirm Loading libs/gui/Surface.cpp +10 −0 Original line number Original line Diff line number Diff line Loading @@ -2622,4 +2622,14 @@ status_t Surface::setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInf return composerService()->setFrameTimelineInfo(mGraphicBufferProducer, frameTimelineInfo); return composerService()->setFrameTimelineInfo(mGraphicBufferProducer, frameTimelineInfo); } } sp<IBinder> Surface::getSurfaceControlHandle() const { Mutex::Autolock lock(mMutex); return mSurfaceControlHandle; } void Surface::destroy() { Mutex::Autolock lock(mMutex); mSurfaceControlHandle = nullptr; } }; // namespace android }; // namespace android libs/gui/include/gui/Surface.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -99,7 +99,7 @@ public: */ */ sp<IGraphicBufferProducer> getIGraphicBufferProducer() const; sp<IGraphicBufferProducer> getIGraphicBufferProducer() const; sp<IBinder> getSurfaceControlHandle() const { return mSurfaceControlHandle; } sp<IBinder> getSurfaceControlHandle() const; /* convenience function to check that the given surface is non NULL as /* convenience function to check that the given surface is non NULL as * well as its IGraphicBufferProducer */ * well as its IGraphicBufferProducer */ Loading Loading @@ -333,6 +333,7 @@ public: virtual int connect( virtual int connect( int api, bool reportBufferRemoval, int api, bool reportBufferRemoval, const sp<SurfaceListener>& sListener); const sp<SurfaceListener>& sListener); virtual void destroy(); // When client connects to Surface with reportBufferRemoval set to true, any buffers removed // When client connects to Surface with reportBufferRemoval set to true, any buffers removed // from this Surface will be collected and returned here. Once this method returns, these // from this Surface will be collected and returned here. Once this method returns, these Loading Loading
libs/gui/BLASTBufferQueue.cpp +19 −0 Original line number Original line Diff line number Diff line Loading @@ -630,7 +630,10 @@ bool BLASTBufferQueue::maxBuffersAcquired(bool includeExtraAcquire) const { class BBQSurface : public Surface { class BBQSurface : public Surface { private: private: std::mutex mMutex; sp<BLASTBufferQueue> mBbq; sp<BLASTBufferQueue> mBbq; bool mDestroyed = false; public: public: BBQSurface(const sp<IGraphicBufferProducer>& igbp, bool controlledByApp, BBQSurface(const sp<IGraphicBufferProducer>& igbp, bool controlledByApp, const sp<IBinder>& scHandle, const sp<BLASTBufferQueue>& bbq) const sp<IBinder>& scHandle, const sp<BLASTBufferQueue>& bbq) Loading @@ -650,6 +653,10 @@ public: status_t setFrameRate(float frameRate, int8_t compatibility, status_t setFrameRate(float frameRate, int8_t compatibility, int8_t changeFrameRateStrategy) override { int8_t changeFrameRateStrategy) override { std::unique_lock _lock{mMutex}; if (mDestroyed) { return DEAD_OBJECT; } if (!ValidateFrameRate(frameRate, compatibility, changeFrameRateStrategy, if (!ValidateFrameRate(frameRate, compatibility, changeFrameRateStrategy, "BBQSurface::setFrameRate")) { "BBQSurface::setFrameRate")) { return BAD_VALUE; return BAD_VALUE; Loading @@ -658,8 +665,20 @@ public: } } status_t setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInfo) override { status_t setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInfo) override { std::unique_lock _lock{mMutex}; if (mDestroyed) { return DEAD_OBJECT; } return mBbq->setFrameTimelineInfo(frameTimelineInfo); return mBbq->setFrameTimelineInfo(frameTimelineInfo); } } void destroy() override { Surface::destroy(); std::unique_lock _lock{mMutex}; mDestroyed = true; mBbq = nullptr; } }; }; // TODO: Can we coalesce this with frame updates? Need to confirm // TODO: Can we coalesce this with frame updates? Need to confirm Loading
libs/gui/Surface.cpp +10 −0 Original line number Original line Diff line number Diff line Loading @@ -2622,4 +2622,14 @@ status_t Surface::setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInf return composerService()->setFrameTimelineInfo(mGraphicBufferProducer, frameTimelineInfo); return composerService()->setFrameTimelineInfo(mGraphicBufferProducer, frameTimelineInfo); } } sp<IBinder> Surface::getSurfaceControlHandle() const { Mutex::Autolock lock(mMutex); return mSurfaceControlHandle; } void Surface::destroy() { Mutex::Autolock lock(mMutex); mSurfaceControlHandle = nullptr; } }; // namespace android }; // namespace android
libs/gui/include/gui/Surface.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -99,7 +99,7 @@ public: */ */ sp<IGraphicBufferProducer> getIGraphicBufferProducer() const; sp<IGraphicBufferProducer> getIGraphicBufferProducer() const; sp<IBinder> getSurfaceControlHandle() const { return mSurfaceControlHandle; } sp<IBinder> getSurfaceControlHandle() const; /* convenience function to check that the given surface is non NULL as /* convenience function to check that the given surface is non NULL as * well as its IGraphicBufferProducer */ * well as its IGraphicBufferProducer */ Loading Loading @@ -333,6 +333,7 @@ public: virtual int connect( virtual int connect( int api, bool reportBufferRemoval, int api, bool reportBufferRemoval, const sp<SurfaceListener>& sListener); const sp<SurfaceListener>& sListener); virtual void destroy(); // When client connects to Surface with reportBufferRemoval set to true, any buffers removed // When client connects to Surface with reportBufferRemoval set to true, any buffers removed // from this Surface will be collected and returned here. Once this method returns, these // from this Surface will be collected and returned here. Once this method returns, these Loading