Bug 1567816 - Remove WebRenderTextureHostWrapper r=nical
authorsotaro <sotaro.ikeda.g@gmail.com>
Mon, 22 Jul 2019 08:03:59 +0000
changeset 483702 690ac34c43cf7aaf95b315b85403ac69aa3df81a
parent 483701 e67f139cf831c028f181c4864f52a63bbab85fab
child 483703 591bc438db1f7a6801d6dacf6240dabfd11a381a
push id36330
push userrmaries@mozilla.com
push dateMon, 22 Jul 2019 21:40:48 +0000
treeherdermozilla-central@17267dd9b228 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1567816
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1567816 - Remove WebRenderTextureHostWrapper r=nical Differential Revision: https://phabricator.services.mozilla.com/D38837
gfx/layers/composite/GPUVideoTextureHost.cpp
gfx/layers/composite/GPUVideoTextureHost.h
gfx/layers/composite/TextureHost.h
gfx/layers/d3d11/TextureD3D11.h
gfx/layers/moz.build
gfx/layers/opengl/TextureHostOGL.h
gfx/layers/wr/AsyncImagePipelineManager.cpp
gfx/layers/wr/AsyncImagePipelineManager.h
gfx/layers/wr/WebRenderTextureHost.cpp
gfx/layers/wr/WebRenderTextureHost.h
gfx/layers/wr/WebRenderTextureHostWrapper.cpp
gfx/layers/wr/WebRenderTextureHostWrapper.h
gfx/webrender_bindings/RenderTextureHost.h
gfx/webrender_bindings/RenderTextureHostWrapper.cpp
gfx/webrender_bindings/RenderTextureHostWrapper.h
gfx/webrender_bindings/RenderThread.cpp
gfx/webrender_bindings/RenderThread.h
gfx/webrender_bindings/moz.build
--- a/gfx/layers/composite/GPUVideoTextureHost.cpp
+++ b/gfx/layers/composite/GPUVideoTextureHost.cpp
@@ -146,18 +146,10 @@ void GPUVideoTextureHost::PushDisplayIte
   if (!EnsureWrappedTextureHost()) {
     return;
   }
 
   EnsureWrappedTextureHost()->PushDisplayItems(aBuilder, aBounds, aClip,
                                                aFilter, aImageKeys);
 }
 
-bool GPUVideoTextureHost::SupportsWrNativeTexture() {
-  MOZ_ASSERT(EnsureWrappedTextureHost());
-  if (!EnsureWrappedTextureHost()) {
-    return false;
-  }
-  return EnsureWrappedTextureHost()->SupportsWrNativeTexture();
-}
-
 }  // namespace layers
 }  // namespace mozilla
--- a/gfx/layers/composite/GPUVideoTextureHost.h
+++ b/gfx/layers/composite/GPUVideoTextureHost.h
@@ -57,18 +57,16 @@ class GPUVideoTextureHost : public Textu
                            const Range<wr::ImageKey>& aImageKeys,
                            const wr::ExternalImageId& aExtID) override;
 
   void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
                         const wr::LayoutRect& aBounds,
                         const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
                         const Range<wr::ImageKey>& aImageKeys) override;
 
-  bool SupportsWrNativeTexture() override;
-
  protected:
   GPUVideoTextureHost(TextureFlags aFlags,
                       const SurfaceDescriptorGPUVideo& aDescriptor);
 
   TextureHost* EnsureWrappedTextureHost();
 
   RefPtr<TextureHost> mWrappedTextureHost;
   SurfaceDescriptorGPUVideo mDescriptor;
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -670,18 +670,16 @@ class TextureHost : public AtomicRefCoun
 
   /**
    * Some API's can use the cross-process IOSurface directly, such as OpenVR
    */
   virtual MacIOSurface* GetMacIOSurface() { return nullptr; }
 
   virtual bool IsDirectMap() { return false; }
 
-  virtual bool SupportsWrNativeTexture() { return false; }
-
   virtual bool NeedsYFlip() const;
 
  protected:
   virtual void ReadUnlock();
 
   void RecycleTexture(TextureFlags aFlags);
 
   virtual void MaybeNotifyUnlocked() {}
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ b/gfx/layers/d3d11/TextureD3D11.h
@@ -349,18 +349,16 @@ class DXGITextureHostD3D11 : public Text
                            const Range<wr::ImageKey>& aImageKeys,
                            const wr::ExternalImageId& aExtID) override;
 
   void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
                         const wr::LayoutRect& aBounds,
                         const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
                         const Range<wr::ImageKey>& aImageKeys) override;
 
