From 16ce9c4a307483eab0ed2995e48c3f6de5493c12 Mon Sep 17 00:00:00 2001 From: sotaro Date: Sat, 1 Jun 2019 09:37:56 +0000 Subject: [PATCH] Bug 1555544 - Change function name from CancelWaitForRecycle() to CancelWaitForNotifyNotUsed() r=jgilbert CancelWaitForRecycle() does not cancel wait for recycling. It cancels wait for end of usage on host side. Differential Revision: https://phabricator.services.mozilla.com/D33265 --HG-- extra : moz-landing-system : lando --- gfx/gl/SharedSurface.cpp | 2 +- gfx/layers/client/CanvasClient.cpp | 2 +- gfx/layers/client/TextureClient.cpp | 16 ++++++++-------- gfx/layers/client/TextureClient.h | 2 +- gfx/layers/ipc/CompositorBridgeChild.cpp | 14 +++++++------- gfx/layers/ipc/CompositorBridgeChild.h | 5 +++-- gfx/layers/ipc/ISurfaceAllocator.h | 2 +- gfx/layers/ipc/ImageBridgeChild.cpp | 14 +++++++------- gfx/layers/ipc/ImageBridgeChild.h | 5 +++-- gfx/layers/ipc/TextureForwarder.h | 2 +- gfx/layers/ipc/VideoBridgeChild.h | 2 +- 11 files changed, 34 insertions(+), 32 deletions(-) diff --git a/gfx/gl/SharedSurface.cpp b/gfx/gl/SharedSurface.cpp index 6ddd4d0a2301..160139efd39e 100644 --- a/gfx/gl/SharedSurface.cpp +++ b/gfx/gl/SharedSurface.cpp @@ -276,7 +276,7 @@ SurfaceFactory::~SurfaceFactory() { while (!mRecycleTotalPool.empty()) { RefPtr tex = *mRecycleTotalPool.begin(); StopRecycling(tex); - tex->CancelWaitForRecycle(); + tex->CancelWaitForNotifyNotUsed(); } MOZ_RELEASE_ASSERT(mRecycleTotalPool.empty(), diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index 4bbb3b6886bd..a9b2b6a4f374 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -499,7 +499,7 @@ void CanvasClientSharedSurface::OnDetach() { ClearSurfaces(); } void CanvasClientSharedSurface::ClearSurfaces() { if (mFront) { - mFront->CancelWaitForRecycle(); + mFront->CancelWaitForNotifyNotUsed(); } mFront = nullptr; mNewFront = nullptr; diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index db4b98fe5470..f35b3bd365f7 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -793,8 +793,8 @@ void TextureClient::SetAddedToCompositableClient() { } } -static void CancelTextureClientRecycle(uint64_t aTextureId, - LayersIPCChannel* aAllocator) { +static void CancelTextureClientNotifyNotUsed(uint64_t aTextureId, + LayersIPCChannel* aAllocator) { if (!aAllocator) { return; } @@ -804,17 +804,17 @@ static void CancelTextureClientRecycle(uint64_t aTextureId, return; } if (MessageLoop::current() == msgLoop) { - aAllocator->CancelWaitForRecycle(aTextureId); + aAllocator->CancelWaitForNotifyNotUsed(aTextureId); } else { - msgLoop->PostTask(NewRunnableFunction("CancelTextureClientRecycleRunnable", - CancelTextureClientRecycle, - aTextureId, aAllocator)); + msgLoop->PostTask(NewRunnableFunction( + "CancelTextureClientNotifyNotUsedRunnable", + CancelTextureClientNotifyNotUsed, aTextureId, aAllocator)); } } -void TextureClient::CancelWaitForRecycle() { +void TextureClient::CancelWaitForNotifyNotUsed() { if (GetFlags() & TextureFlags::RECYCLE) { - CancelTextureClientRecycle(mSerial, GetAllocator()); + CancelTextureClientNotifyNotUsed(mSerial, GetAllocator()); return; } } diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index 599c8a3d6b05..66e87f0b14ab 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -596,7 +596,7 @@ class TextureClient : public AtomicRefCountedWithFinalize { uint64_t GetSerial() const { return mSerial; } void GPUVideoDesc(SurfaceDescriptorGPUVideo* aOutDesc); - void CancelWaitForRecycle(); + void CancelWaitForNotifyNotUsed(); /** * Set last transaction id of CompositableForwarder. diff --git a/gfx/layers/ipc/CompositorBridgeChild.cpp b/gfx/layers/ipc/CompositorBridgeChild.cpp index 1c3ffe21c8f0..db497034fd68 100644 --- a/gfx/layers/ipc/CompositorBridgeChild.cpp +++ b/gfx/layers/ipc/CompositorBridgeChild.cpp @@ -125,7 +125,7 @@ void CompositorBridgeChild::AfterDestroy() { void CompositorBridgeChild::Destroy() { // This must not be called from the destructor! - mTexturesWaitingRecycled.clear(); + mTexturesWaitingNotifyNotUsed.clear(); // Destroying the layer manager may cause all sorts of things to happen, so // let's make sure there is still a reference to keep this alive whatever @@ -834,23 +834,23 @@ void CompositorBridgeChild::HoldUntilCompositableRefReleasedIfNecessary( } aClient->SetLastFwdTransactionId(GetFwdTransactionId()); - mTexturesWaitingRecycled.emplace(aClient->GetSerial(), aClient); + mTexturesWaitingNotifyNotUsed.emplace(aClient->GetSerial(), aClient); } void CompositorBridgeChild::NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId) { - auto it = mTexturesWaitingRecycled.find(aTextureId); - if (it != mTexturesWaitingRecycled.end()) { + auto it = mTexturesWaitingNotifyNotUsed.find(aTextureId); + if (it != mTexturesWaitingNotifyNotUsed.end()) { if (aFwdTransactionId < it->second->GetLastFwdTransactionId()) { // Released on host side, but client already requested newer use texture. return; } - mTexturesWaitingRecycled.erase(it); + mTexturesWaitingNotifyNotUsed.erase(it); } } -void CompositorBridgeChild::CancelWaitForRecycle(uint64_t aTextureId) { - mTexturesWaitingRecycled.erase(aTextureId); +void CompositorBridgeChild::CancelWaitForNotifyNotUsed(uint64_t aTextureId) { + mTexturesWaitingNotifyNotUsed.erase(aTextureId); } TextureClientPool* CompositorBridgeChild::GetTexturePool( diff --git a/gfx/layers/ipc/CompositorBridgeChild.h b/gfx/layers/ipc/CompositorBridgeChild.h index ff1ebe9750cb..4493b87f00ab 100644 --- a/gfx/layers/ipc/CompositorBridgeChild.h +++ b/gfx/layers/ipc/CompositorBridgeChild.h @@ -176,7 +176,7 @@ class CompositorBridgeChild final : public PCompositorBridgeChild, */ void NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId); - void CancelWaitForRecycle(uint64_t aTextureId) override; + void CancelWaitForNotifyNotUsed(uint64_t aTextureId) override; TextureClientPool* GetTexturePool(KnowsCompositor* aAllocator, gfx::SurfaceFormat aFormat, @@ -350,7 +350,8 @@ class CompositorBridgeChild final : public PCompositorBridgeChild, * Hold TextureClients refs until end of their usages on host side. * It defer calling of TextureClient recycle callback. */ - std::unordered_map> mTexturesWaitingRecycled; + std::unordered_map> + mTexturesWaitingNotifyNotUsed; MessageLoop* mMessageLoop; diff --git a/gfx/layers/ipc/ISurfaceAllocator.h b/gfx/layers/ipc/ISurfaceAllocator.h index 27411f3556df..e18122dc753a 100644 --- a/gfx/layers/ipc/ISurfaceAllocator.h +++ b/gfx/layers/ipc/ISurfaceAllocator.h @@ -122,7 +122,7 @@ class ClientIPCAllocator : public ISurfaceAllocator { virtual MessageLoop* GetMessageLoop() const = 0; - virtual void CancelWaitForRecycle(uint64_t aTextureId) = 0; + virtual void CancelWaitForNotifyNotUsed(uint64_t aTextureId) = 0; }; /// Methods that are specific to the host/parent side. diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index 1f7d7112e317..450488744ccc 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -141,24 +141,24 @@ void ImageBridgeChild::HoldUntilCompositableRefReleasedIfNecessary( return; } aClient->SetLastFwdTransactionId(GetFwdTransactionId()); - mTexturesWaitingRecycled.emplace(aClient->GetSerial(), aClient); + mTexturesWaitingNotifyNotUsed.emplace(aClient->GetSerial(), aClient); } void ImageBridgeChild::NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId) { - auto it = mTexturesWaitingRecycled.find(aTextureId); - if (it != mTexturesWaitingRecycled.end()) { + auto it = mTexturesWaitingNotifyNotUsed.find(aTextureId); + if (it != mTexturesWaitingNotifyNotUsed.end()) { if (aFwdTransactionId < it->second->GetLastFwdTransactionId()) { // Released on host side, but client already requested newer use texture. return; } - mTexturesWaitingRecycled.erase(it); + mTexturesWaitingNotifyNotUsed.erase(it); } } -void ImageBridgeChild::CancelWaitForRecycle(uint64_t aTextureId) { +void ImageBridgeChild::CancelWaitForNotifyNotUsed(uint64_t aTextureId) { MOZ_ASSERT(InImageBridgeChildThread()); - mTexturesWaitingRecycled.erase(aTextureId); + mTexturesWaitingNotifyNotUsed.erase(aTextureId); } // Singleton @@ -247,7 +247,7 @@ ImageBridgeChild::ImageBridgeChild(uint32_t aNamespace) ImageBridgeChild::~ImageBridgeChild() { delete mTxn; } void ImageBridgeChild::MarkShutDown() { - mTexturesWaitingRecycled.clear(); + mTexturesWaitingNotifyNotUsed.clear(); mCanSend = false; } diff --git a/gfx/layers/ipc/ImageBridgeChild.h b/gfx/layers/ipc/ImageBridgeChild.h index 60b9fa004bd7..64719e6bcfb8 100644 --- a/gfx/layers/ipc/ImageBridgeChild.h +++ b/gfx/layers/ipc/ImageBridgeChild.h @@ -289,7 +289,7 @@ class ImageBridgeChild final : public PImageBridgeChild, */ void NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId); - void CancelWaitForRecycle(uint64_t aTextureId) override; + void CancelWaitForNotifyNotUsed(uint64_t aTextureId) override; bool DestroyInTransaction(PTextureChild* aTexture) override; bool DestroyInTransaction(const CompositableHandle& aHandle); @@ -394,7 +394,8 @@ class ImageBridgeChild final : public PImageBridgeChild, * Hold TextureClients refs until end of their usages on host side. * It defer calling of TextureClient recycle callback. */ - std::unordered_map> mTexturesWaitingRecycled; + std::unordered_map> + mTexturesWaitingNotifyNotUsed; /** * Mapping from async compositable IDs to image containers. diff --git a/gfx/layers/ipc/TextureForwarder.h b/gfx/layers/ipc/TextureForwarder.h index 078c15e3db32..5b4e7332248b 100644 --- a/gfx/layers/ipc/TextureForwarder.h +++ b/gfx/layers/ipc/TextureForwarder.h @@ -52,7 +52,7 @@ class LayersIPCChannel : public LayersIPCActor, return nullptr; } - virtual void CancelWaitForRecycle(uint64_t aTextureId) = 0; + virtual void CancelWaitForNotifyNotUsed(uint64_t aTextureId) = 0; virtual wr::MaybeExternalImageId GetNextExternalImageId() { return Nothing(); diff --git a/gfx/layers/ipc/VideoBridgeChild.h b/gfx/layers/ipc/VideoBridgeChild.h index 946520464f70..49f8000e80d5 100644 --- a/gfx/layers/ipc/VideoBridgeChild.h +++ b/gfx/layers/ipc/VideoBridgeChild.h @@ -55,7 +55,7 @@ class VideoBridgeChild final : public PVideoBridgeChild, // ClientIPCAllocator base::ProcessId GetParentPid() const override { return OtherPid(); } MessageLoop* GetMessageLoop() const override { return mMessageLoop; } - void CancelWaitForRecycle(uint64_t aTextureId) override { + void CancelWaitForNotifyNotUsed(uint64_t aTextureId) override { MOZ_ASSERT(false, "NO RECYCLING HERE"); }