Loading libs/gui/Choreographer.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -101,8 +101,9 @@ Choreographer* Choreographer::getForThread() { return gChoreographer; } Choreographer::Choreographer(const sp<Looper>& looper) : DisplayEventDispatcher(looper, gui::ISurfaceComposer::VsyncSource::eVsyncSourceApp), Choreographer::Choreographer(const sp<Looper>& looper, const sp<IBinder>& layerHandle) : DisplayEventDispatcher(looper, gui::ISurfaceComposer::VsyncSource::eVsyncSourceApp, {}, layerHandle), mLooper(looper), mThreadId(std::this_thread::get_id()) { std::lock_guard<std::mutex> _l(gChoreographers.lock); Loading libs/gui/DisplayEventDispatcher.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -37,9 +37,10 @@ static constexpr nsecs_t WAITING_FOR_VSYNC_TIMEOUT = ms2ns(300); DisplayEventDispatcher::DisplayEventDispatcher(const sp<Looper>& looper, gui::ISurfaceComposer::VsyncSource vsyncSource, EventRegistrationFlags eventRegistration) EventRegistrationFlags eventRegistration, const sp<IBinder>& layerHandle) : mLooper(looper), mReceiver(vsyncSource, eventRegistration), mReceiver(vsyncSource, eventRegistration, layerHandle), mWaitingForVsync(false), mLastVsyncCount(0), mLastScheduleVsyncTime(0) { Loading libs/gui/DisplayEventReceiver.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #define LOG_TAG "DisplayEventReceiver" #include <string.h> #include <utils/Errors.h> Loading @@ -32,7 +34,8 @@ namespace android { // --------------------------------------------------------------------------- DisplayEventReceiver::DisplayEventReceiver(gui::ISurfaceComposer::VsyncSource vsyncSource, EventRegistrationFlags eventRegistration) { EventRegistrationFlags eventRegistration, const sp<IBinder>& layerHandle) { sp<gui::ISurfaceComposer> sf(ComposerServiceAIDL::getComposerService()); if (sf != nullptr) { mEventConnection = nullptr; Loading @@ -41,8 +44,8 @@ DisplayEventReceiver::DisplayEventReceiver(gui::ISurfaceComposer::VsyncSource vs static_cast< gui::ISurfaceComposer::EventRegistration>( eventRegistration.get()), &mEventConnection); if (mEventConnection != nullptr) { layerHandle, &mEventConnection); if (status.isOk() && mEventConnection != nullptr) { mDataChannel = std::make_unique<gui::BitTube>(); status = mEventConnection->stealReceiveChannel(mDataChannel.get()); if (!status.isOk()) { Loading @@ -51,6 +54,8 @@ DisplayEventReceiver::DisplayEventReceiver(gui::ISurfaceComposer::VsyncSource vs mDataChannel.reset(); mEventConnection.clear(); } } else { ALOGE("DisplayEventConnection creation failed: status=%s", status.toString8().c_str()); } } } Loading libs/gui/SurfaceControl.cpp +21 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <utils/Errors.h> #include <utils/KeyedVector.h> #include <utils/Log.h> #include <utils/Looper.h> #include <utils/threads.h> #include <binder/IPCThreadState.h> Loading @@ -34,8 +35,9 @@ #include <ui/Rect.h> #include <ui/StaticDisplayInfo.h> #include <gui/BufferQueueCore.h> #include <gui/BLASTBufferQueue.h> #include <gui/BufferQueueCore.h> #include <gui/Choreographer.h> #include <gui/ISurfaceComposer.h> #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> Loading Loading @@ -191,6 +193,24 @@ const std::string& SurfaceControl::getName() const { return mName; } std::shared_ptr<Choreographer> SurfaceControl::getChoreographer() { if (mChoreographer) { return mChoreographer; } sp<Looper> looper = Looper::getForThread(); if (!looper.get()) { ALOGE("%s: No looper prepared for thread", __func__); return nullptr; } mChoreographer = std::make_shared<Choreographer>(looper, getHandle()); status_t result = mChoreographer->initialize(); if (result != OK) { ALOGE("Failed to initialize choreographer"); mChoreographer = nullptr; } return mChoreographer; } sp<IGraphicBufferProducer> SurfaceControl::getIGraphicBufferProducer() { getSurface(); Loading libs/gui/aidl/android/gui/ISurfaceComposer.aidl +7 −1 Original line number Diff line number Diff line Loading @@ -68,9 +68,15 @@ interface ISurfaceComposer { /** * Create a display event connection * * layerHandle * Optional binder handle representing a Layer in SF to associate the new * DisplayEventConnection with. This handle can be found inside a surface control after * surface creation, see ISurfaceComposerClient::createSurface. Set to null if no layer * association should be made. */ @nullable IDisplayEventConnection createDisplayEventConnection(VsyncSource vsyncSource, EventRegistration eventRegistration); EventRegistration eventRegistration, @nullable IBinder layerHandle); /** * Create a connection with SurfaceFlinger. Loading Loading
libs/gui/Choreographer.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -101,8 +101,9 @@ Choreographer* Choreographer::getForThread() { return gChoreographer; } Choreographer::Choreographer(const sp<Looper>& looper) : DisplayEventDispatcher(looper, gui::ISurfaceComposer::VsyncSource::eVsyncSourceApp), Choreographer::Choreographer(const sp<Looper>& looper, const sp<IBinder>& layerHandle) : DisplayEventDispatcher(looper, gui::ISurfaceComposer::VsyncSource::eVsyncSourceApp, {}, layerHandle), mLooper(looper), mThreadId(std::this_thread::get_id()) { std::lock_guard<std::mutex> _l(gChoreographers.lock); Loading
libs/gui/DisplayEventDispatcher.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -37,9 +37,10 @@ static constexpr nsecs_t WAITING_FOR_VSYNC_TIMEOUT = ms2ns(300); DisplayEventDispatcher::DisplayEventDispatcher(const sp<Looper>& looper, gui::ISurfaceComposer::VsyncSource vsyncSource, EventRegistrationFlags eventRegistration) EventRegistrationFlags eventRegistration, const sp<IBinder>& layerHandle) : mLooper(looper), mReceiver(vsyncSource, eventRegistration), mReceiver(vsyncSource, eventRegistration, layerHandle), mWaitingForVsync(false), mLastVsyncCount(0), mLastScheduleVsyncTime(0) { Loading
libs/gui/DisplayEventReceiver.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #define LOG_TAG "DisplayEventReceiver" #include <string.h> #include <utils/Errors.h> Loading @@ -32,7 +34,8 @@ namespace android { // --------------------------------------------------------------------------- DisplayEventReceiver::DisplayEventReceiver(gui::ISurfaceComposer::VsyncSource vsyncSource, EventRegistrationFlags eventRegistration) { EventRegistrationFlags eventRegistration, const sp<IBinder>& layerHandle) { sp<gui::ISurfaceComposer> sf(ComposerServiceAIDL::getComposerService()); if (sf != nullptr) { mEventConnection = nullptr; Loading @@ -41,8 +44,8 @@ DisplayEventReceiver::DisplayEventReceiver(gui::ISurfaceComposer::VsyncSource vs static_cast< gui::ISurfaceComposer::EventRegistration>( eventRegistration.get()), &mEventConnection); if (mEventConnection != nullptr) { layerHandle, &mEventConnection); if (status.isOk() && mEventConnection != nullptr) { mDataChannel = std::make_unique<gui::BitTube>(); status = mEventConnection->stealReceiveChannel(mDataChannel.get()); if (!status.isOk()) { Loading @@ -51,6 +54,8 @@ DisplayEventReceiver::DisplayEventReceiver(gui::ISurfaceComposer::VsyncSource vs mDataChannel.reset(); mEventConnection.clear(); } } else { ALOGE("DisplayEventConnection creation failed: status=%s", status.toString8().c_str()); } } } Loading
libs/gui/SurfaceControl.cpp +21 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <utils/Errors.h> #include <utils/KeyedVector.h> #include <utils/Log.h> #include <utils/Looper.h> #include <utils/threads.h> #include <binder/IPCThreadState.h> Loading @@ -34,8 +35,9 @@ #include <ui/Rect.h> #include <ui/StaticDisplayInfo.h> #include <gui/BufferQueueCore.h> #include <gui/BLASTBufferQueue.h> #include <gui/BufferQueueCore.h> #include <gui/Choreographer.h> #include <gui/ISurfaceComposer.h> #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> Loading Loading @@ -191,6 +193,24 @@ const std::string& SurfaceControl::getName() const { return mName; } std::shared_ptr<Choreographer> SurfaceControl::getChoreographer() { if (mChoreographer) { return mChoreographer; } sp<Looper> looper = Looper::getForThread(); if (!looper.get()) { ALOGE("%s: No looper prepared for thread", __func__); return nullptr; } mChoreographer = std::make_shared<Choreographer>(looper, getHandle()); status_t result = mChoreographer->initialize(); if (result != OK) { ALOGE("Failed to initialize choreographer"); mChoreographer = nullptr; } return mChoreographer; } sp<IGraphicBufferProducer> SurfaceControl::getIGraphicBufferProducer() { getSurface(); Loading
libs/gui/aidl/android/gui/ISurfaceComposer.aidl +7 −1 Original line number Diff line number Diff line Loading @@ -68,9 +68,15 @@ interface ISurfaceComposer { /** * Create a display event connection * * layerHandle * Optional binder handle representing a Layer in SF to associate the new * DisplayEventConnection with. This handle can be found inside a surface control after * surface creation, see ISurfaceComposerClient::createSurface. Set to null if no layer * association should be made. */ @nullable IDisplayEventConnection createDisplayEventConnection(VsyncSource vsyncSource, EventRegistration eventRegistration); EventRegistration eventRegistration, @nullable IBinder layerHandle); /** * Create a connection with SurfaceFlinger. Loading