-  bool SupportsWrNativeTexture() override { return true; }
-
  protected:
   bool LockInternal();
   void UnlockInternal();
 
   bool EnsureTextureSource();
 
   RefPtr<ID3D11Device> GetDevice();
 
@@ -418,18 +416,16 @@ class DXGIYCbCrTextureHostD3D11 : public
                            const Range<wr::ImageKey>& aImageKeys,
                            const wr::ExternalImageId& aExtID) override;
 
   void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
                         const wr::LayoutRect& aBounds,
                         const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
                         const Range<wr::ImageKey>& aImageKeys) override;
 
-  bool SupportsWrNativeTexture() override { return true; }
-
  private:
   bool EnsureTextureSource();
 
  protected:
   RefPtr<ID3D11Device> GetDevice();
 
   bool EnsureTexture();
 
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -265,17 +265,16 @@ EXPORTS.mozilla.layers += [
     'wr/WebRenderDrawEventRecorder.h',
     'wr/WebRenderImageHost.h',
     'wr/WebRenderLayerManager.h',
     'wr/WebRenderLayersLogging.h',
     'wr/WebRenderMessageUtils.h',
     'wr/WebRenderScrollData.h',
     'wr/WebRenderScrollDataWrapper.h',
     'wr/WebRenderTextureHost.h',
-    'wr/WebRenderTextureHostWrapper.h',
     'wr/WebRenderUserData.h',
     'ZoomConstraints.h',
 ]
 
 if CONFIG['MOZ_X11']:
     EXPORTS.mozilla.layers += [
         'basic/TextureClientX11.h',
         'basic/X11TextureSourceBasic.h',
@@ -516,17 +515,16 @@ UNIFIED_SOURCES += [
     'wr/WebRenderCanvasRenderer.cpp',
     'wr/WebRenderCommandBuilder.cpp',
     'wr/WebRenderCompositionRecorder.cpp',
     'wr/WebRenderDrawEventRecorder.cpp',
     'wr/WebRenderImageHost.cpp',
     'wr/WebRenderLayerManager.cpp',
     'wr/WebRenderLayersLogging.cpp',
     'wr/WebRenderScrollData.cpp',
-    'wr/WebRenderTextureHostWrapper.cpp',
     'wr/WebRenderUserData.cpp',
     # XXX here are some unified build error.
     #'wr/WebRenderTextureHost.cpp'
 ]
 
 SOURCES += [
     'basic/BasicImageLayer.cpp',
     'ImageContainer.cpp',
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -435,18 +435,16 @@ class SurfaceTextureHost : public Textur
                            const Range<wr::ImageKey>& aImageKeys,
                            const wr::ExternalImageId& aExtID) override;
 
   void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
                         const wr::LayoutRect& aBounds,
                         const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
                         const Range<wr::ImageKey>& aImageKeys) override;
 
-  bool SupportsWrNativeTexture() override { return true; }
-
  protected:
   bool EnsureAttached();
 
   mozilla::java::GeckoSurfaceTexture::GlobalRef mSurfTex;
   const gfx::IntSize mSize;
   const gfx::SurfaceFormat mFormat;
   bool mContinuousUpdate;
   const bool mIgnoreTransform;
--- a/gfx/layers/wr/AsyncImagePipelineManager.cpp
+++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ -215,68 +215,48 @@ Maybe<TextureHost::ResourceUpdateOp> Asy
   MOZ_ASSERT(aPipeline);
 
   TextureHost* texture = aPipeline->mImageHost->GetAsTextureHostForComposite();
   TextureHost* previousTexture = aPipeline->mCurrentTexture.get();
 
   if (texture == previousTexture) {
     // The texture has not changed, just reuse previous ImageKeys.
     aKeys = aPipeline->mKeys;
-    if (aPipeline->mWrTextureWrapper) {
-      HoldExternalImage(aPipelineId, aEpoch, aPipeline->mWrTextureWrapper);
-    }
     return Nothing();
   }
 
   if (!texture) {
     // We don't have a new texture, there isn't much we can do.
     aKeys = aPipeline->mKeys;
-    if (aPipeline->mWrTextureWrapper) {
-      HoldExternalImage(aPipelineId, aEpoch, aPipeline->mWrTextureWrapper);
-    }
     return Nothing();
   }
 
   aPipeline->mCurrentTexture = texture;
 
   WebRenderTextureHost* wrTexture = texture->AsWebRenderTextureHost();
   MOZ_ASSERT(wrTexture);
   if (!wrTexture) {
     gfxCriticalNote << "WebRenderTextureHost is not used";
   }
 
   bool useExternalImage = !gfxEnv::EnableWebRenderRecording() && wrTexture;
   aPipeline->mUseExternalImage = useExternalImage;
 
