From 6250728c9c11c6f5a976ebcac999fa6139a37ee7 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Thu, 27 Oct 2016 21:02:12 +1300 Subject: [PATCH] Bug 1313281 - Part 5: Remove NeedsFenceHandle. r=sotaro --- gfx/layers/client/TextureClient.cpp | 11 ------- gfx/layers/client/TextureClient.h | 7 ----- gfx/layers/composite/TextureHost.h | 2 -- gfx/layers/ipc/CompositorBridgeChild.cpp | 15 ++------- gfx/layers/ipc/CompositorBridgeParent.cpp | 32 +++---------------- gfx/layers/ipc/ImageBridgeChild.cpp | 38 ----------------------- gfx/layers/ipc/ImageBridgeChild.h | 6 ---- gfx/layers/ipc/ImageBridgeParent.cpp | 35 +-------------------- gfx/layers/ipc/ImageBridgeParent.h | 7 ----- gfx/layers/ipc/LayersMessages.ipdlh | 6 ---- 10 files changed, 8 insertions(+), 151 deletions(-) diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 61132670d01f..d1d4305432bc 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -416,7 +416,6 @@ void TextureClient::Destroy(bool aForceSync) mBorrowedDrawTarget = nullptr; mReadLock = nullptr; - CancelWaitFenceHandleOnImageBridge(); RefPtr actor = mActor; mActor = nullptr; @@ -803,15 +802,6 @@ TextureClient::SetAddedToCompositableClient() } } -void -TextureClient::CancelWaitFenceHandleOnImageBridge() -{ - if (!NeedsFenceHandle() || GetFlags() & TextureFlags::RECYCLE) { - return; - } - ImageBridgeChild::GetSingleton()->CancelWaitFenceHandle(this); -} - void CancelTextureClientRecycle(uint64_t aTextureId, LayersIPCChannel* aAllocator) { if (!aAllocator) { @@ -837,7 +827,6 @@ TextureClient::CancelWaitForRecycle() CancelTextureClientRecycle(mSerial, GetAllocator()); return; } - CancelWaitFenceHandleOnImageBridge(); } /* static */ void diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index d2ee5bcd3350..b1765c22e696 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -613,13 +613,6 @@ public: uint64_t GetSerial() const { return mSerial; } - bool NeedsFenceHandle() - { - return false; - } - - void CancelWaitFenceHandleOnImageBridge(); - void CancelWaitForRecycle(); /** diff --git a/gfx/layers/composite/TextureHost.h b/gfx/layers/composite/TextureHost.h index 0c8cc487519b..52b8311d019b 100644 --- a/gfx/layers/composite/TextureHost.h +++ b/gfx/layers/composite/TextureHost.h @@ -588,8 +588,6 @@ public: void SetLastFwdTransactionId(uint64_t aTransactionId); - virtual bool NeedsFenceHandle() { return false; } - void DeserializeReadLock(const ReadLockDescriptor& aDesc, ISurfaceAllocator* aAllocator); diff --git a/gfx/layers/ipc/CompositorBridgeChild.cpp b/gfx/layers/ipc/CompositorBridgeChild.cpp index f9a5d9a35460..4aa35a35cbac 100644 --- a/gfx/layers/ipc/CompositorBridgeChild.cpp +++ b/gfx/layers/ipc/CompositorBridgeChild.cpp @@ -912,21 +912,12 @@ CompositorBridgeChild::HoldUntilCompositableRefReleasedIfNecessary(TextureClient return; } - if (!(aClient->GetFlags() & TextureFlags::RECYCLE) && - !aClient->NeedsFenceHandle()) { + if (!(aClient->GetFlags() & TextureFlags::RECYCLE)) { return; } - if (aClient->GetFlags() & TextureFlags::RECYCLE) { - aClient->SetLastFwdTransactionId(GetFwdTransactionId()); - mTexturesWaitingRecycled.Put(aClient->GetSerial(), aClient); - return; - } - MOZ_ASSERT(!(aClient->GetFlags() & TextureFlags::RECYCLE)); - MOZ_ASSERT(aClient->NeedsFenceHandle()); - // Handle a case of fence delivery via ImageBridge. - // GrallocTextureData alwasys requests fence delivery if ANDROID_VERSION >= 17. - ImageBridgeChild::GetSingleton()->HoldUntilFenceHandleDelivery(aClient, GetFwdTransactionId()); + aClient->SetLastFwdTransactionId(GetFwdTransactionId()); + mTexturesWaitingRecycled.Put(aClient->GetSerial(), aClient); } void diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp index 1403fca1831d..1ce0fef73ea6 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -112,37 +112,13 @@ CompositorBridgeParentBase::NotifyNotUsed(PTextureParent* aTexture, uint64_t aTr return; } - if (!(texture->GetFlags() & TextureFlags::RECYCLE) && - !texture->NeedsFenceHandle()) { + if (!(texture->GetFlags() & TextureFlags::RECYCLE)) { return; } - if (texture->GetFlags() & TextureFlags::RECYCLE) { - uint64_t textureId = TextureHost::GetTextureSerial(aTexture); - mPendingAsyncMessage.push_back( - OpNotifyNotUsed(textureId, aTransactionId)); - return; - } - - // Gralloc requests to deliver fence to client side. - // If client side does not use TextureFlags::RECYCLE flag, - // The fence can not be delivered via LayerTransactionParent. - // TextureClient might wait the fence delivery on main thread. - - MOZ_ASSERT(ImageBridgeParent::GetInstance(GetChildProcessId())); - if (ImageBridgeParent::GetInstance(GetChildProcessId())) { - // Send message back via PImageBridge. - ImageBridgeParent::NotifyNotUsedToNonRecycle( - GetChildProcessId(), - aTexture, - aTransactionId); - } else { - NS_ERROR("ImageBridgeParent should exist"); - } - - if (!IsAboutToSendAsyncMessages()) { - SendPendingAsyncMessages(); - } + uint64_t textureId = TextureHost::GetTextureSerial(aTexture); + mPendingAsyncMessage.push_back( + OpNotifyNotUsed(textureId, aTransactionId)); } void diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index f0a4d1fe96fe..a52465fbc513 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -243,34 +243,6 @@ ImageBridgeChild::NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId) mTexturesWaitingRecycled.Remove(aTextureId); } -void -ImageBridgeChild::HoldUntilFenceHandleDelivery(TextureClient* aClient, uint64_t aTransactionId) -{ - MOZ_ASSERT(NS_IsMainThread()); - // XXX Re-enable fence handling - return; - - NS_RUNTIMEABORT("not reached"); -} - -void -ImageBridgeChild::NotifyNotUsedToNonRecycle(uint64_t aTextureId, uint64_t aTransactionId) -{ - // XXX Re-enable fence handling - return; - - NS_RUNTIMEABORT("not reached"); -} - -void -ImageBridgeChild::CancelWaitFenceHandle(TextureClient* aClient) -{ - // XXX Re-enable fence handling - return; - - NS_RUNTIMEABORT("not reached"); -} - void ImageBridgeChild::CancelWaitForRecycle(uint64_t aTextureId) { @@ -1185,16 +1157,6 @@ ImageBridgeChild::RecvParentAsyncMessages(InfallibleTArray texture = TextureHost::AsTextureHost(aTexture); - if (!texture) { - return; - } - - if (!(texture->GetFlags() & TextureFlags::RECYCLE) && - !texture->NeedsFenceHandle()) { - return; - } - - uint64_t textureId = TextureHost::GetTextureSerial(aTexture); - mPendingAsyncMessage.push_back( - OpNotifyNotUsedToNonRecycle(textureId, aTransactionId)); - -} - -/*static*/ void -ImageBridgeParent::NotifyNotUsedToNonRecycle(base::ProcessId aChildProcessId, - PTextureParent* aTexture, - uint64_t aTransactionId) -{ - ImageBridgeParent* imageBridge = ImageBridgeParent::GetInstance(aChildProcessId); - if (!imageBridge) { - return; - } - imageBridge->NotifyNotUsedToNonRecycle(aTexture, aTransactionId); -} - /*static*/ void ImageBridgeParent::SetAboutToSendAsyncMessages(base::ProcessId aChildProcessId) { @@ -467,8 +435,7 @@ ImageBridgeParent::NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransaction return; } - if (!(texture->GetFlags() & TextureFlags::RECYCLE) && - !texture->NeedsFenceHandle()) { + if (!(texture->GetFlags() & TextureFlags::RECYCLE)) { return; } diff --git a/gfx/layers/ipc/ImageBridgeParent.h b/gfx/layers/ipc/ImageBridgeParent.h index 2507c4a1e3b3..0495a1351482 100644 --- a/gfx/layers/ipc/ImageBridgeParent.h +++ b/gfx/layers/ipc/ImageBridgeParent.h @@ -113,13 +113,6 @@ public: virtual bool IsSameProcess() const override; - void NotifyNotUsedToNonRecycle(PTextureParent* aTexture, - uint64_t aTransactionId); - - static void NotifyNotUsedToNonRecycle(base::ProcessId aChildProcessId, - PTextureParent* aTexture, - uint64_t aTransactionId); - using CompositableParentManager::SetAboutToSendAsyncMessages; static void SetAboutToSendAsyncMessages(base::ProcessId aChildProcessId); diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh index 8da70d6fa2c8..dbbb3649ac8e 100644 --- a/gfx/layers/ipc/LayersMessages.ipdlh +++ b/gfx/layers/ipc/LayersMessages.ipdlh @@ -414,11 +414,6 @@ struct OpNotifyNotUsed { uint64_t fwdTransactionId; }; -struct OpNotifyNotUsedToNonRecycle { - uint64_t TextureId; - uint64_t fwdTransactionId; -}; - union CompositableOperationDetail { OpPaintTextureRegion; @@ -498,7 +493,6 @@ union EditReply { union AsyncParentMessageData { OpNotifyNotUsed; - OpNotifyNotUsedToNonRecycle; }; } // namespace