Loading libs/gui/SurfaceComposerClient.cpp +2 −17 Original line number Diff line number Diff line Loading @@ -526,21 +526,6 @@ void SurfaceComposerClient::Transaction::clear() { mDesiredPresentTime = -1; } void SurfaceComposerClient::doDropReferenceTransaction(const sp<IBinder>& handle) { sp<ISurfaceComposer> sf(ComposerService::getComposerService()); Vector<ComposerState> composerStates; Vector<DisplayState> displayStates; ComposerState s; s.state.surface = handle; s.state.what |= layer_state_t::eReparent; s.state.parentHandleForChild = nullptr; composerStates.add(s); sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance()); sf->setTransactionState(composerStates, displayStates, 0, applyToken, {}, -1, {}, false, {}); } void SurfaceComposerClient::doUncacheBufferTransaction(uint64_t cacheId) { sp<ISurfaceComposer> sf(ComposerService::getComposerService()); Loading Loading @@ -1558,7 +1543,7 @@ sp<SurfaceControl> SurfaceComposerClient::createWithSurfaceParent(const String8& } ALOGE_IF(err, "SurfaceComposerClient::createWithSurfaceParent error %s", strerror(-err)); if (err == NO_ERROR) { return new SurfaceControl(this, handle, gbp, true /* owned */, transformHint); return new SurfaceControl(this, handle, gbp, transformHint); } } return nullptr; Loading Loading @@ -1589,7 +1574,7 @@ status_t SurfaceComposerClient::createSurfaceChecked(const String8& name, uint32 } ALOGE_IF(err, "SurfaceComposerClient::createSurface error %s", strerror(-err)); if (err == NO_ERROR) { *outSurface = new SurfaceControl(this, handle, gbp, true /* owned */, transformHint); *outSurface = new SurfaceControl(this, handle, gbp, transformHint); } } return err; Loading libs/gui/SurfaceControl.cpp +2 −15 Original line number Diff line number Diff line Loading @@ -46,33 +46,21 @@ namespace android { // ============================================================================ SurfaceControl::SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle, const sp<IGraphicBufferProducer>& gbp, bool owned, const sp<IGraphicBufferProducer>& gbp, uint32_t transform) : mClient(client), mHandle(handle), mGraphicBufferProducer(gbp), mOwned(owned), mTransformHint(transform) {} SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) { mClient = other->mClient; mHandle = other->mHandle; mGraphicBufferProducer = other->mGraphicBufferProducer; mOwned = false; mTransformHint = other->mTransformHint; } SurfaceControl::~SurfaceControl() { // Avoid reparenting the server-side surface to null if we are not the owner of it, // meaning that we retrieved it from another process. if (mHandle != nullptr && mOwned) { SurfaceComposerClient::doDropReferenceTransaction(mHandle); } release(); } void SurfaceControl::release() { // Trigger an IPC now, to make sure things // happen without delay, since these resources are quite heavy. Loading Loading @@ -157,7 +145,6 @@ sp<Surface> SurfaceControl::createSurface() const sp<IBinder> SurfaceControl::getHandle() const { Mutex::Autolock lock(mLock); return mHandle; } Loading Loading @@ -206,7 +193,7 @@ sp<SurfaceControl> SurfaceControl::readFromParcel(const Parcel* parcel) { return new SurfaceControl(new SurfaceComposerClient( interface_cast<ISurfaceComposerClient>(client)), handle.get(), interface_cast<IGraphicBufferProducer>(gbp), false /* owned */, transformHint); transformHint); } // ---------------------------------------------------------------------------- Loading libs/gui/include/gui/SurfaceComposerClient.h +0 −6 Original line number Diff line number Diff line Loading @@ -183,12 +183,6 @@ public: */ static bool getProtectedContentSupport(); /** * Called from SurfaceControl d'tor to 'destroy' the surface (or rather, reparent it * to null), but without needing an sp<SurfaceControl> to avoid infinite ressurection. */ static void doDropReferenceTransaction(const sp<IBinder>& handle); /** * Uncaches a buffer in ISurfaceComposer. It must be uncached via a transaction so that it is * in order with other transactions that use buffers. Loading libs/gui/include/gui/SurfaceControl.h +1 −6 Original line number Diff line number Diff line Loading @@ -58,10 +58,6 @@ public: static bool isSameSurface( const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs); // Release the handles assosciated with the SurfaceControl, without reparenting // them off-screen. At the moment if this isn't executed before ~SurfaceControl // is called then the destructor will reparent the layer off-screen for you. void release(); // Reparent off-screen and release. This is invoked by the destructor. void destroy(); Loading Loading @@ -89,7 +85,7 @@ public: explicit SurfaceControl(const sp<SurfaceControl>& other); SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle, const sp<IGraphicBufferProducer>& gbp, bool owned, uint32_t transformHint = 0); const sp<IGraphicBufferProducer>& gbp, uint32_t transformHint = 0); private: // can't be copied Loading @@ -109,7 +105,6 @@ private: sp<IGraphicBufferProducer> mGraphicBufferProducer; mutable Mutex mLock; mutable sp<Surface> mSurfaceData; bool mOwned; uint32_t mTransformHint; }; Loading services/surfaceflinger/tests/LayerTypeAndRenderTypeTransaction_test.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,8 @@ TEST_P(LayerTypeAndRenderTypeTransactionTest, SetRelativeZBug64572777) { .setRelativeLayer(layerG, layerR->getHandle(), 1) .apply(); layerG.clear(); Transaction().reparent(layerG, nullptr).apply(); // layerG should have been removed getScreenCapture()->expectColor(Rect(0, 0, 32, 32), Color::RED); } Loading Loading
libs/gui/SurfaceComposerClient.cpp +2 −17 Original line number Diff line number Diff line Loading @@ -526,21 +526,6 @@ void SurfaceComposerClient::Transaction::clear() { mDesiredPresentTime = -1; } void SurfaceComposerClient::doDropReferenceTransaction(const sp<IBinder>& handle) { sp<ISurfaceComposer> sf(ComposerService::getComposerService()); Vector<ComposerState> composerStates; Vector<DisplayState> displayStates; ComposerState s; s.state.surface = handle; s.state.what |= layer_state_t::eReparent; s.state.parentHandleForChild = nullptr; composerStates.add(s); sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance()); sf->setTransactionState(composerStates, displayStates, 0, applyToken, {}, -1, {}, false, {}); } void SurfaceComposerClient::doUncacheBufferTransaction(uint64_t cacheId) { sp<ISurfaceComposer> sf(ComposerService::getComposerService()); Loading Loading @@ -1558,7 +1543,7 @@ sp<SurfaceControl> SurfaceComposerClient::createWithSurfaceParent(const String8& } ALOGE_IF(err, "SurfaceComposerClient::createWithSurfaceParent error %s", strerror(-err)); if (err == NO_ERROR) { return new SurfaceControl(this, handle, gbp, true /* owned */, transformHint); return new SurfaceControl(this, handle, gbp, transformHint); } } return nullptr; Loading Loading @@ -1589,7 +1574,7 @@ status_t SurfaceComposerClient::createSurfaceChecked(const String8& name, uint32 } ALOGE_IF(err, "SurfaceComposerClient::createSurface error %s", strerror(-err)); if (err == NO_ERROR) { *outSurface = new SurfaceControl(this, handle, gbp, true /* owned */, transformHint); *outSurface = new SurfaceControl(this, handle, gbp, transformHint); } } return err; Loading
libs/gui/SurfaceControl.cpp +2 −15 Original line number Diff line number Diff line Loading @@ -46,33 +46,21 @@ namespace android { // ============================================================================ SurfaceControl::SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle, const sp<IGraphicBufferProducer>& gbp, bool owned, const sp<IGraphicBufferProducer>& gbp, uint32_t transform) : mClient(client), mHandle(handle), mGraphicBufferProducer(gbp), mOwned(owned), mTransformHint(transform) {} SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) { mClient = other->mClient; mHandle = other->mHandle; mGraphicBufferProducer = other->mGraphicBufferProducer; mOwned = false; mTransformHint = other->mTransformHint; } SurfaceControl::~SurfaceControl() { // Avoid reparenting the server-side surface to null if we are not the owner of it, // meaning that we retrieved it from another process. if (mHandle != nullptr && mOwned) { SurfaceComposerClient::doDropReferenceTransaction(mHandle); } release(); } void SurfaceControl::release() { // Trigger an IPC now, to make sure things // happen without delay, since these resources are quite heavy. Loading Loading @@ -157,7 +145,6 @@ sp<Surface> SurfaceControl::createSurface() const sp<IBinder> SurfaceControl::getHandle() const { Mutex::Autolock lock(mLock); return mHandle; } Loading Loading @@ -206,7 +193,7 @@ sp<SurfaceControl> SurfaceControl::readFromParcel(const Parcel* parcel) { return new SurfaceControl(new SurfaceComposerClient( interface_cast<ISurfaceComposerClient>(client)), handle.get(), interface_cast<IGraphicBufferProducer>(gbp), false /* owned */, transformHint); transformHint); } // ---------------------------------------------------------------------------- Loading
libs/gui/include/gui/SurfaceComposerClient.h +0 −6 Original line number Diff line number Diff line Loading @@ -183,12 +183,6 @@ public: */ static bool getProtectedContentSupport(); /** * Called from SurfaceControl d'tor to 'destroy' the surface (or rather, reparent it * to null), but without needing an sp<SurfaceControl> to avoid infinite ressurection. */ static void doDropReferenceTransaction(const sp<IBinder>& handle); /** * Uncaches a buffer in ISurfaceComposer. It must be uncached via a transaction so that it is * in order with other transactions that use buffers. Loading
libs/gui/include/gui/SurfaceControl.h +1 −6 Original line number Diff line number Diff line Loading @@ -58,10 +58,6 @@ public: static bool isSameSurface( const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs); // Release the handles assosciated with the SurfaceControl, without reparenting // them off-screen. At the moment if this isn't executed before ~SurfaceControl // is called then the destructor will reparent the layer off-screen for you. void release(); // Reparent off-screen and release. This is invoked by the destructor. void destroy(); Loading Loading @@ -89,7 +85,7 @@ public: explicit SurfaceControl(const sp<SurfaceControl>& other); SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle, const sp<IGraphicBufferProducer>& gbp, bool owned, uint32_t transformHint = 0); const sp<IGraphicBufferProducer>& gbp, uint32_t transformHint = 0); private: // can't be copied Loading @@ -109,7 +105,6 @@ private: sp<IGraphicBufferProducer> mGraphicBufferProducer; mutable Mutex mLock; mutable sp<Surface> mSurfaceData; bool mOwned; uint32_t mTransformHint; }; Loading
services/surfaceflinger/tests/LayerTypeAndRenderTypeTransaction_test.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,8 @@ TEST_P(LayerTypeAndRenderTypeTransactionTest, SetRelativeZBug64572777) { .setRelativeLayer(layerG, layerR->getHandle(), 1) .apply(); layerG.clear(); Transaction().reparent(layerG, nullptr).apply(); // layerG should have been removed getScreenCapture()->expectColor(Rect(0, 0, 32, 32), Color::RED); } Loading