-  // Use WebRenderTextureHostWrapper only for video.
-  // And WebRenderTextureHostWrapper could be used only with
-  // WebRenderTextureHost that supports NativeTexture
-  bool useWrTextureWrapper =
-      useExternalImage && wrTexture && wrTexture->SupportsWrNativeTexture();
-  // XXX Re-enable fast path for async native texture updates(Bug 1559294)
-  useWrTextureWrapper = false;
-
   // The non-external image code path falls back to converting the texture into
   // an rgb image.
   auto numKeys = useExternalImage ? texture->NumSubTextures() : 1;
 
   // If we already had a texture and the format hasn't changed, better to reuse
   // the image keys than create new ones.
   bool canUpdate = !!previousTexture &&
                    previousTexture->GetSize() == texture->GetSize() &&
                    previousTexture->GetFormat() == texture->GetFormat() &&
                    previousTexture->NeedsYFlip() == texture->NeedsYFlip() &&
                    aPipeline->mKeys.Length() == numKeys;
 
-  // Check if WebRenderTextureHostWrapper could be reused.
-  if (aPipeline->mWrTextureWrapper && (!useWrTextureWrapper || !canUpdate)) {
-    aPipeline->mWrTextureWrapper = nullptr;
-    canUpdate = false;
-  }
-
   if (!canUpdate) {
     for (auto key : aPipeline->mKeys) {
       // Destroy ImageKeys on transaction of scene builder thread, since
       // DisplayList is updated on SceneBuilder thread. It prevents too early
       // ImageKey deletion.
       aSceneBuilderTxn.DeleteImage(key);
     }
     aPipeline->mKeys.Clear();
@@ -290,44 +270,19 @@ Maybe<TextureHost::ResourceUpdateOp> Asy
   auto op = canUpdate ? TextureHost::UPDATE_IMAGE : TextureHost::ADD_IMAGE;
 
   if (!useExternalImage) {
     return UpdateWithoutExternalImage(texture, aKeys[0], op, aMaybeFastTxn);
   }
 
   wrTexture->MaybeNofityForUse(aMaybeFastTxn);
 
-  if (useWrTextureWrapper && aPipeline->mWrTextureWrapper) {
-    MOZ_ASSERT(canUpdate);
-    // Reuse WebRenderTextureHostWrapper. With it, rendered frame could be
-    // updated without batch re-creation.
-    aPipeline->mWrTextureWrapper->UpdateWebRenderTextureHost(aMaybeFastTxn,
-                                                             wrTexture);
-    // Ensure frame generation.
-    SetWillGenerateFrame(aPipeline->mRenderRoot);
-  } else {
-    if (useWrTextureWrapper) {
-      aPipeline->mWrTextureWrapper = new WebRenderTextureHostWrapper(this);
-      aPipeline->mWrTextureWrapper->UpdateWebRenderTextureHost(aMaybeFastTxn,
-                                                               wrTexture);
-    }
-    Range<wr::ImageKey> keys(&aKeys[0], aKeys.Length());
-    auto externalImageKey =
-        aPipeline->mWrTextureWrapper
-            ? aPipeline->mWrTextureWrapper->GetExternalImageKey()
-            : wrTexture->GetExternalImageKey();
-    wrTexture->PushResourceUpdates(aMaybeFastTxn, op, keys, externalImageKey);
-  }
-
-  if (aPipeline->mWrTextureWrapper) {
-    // Force frame rendering, since WebRenderTextureHost update its data outside
-    // of WebRender.
-    aMaybeFastTxn.InvalidateRenderedFrame();
-    HoldExternalImage(aPipelineId, aEpoch, aPipeline->mWrTextureWrapper);
-  }
+  Range<wr::ImageKey> keys(&aKeys[0], aKeys.Length());
+  auto externalImageKey = wrTexture->GetExternalImageKey();
+  wrTexture->PushResourceUpdates(aMaybeFastTxn, op, keys, externalImageKey);
 
   return Some(op);
 }
 
 Maybe<TextureHost::ResourceUpdateOp>
 AsyncImagePipelineManager::UpdateWithoutExternalImage(
     TextureHost* aTexture, wr::ImageKey aKey, TextureHost::ResourceUpdateOp aOp,
     wr::TransactionBuilder& aTxn) {
@@ -549,35 +504,16 @@ void AsyncImagePipelineManager::HoldExte
     return;
   }
   // Hold WebRenderTextureHost until end of its usage on RenderThread
   holder->mTextureHosts.push(ForwardingTextureHost(aEpoch, aTexture));
 }
 
 void AsyncImagePipelineManager::HoldExternalImage(
     const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch,
-    WebRenderTextureHostWrapper* aWrTextureWrapper) {
-  if (mDestroyed) {
-    return;
-  }
-  MOZ_ASSERT(aWrTextureWrapper);
-
-  PipelineTexturesHolder* holder =
-      mPipelineTexturesHolders.Get(wr::AsUint64(aPipelineId));
-  MOZ_ASSERT(holder);
-  if (!holder) {
-    return;
-  }
-  // Hold WebRenderTextureHostWrapper until end of its usage on RenderThread
-  holder->mTextureHostWrappers.push(
-      ForwardingTextureHostWrapper(aEpoch, aWrTextureWrapper));
-}
-
-void AsyncImagePipelineManager::HoldExternalImage(
-    const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch,
     const wr::ExternalImageId& aImageId) {
   if (mDestroyed) {
     SharedSurfacesParent::Release(aImageId);
     return;
   }
 
   PipelineTexturesHolder* holder =
       mPipelineTexturesHolders.Get(wr::AsUint64(aPipelineId));
@@ -671,22 +607,16 @@ void AsyncImagePipelineManager::ProcessP
       if (aEpoch <= holder->mTextureHosts.front().mEpoch) {
         break;
       }
       // Need to extend holding TextureHost if it is direct bounded texture.
       HoldUntilNotUsedByGPU(holder->mTextureHosts.front().mTexture,
                             aUpdatesCount);
       holder->mTextureHosts.pop();
     }
-    while (!holder->mTextureHostWrappers.empty()) {
-      if (aEpoch <= holder->mTextureHostWrappers.front().mEpoch) {
-        break;
-      }
-      holder->mTextureHostWrappers.pop();
-    }
     while (!holder->mExternalImages.empty()) {
       if (aEpoch <= holder->mExternalImages.front()->mEpoch) {
         break;
       }
       holder->mExternalImages.pop();
     }
   }
 }
--- a/gfx/layers/wr/AsyncImagePipelineManager.h
+++ b/gfx/layers/wr/AsyncImagePipelineManager.h
@@ -7,17 +7,16 @@
 #ifndef MOZILLA_GFX_WEBRENDERCOMPOSITABLE_HOLDER_H
 #define MOZILLA_GFX_WEBRENDERCOMPOSITABLE_HOLDER_H
 
 #include <queue>
 
 #include "CompositableHost.h"
 #include "mozilla/gfx/Point.h"
 #include "mozilla/layers/TextureHost.h"
-#include "mozilla/layers/WebRenderTextureHostWrapper.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/webrender/WebRenderAPI.h"
 #include "mozilla/webrender/WebRenderTypes.h"
 #include "nsClassHashtable.h"
 
 namespace mozilla {
 
 namespace wr {
@@ -27,17 +26,16 @@ class WebRenderPipelineInfo;
 }  // namespace wr
 
 namespace layers {
 
 class CompositableHost;
 class CompositorVsyncScheduler;
 class WebRenderImageHost;
 class WebRenderTextureHost;
-class WebRenderTextureHostWrapper;
 
 class AsyncImagePipelineManager final {
  public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AsyncImagePipelineManager)
 
   explicit AsyncImagePipelineManager(
       nsTArray<RefPtr<wr::WebRenderAPI>>&& aApis);
 
@@ -52,19 +50,16 @@ class AsyncImagePipelineManager final {
   void RemovePipeline(const wr::PipelineId& aPipelineId,
                       const wr::Epoch& aEpoch);
   WebRenderBridgeParent* GetWrBridge(const wr::PipelineId& aPipelineId);
 
   void HoldExternalImage(const wr::PipelineId& aPipelineId,
                          const wr::Epoch& aEpoch, TextureHost* aTexture);
   void HoldExternalImage(const wr::PipelineId& aPipelineId,
                          const wr::Epoch& aEpoch,
-                         WebRenderTextureHostWrapper* aWrTextureWrapper);
-  void HoldExternalImage(const wr::PipelineId& aPipelineId,
-                         const wr::Epoch& aEpoch,
                          const wr::ExternalImageId& aImageId);
 
   // This is called from the Renderer thread to notify this class about the
   // pipelines in the most recently completed render. A copy of the update
   // information is put into mUpdatesQueue.
   void NotifyPipelinesUpdated(RefPtr<wr::WebRenderPipelineInfo> aInfo,
                               bool aRender);
 
@@ -146,37 +141,28 @@ class AsyncImagePipelineManager final {
 
   struct ForwardingTextureHost {
     ForwardingTextureHost(const wr::Epoch& aEpoch, TextureHost* aTexture)
         : mEpoch(aEpoch), mTexture(aTexture) {}
     wr::Epoch mEpoch;
     CompositableTextureHostRef mTexture;
   };
 
-  struct ForwardingTextureHostWrapper {
-    ForwardingTextureHostWrapper(const wr::Epoch& aEpoch,
-                                 WebRenderTextureHostWrapper* aWrTextureWrapper)
-        : mEpoch(aEpoch), mWrTextureWrapper(aWrTextureWrapper) {}
-    wr::Epoch mEpoch;
-    RefPtr<WebRenderTextureHostWrapper> mWrTextureWrapper;
-  };
-
   struct ForwardingExternalImage {
     ForwardingExternalImage(const wr::Epoch& aEpoch,
                             const wr::ExternalImageId& aImageId)
         : mEpoch(aEpoch), mImageId(aImageId) {}
     ~ForwardingExternalImage();
     wr::Epoch mEpoch;
     wr::ExternalImageId mImageId;
   };
 
   struct PipelineTexturesHolder {
     // Holds forwarding WebRenderTextureHosts.
     std::queue<ForwardingTextureHost> mTextureHosts;
-    std::queue<ForwardingTextureHostWrapper> mTextureHostWrappers;
     std::queue<UniquePtr<ForwardingExternalImage>> mExternalImages;
     Maybe<wr::Epoch> mDestroyedEpoch;
     WebRenderBridgeParent* MOZ_NON_OWNING_REF mWrBridge = nullptr;
   };
 
   struct AsyncImagePipeline {
     AsyncImagePipeline();
     void Update(const LayoutDeviceRect& aScBounds,
@@ -201,17 +187,16 @@ class AsyncImagePipelineManager final {
     bool mUseExternalImage;
     LayoutDeviceRect mScBounds;
     gfx::Matrix4x4 mScTransform;
     gfx::MaybeIntSize mScaleToSize;
     wr::ImageRendering mFilter;
     wr::MixBlendMode mMixBlendMode;
     RefPtr<WebRenderImageHost> mImageHost;
     CompositableTextureHostRef mCurrentTexture;
-    RefPtr<WebRenderTextureHostWrapper> mWrTextureWrapper;
     nsTArray<wr::ImageKey> mKeys;
   };
 
   void ApplyAsyncImageForPipeline(const wr::Epoch& aEpoch,
                                   const wr::PipelineId& aPipelineId,
                                   AsyncImagePipeline* aPipeline,
                                   wr::TransactionBuilder& aSceneBuilderTxn,
                                   wr::TransactionBuilder& aMaybeFastTxn);
--- a/gfx/layers/wr/WebRenderTextureHost.cpp
+++ b/gfx/layers/wr/WebRenderTextureHost.cpp
@@ -205,36 +205,32 @@ uint32_t WebRenderTextureHost::NumSubTex
   MOZ_ASSERT(mWrappedTextureHost);
   return mWrappedTextureHost->NumSubTextures();
 }
 
 void WebRenderTextureHost::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
     const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   MOZ_ASSERT(mWrappedTextureHost);
-  MOZ_ASSERT(mExternalImageId == aExtID || SupportsWrNativeTexture());
+  MOZ_ASSERT(mExternalImageId == aExtID);
 
   mWrappedTextureHost->PushResourceUpdates(aResources, aOp, aImageKeys, aExtID);
 }
 
 void WebRenderTextureHost::PushDisplayItems(
     wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
     const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
     const Range<wr::ImageKey>& aImageKeys) {
   MOZ_ASSERT(mWrappedTextureHost);
   MOZ_ASSERT(aImageKeys.length() > 0);
 
   mWrappedTextureHost->PushDisplayItems(aBuilder, aBounds, aClip, aFilter,
                                         aImageKeys);
 }
 
-bool WebRenderTextureHost::SupportsWrNativeTexture() {
-  return mWrappedTextureHost->SupportsWrNativeTexture();
-}
-
 bool WebRenderTextureHost::NeedsYFlip() const {
   bool yFlip = TextureHost::NeedsYFlip();
   if (mWrappedTextureHost->AsSurfaceTextureHost()) {
     MOZ_ASSERT(yFlip);
     // With WebRender, SurfaceTextureHost always requests y-flip.
     // But y-flip should not be handled, since
     // SurfaceTexture.getTransformMatrix() is not handled yet.
     // See Bug 1507076.
--- a/gfx/layers/wr/WebRenderTextureHost.h
+++ b/gfx/layers/wr/WebRenderTextureHost.h
@@ -76,18 +76,16 @@ class WebRenderTextureHost : public Text
                            const Range<wr::ImageKey>& aImageKeys,
                            const wr::ExternalImageId& aExtID) override;
 
   void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
                         const wr::LayoutRect& aBounds,
                         const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
                         const Range<wr::ImageKey>& aImageKeys) override;
 
-  bool SupportsWrNativeTexture() override;
-
   bool NeedsYFlip() const override;
 
   void MaybeNofityForUse(wr::TransactionBuilder& aTxn);
 
  protected:
   void CreateRenderTextureHost(const SurfaceDescriptor& aDesc,
                                TextureHost* aTexture);
 
deleted file mode 100644
--- a/gfx/layers/wr/WebRenderTextureHostWrapper.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "WebRenderTextureHostWrapper.h"
-
-#include "mozilla/layers/AsyncImagePipelineManager.h"
-#include "mozilla/layers/WebRenderTextureHost.h"
-#include "mozilla/webrender/RenderTextureHostWrapper.h"
-#include "mozilla/webrender/RenderThread.h"
-#include "mozilla/webrender/WebRenderAPI.h"
-#include "mozilla/webrender/RenderThread.h"
-
-namespace mozilla {
-namespace layers {
-
-class ScheduleUpdateRenderTextureHost : public wr::NotificationHandler {
- public:
-  ScheduleUpdateRenderTextureHost(uint64_t aSrcExternalImageId,
-                                  uint64_t aWrappedExternalImageId)
-      : mSrcExternalImageId(aSrcExternalImageId),
-        mWrappedExternalImageId(aWrappedExternalImageId) {}
-
-  virtual void Notify(wr::Checkpoint aCheckpoint) override {
-    if (aCheckpoint == wr::Checkpoint::FrameTexturesUpdated) {
-      MOZ_ASSERT(wr::RenderThread::IsInRenderThread());
-      wr::RenderThread::Get()->UpdateRenderTextureHost(mSrcExternalImageId,
-                                                       mWrappedExternalImageId);
-    } else {
-      MOZ_ASSERT(aCheckpoint == wr::Checkpoint::TransactionDropped);
-    }
-  }
-
- protected:
-  uint64_t mSrcExternalImageId;
-  uint64_t mWrappedExternalImageId;
-};
-
-WebRenderTextureHostWrapper::WebRenderTextureHostWrapper(
-    AsyncImagePipelineManager* aManager)
-    : mExternalImageId(aManager->GetNextExternalImageId()) {
-  MOZ_ASSERT(aManager);
-  MOZ_COUNT_CTOR(WebRenderTextureHostWrapper);
-
-  RefPtr<wr::RenderTextureHost> texture = new wr::RenderTextureHostWrapper();
-  wr::RenderThread::Get()->RegisterExternalImage(wr::AsUint64(mExternalImageId),
-                                                 texture.forget());
-}
-
-WebRenderTextureHostWrapper::~WebRenderTextureHostWrapper() {
-  MOZ_COUNT_DTOR(WebRenderTextureHostWrapper);
-  wr::RenderThread::Get()->UnregisterExternalImage(
-      wr::AsUint64(mExternalImageId));
-}
-
-void WebRenderTextureHostWrapper::UpdateWebRenderTextureHost(
-    wr::TransactionBuilder& aTxn, WebRenderTextureHost* aTextureHost) {
-  MOZ_ASSERT(aTextureHost);
-
-  // AsyncImagePipelineManager is responsible of holding compositable ref of
-  // wrapped WebRenderTextureHost by using ForwardingTextureHost.
-  // ScheduleUpdateRenderTextureHost does not need to handle it.
-
-  aTxn.Notify(wr::Checkpoint::FrameTexturesUpdated,
-              MakeUnique<ScheduleUpdateRenderTextureHost>(
-                  wr::AsUint64(mExternalImageId),
-                  wr::AsUint64(aTextureHost->GetExternalImageKey())));
-
-  mWrTextureHost = aTextureHost;
-}
-
-}  // namespace layers
-}  // namespace mozilla
deleted file mode 100644
--- a/gfx/layers/wr/WebRenderTextureHostWrapper.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZILLA_GFX_WEBRENDERTEXTUREHOSTWRAPPER_H
-#define MOZILLA_GFX_WEBRENDERTEXTUREHOSTWRAPPER_H
-
-#include "mozilla/webrender/WebRenderTypes.h"
-
-namespace mozilla {
-
-namespace wr {
-class TransactionBuilder;
-}
-
-namespace layers {
-
-class WebRenderTextureHost;
-class AsyncImagePipelineManager;
-
-class WebRenderTextureHostWrapper {
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderTextureHostWrapper)
-
- public:
-  explicit WebRenderTextureHostWrapper(AsyncImagePipelineManager* aManager);
-
-  void UpdateWebRenderTextureHost(wr::TransactionBuilder& aTxn,
-                                  WebRenderTextureHost* aTextureHost);
-
-  wr::ExternalImageId GetExternalImageKey() { return mExternalImageId; }
-
- protected:
-  virtual ~WebRenderTextureHostWrapper();
-
-  RefPtr<WebRenderTextureHost> mWrTextureHost;
-  wr::ExternalImageId mExternalImageId;
-};
-
-}  // namespace layers
-}  // namespace mozilla
-
-#endif  // MOZILLA_GFX_WEBRENDERTEXTUREHOSTWRAPPER_H
--- a/gfx/webrender_bindings/RenderTextureHost.h
+++ b/gfx/webrender_bindings/RenderTextureHost.h
@@ -19,37 +19,32 @@ namespace mozilla {
 namespace gl {
 class GLContext;
 }
 
 namespace wr {
 
 class RenderBufferTextureHost;
 class RenderTextureHostOGL;
-class RenderTextureHostWrapper;
 
 void ActivateBindAndTexParameteri(gl::GLContext* aGL, GLenum aActiveTexture,
                                   GLenum aBindTarget, GLuint aBindTexture,
                                   wr::ImageRendering aRendering);
 
 class RenderTextureHost {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RenderTextureHost)
 
  public:
   RenderTextureHost();
 
   virtual wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL,
                                    wr::ImageRendering aRendering) = 0;
   virtual void Unlock() = 0;
   virtual void ClearCachedResources() {}
 
-  virtual RenderTextureHostWrapper* AsRenderTextureHostWrapper() {
-    return nullptr;
-  }
-
   virtual void PrepareForUse() {}
   virtual void NofityForUse() {}
   virtual void NotifyNotUsed() {}
 
  protected:
   virtual ~RenderTextureHost();
 
   bool IsFilterUpdateNecessary(wr::ImageRendering aRendering);
deleted file mode 100644
--- a/gfx/webrender_bindings/RenderTextureHostWrapper.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "RenderTextureHostWrapper.h"
-
-#include "mozilla/gfx/Logging.h"
-#include "mozilla/layers/ImageDataSerializer.h"
-#include "mozilla/layers/SourceSurfaceSharedData.h"
-#include "mozilla/webrender/RenderThread.h"
-
-namespace mozilla {
-namespace wr {
-
-RenderTextureHostWrapper::RenderTextureHostWrapper()
-    : mInited(false), mLocked(false) {
-  MOZ_COUNT_CTOR_INHERITED(RenderTextureHostWrapper, RenderTextureHost);
-}
-
-RenderTextureHostWrapper::~RenderTextureHostWrapper() {
-  MOZ_COUNT_DTOR_INHERITED(RenderTextureHostWrapper, RenderTextureHost);
-}
-
-wr::WrExternalImage RenderTextureHostWrapper::Lock(
-    uint8_t aChannelIndex, gl::GLContext* aGL, wr::ImageRendering aRendering) {
-  if (!mTextureHost) {
-    MOZ_ASSERT_UNREACHABLE("unexpected to happen");
-    return InvalidToWrExternalImage();
-  }
-
-  mLocked = true;
-  return mTextureHost->Lock(aChannelIndex, aGL, aRendering);
-}
-
-void RenderTextureHostWrapper::Unlock() {
-  if (mTextureHost) {
-    mTextureHost->Unlock();
-  }
-  mLocked = false;
-}
-
-void RenderTextureHostWrapper::ClearCachedResources() {
-  if (mTextureHost) {
-    mTextureHost->ClearCachedResources();
-  }
-}
-
-void RenderTextureHostWrapper::UpdateRenderTextureHost(
-    RenderTextureHost* aTextureHost) {
-  MOZ_ASSERT(RenderThread::IsInRenderThread());
-  MOZ_RELEASE_ASSERT(!mLocked);
-
-  mInited = true;
-  mTextureHost = aTextureHost;
-}
-
-}  // namespace wr
-}  // namespace mozilla
deleted file mode 100644
--- a/gfx/webrender_bindings/RenderTextureHostWrapper.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H
-#define MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H
-
-#include "RenderTextureHost.h"
-
-namespace mozilla {
-
-namespace wr {
-
-class RenderTextureHostWrapper final : public RenderTextureHost {
- public:
-  explicit RenderTextureHostWrapper();
-
-  wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL,
-                           wr::ImageRendering aRendering) override;
-  void Unlock() override;
-  void ClearCachedResources() override;
-
-  RenderTextureHostWrapper* AsRenderTextureHostWrapper() override {
-    return this;
-  }
-
-  void UpdateRenderTextureHost(RenderTextureHost* aTextureHost);
-  bool IsInited() { return mInited; }
-
- private:
-  virtual ~RenderTextureHostWrapper();
-
-  bool mInited;
-  bool mLocked;
-  RefPtr<RenderTextureHost> mTextureHost;
-};
-
-}  // namespace wr
-}  // namespace mozilla
-
-#endif  // MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H
--- a/gfx/webrender_bindings/RenderThread.cpp
+++ b/gfx/webrender_bindings/RenderThread.cpp
@@ -688,40 +688,16 @@ void RenderThread::NotifyNotUsed(uint64_
   if (it == mRenderTextures.end()) {
     return;
   }
 
   RefPtr<RenderTextureHost> texture = it->second;
   texture->NotifyNotUsed();
 }
 
-void RenderThread::UpdateRenderTextureHost(uint64_t aSrcExternalImageId,
-                                           uint64_t aWrappedExternalImageId) {
-  MOZ_ASSERT(aSrcExternalImageId != aWrappedExternalImageId);
-  MOZ_ASSERT(RenderThread::IsInRenderThread());
-
-  MutexAutoLock lock(mRenderTextureMapLock);
-  if (mHasShutdown) {
-    return;
-  }
-  auto src = mRenderTextures.find(aSrcExternalImageId);
-  auto wrapped = mRenderTextures.find(aWrappedExternalImageId);
-  if (src == mRenderTextures.end() || wrapped == mRenderTextures.end()) {
-    return;
-  }
-  MOZ_ASSERT(src->second->AsRenderTextureHostWrapper());
-  MOZ_ASSERT(!wrapped->second->AsRenderTextureHostWrapper());
-  RenderTextureHostWrapper* wrapper = src->second->AsRenderTextureHostWrapper();
-  if (!wrapper) {
-    MOZ_ASSERT_UNREACHABLE("unexpected to happen");
-    return;
-  }
-  wrapper->UpdateRenderTextureHost(wrapped->second);
-}
-
 void RenderThread::NofityForUse(uint64_t aExternalImageId) {
   MOZ_ASSERT(RenderThread::IsInRenderThread());
 
   MutexAutoLock lock(mRenderTextureMapLock);
   if (mHasShutdown) {
     return;
   }
   auto it = mRenderTextures.find(aExternalImageId);
--- a/gfx/webrender_bindings/RenderThread.h
+++ b/gfx/webrender_bindings/RenderThread.h
@@ -200,20 +200,16 @@ class RenderThread final {
 
   /// Can be called from any thread.
   void PrepareForUse(uint64_t aExternalImageId);
 
   /// Can be called from any thread.
   void NotifyNotUsed(uint64_t aExternalImageId);
 
   /// Can only be called from the render thread.
-  void UpdateRenderTextureHost(uint64_t aSrcExternalImageId,
-                               uint64_t aWrappedExternalImageId);
-
-  /// Can only be called from the render thread.
   void NofityForUse(uint64_t aExternalImageId);
 
   /// Can only be called from the render thread.
   void UnregisterExternalImageDuringShutdown(uint64_t aExternalImageId);
 
   /// Can only be called from the render thread.
   RenderTextureHost* GetRenderTexture(WrExternalImageId aExternalImageId);
 
--- a/gfx/webrender_bindings/moz.build
+++ b/gfx/webrender_bindings/moz.build
@@ -12,17 +12,16 @@ EXPORTS.mozilla.webrender += [
     'RenderCompositor.h',
     'RenderCompositorOGL.h',
     'RenderEGLImageTextureHost.h',
     'RendererOGL.h',
     'RendererScreenshotGrabber.h',
     'RenderSharedSurfaceTextureHost.h',
     'RenderTextureHost.h',
     'RenderTextureHostOGL.h',
-    'RenderTextureHostWrapper.h',
     'RenderThread.h',
     'webrender_ffi.h',
     'WebRenderAPI.h',
     'WebRenderTypes.h',
 ]
 
 UNIFIED_SOURCES += [
     'Moz2DImageRenderer.cpp',
@@ -30,17 +29,16 @@ UNIFIED_SOURCES += [
     'RenderCompositor.cpp',
     'RenderCompositorOGL.cpp',
     'RenderEGLImageTextureHost.cpp',
     'RendererOGL.cpp',
     'RendererScreenshotGrabber.cpp',
     'RenderSharedSurfaceTextureHost.cpp',
     'RenderTextureHost.cpp',
     'RenderTextureHostOGL.cpp',
-    'RenderTextureHostWrapper.cpp',
     'RenderThread.cpp',
     'WebRenderAPI.cpp',
     'WebRenderTypes.cpp',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     EXPORTS.mozilla.webrender += [
         'RenderMacIOSurfaceTextureHostOGL.h',