Bug 1617808 - Re-deliver PREFER_COMPOSITOR_SURFACE flag to WebRender r=gw
authorsotaro <sotaro.ikeda.g@gmail.com>
Tue, 10 Mar 2020 03:52:08 +0000
changeset 517730 c7766d0b4a121985a8b07e6721d66ccab57bbf76
parent 517729 693b8a034a9b60684008e81152411d023aa89afb
child 517731 71a189bb56b3d101a4bc8e1792c69e7325dc8ac5
push id37200
push usermalexandru@mozilla.com
push dateTue, 10 Mar 2020 09:44:45 +0000
treeherdermozilla-central@c7766d0b4a12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1617808
milestone76.0a1
first release with
nightly linux32
c7766d0b4a12 / 76.0a1 / 20200310094445 / files
nightly linux64
c7766d0b4a12 / 76.0a1 / 20200310094445 / files
nightly mac
c7766d0b4a12 / 76.0a1 / 20200310094445 / files
nightly win32
c7766d0b4a12 / 76.0a1 / 20200310094445 / files
nightly win64
c7766d0b4a12 / 76.0a1 / 20200310094445 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1617808 - Re-deliver PREFER_COMPOSITOR_SURFACE flag to WebRender r=gw Differential Revision: https://phabricator.services.mozilla.com/D64007
gfx/layers/composite/GPUVideoTextureHost.cpp
gfx/layers/composite/GPUVideoTextureHost.h
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TextureHost.h
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/d3d11/TextureD3D11.h
gfx/layers/ipc/ImageBridgeParent.cpp
gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
gfx/layers/opengl/TextureHostOGL.cpp
gfx/layers/opengl/TextureHostOGL.h
gfx/layers/opengl/WaylandDMABUFTextureHostOGL.cpp
gfx/layers/opengl/WaylandDMABUFTextureHostOGL.h
gfx/layers/wr/AsyncImagePipelineManager.cpp
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/layers/wr/WebRenderTextureHost.cpp
gfx/layers/wr/WebRenderTextureHost.h
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/WebRenderAPI.h
gfx/webrender_bindings/src/bindings.rs
--- a/gfx/layers/composite/GPUVideoTextureHost.cpp
+++ b/gfx/layers/composite/GPUVideoTextureHost.cpp
@@ -145,34 +145,34 @@ uint32_t GPUVideoTextureHost::NumSubText
   if (!EnsureWrappedTextureHost()) {
     return 0;
   }
   return EnsureWrappedTextureHost()->NumSubTextures();
 }
 
 void GPUVideoTextureHost::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
-    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
-    const bool aPreferCompositorSurface) {
+    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   MOZ_ASSERT(EnsureWrappedTextureHost());
   if (!EnsureWrappedTextureHost()) {
     return;
   }
-  EnsureWrappedTextureHost()->PushResourceUpdates(
-      aResources, aOp, aImageKeys, aExtID, aPreferCompositorSurface);
+  EnsureWrappedTextureHost()->PushResourceUpdates(aResources, aOp, aImageKeys,
+                                                  aExtID);
 }
 
 void GPUVideoTextureHost::PushDisplayItems(
     wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
     const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
-    const Range<wr::ImageKey>& aImageKeys) {
+    const Range<wr::ImageKey>& aImageKeys,
+    const bool aPreferCompositorSurface) {
   MOZ_ASSERT(EnsureWrappedTextureHost());
   MOZ_ASSERT(aImageKeys.length() > 0);
   if (!EnsureWrappedTextureHost()) {
     return;
   }
 
-  EnsureWrappedTextureHost()->PushDisplayItems(aBuilder, aBounds, aClip,
-                                               aFilter, aImageKeys);
+  EnsureWrappedTextureHost()->PushDisplayItems(
+      aBuilder, aBounds, aClip, aFilter, aImageKeys, aPreferCompositorSurface);
 }
 
 }  // namespace layers
 }  // namespace mozilla
--- a/gfx/layers/composite/GPUVideoTextureHost.h
+++ b/gfx/layers/composite/GPUVideoTextureHost.h
@@ -51,23 +51,23 @@ class GPUVideoTextureHost : public Textu
   void CreateRenderTexture(
       const wr::ExternalImageId& aExternalImageId) override;
 
   uint32_t NumSubTextures() override;
 
   void PushResourceUpdates(wr::TransactionBuilder& aResources,
                            ResourceUpdateOp aOp,
                            const Range<wr::ImageKey>& aImageKeys,
-                           const wr::ExternalImageId& aExtID,
-                           const bool aPreferCompositorSurface) override;
+                           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;
+                        const Range<wr::ImageKey>& aImageKeys,
+                        const bool aPreferCompositorSurface) override;
 
  protected:
   GPUVideoTextureHost(TextureFlags aFlags,
                       const SurfaceDescriptorGPUVideo& aDescriptor);
 
   TextureHost* EnsureWrappedTextureHost();
 
   RefPtr<TextureHost> mWrappedTextureHost;
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -608,65 +608,67 @@ uint32_t BufferTextureHost::NumSubTextur
     return 3;
   }
 
   return 1;
 }
 
 void BufferTextureHost::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
-    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
-    const bool aPreferCompositorSurface) {
+    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   auto method = aOp == TextureHost::ADD_IMAGE
                     ? &wr::TransactionBuilder::AddExternalImage
                     : &wr::TransactionBuilder::UpdateExternalImage;
   auto imageType = wr::ExternalImageType::Buffer();
 
   if (GetFormat() != gfx::SurfaceFormat::YUV) {
     MOZ_ASSERT(aImageKeys.length() == 1);
 
     wr::ImageDescriptor descriptor(
         GetSize(),
         ImageDataSerializer::ComputeRGBStride(GetFormat(), GetSize().width),
-        GetFormat(), aPreferCompositorSurface);
+        GetFormat());
     (aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
   } else {
     MOZ_ASSERT(aImageKeys.length() == 3);
 
     const layers::YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor();
     wr::ImageDescriptor yDescriptor(
         desc.ySize(), desc.yStride(),
-        SurfaceFormatForColorDepth(desc.colorDepth()),
-        aPreferCompositorSurface);
+        SurfaceFormatForColorDepth(desc.colorDepth()));
     wr::ImageDescriptor cbcrDescriptor(
         desc.cbCrSize(), desc.cbCrStride(),
-        SurfaceFormatForColorDepth(desc.colorDepth()),
-        aPreferCompositorSurface);
+        SurfaceFormatForColorDepth(desc.colorDepth()));
     (aResources.*method)(aImageKeys[0], yDescriptor, aExtID, imageType, 0);
     (aResources.*method)(aImageKeys[1], cbcrDescriptor, aExtID, imageType, 1);
     (aResources.*method)(aImageKeys[2], cbcrDescriptor, aExtID, imageType, 2);
   }
 }
 
-void BufferTextureHost::PushDisplayItems(
-    wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
-    const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
-    const Range<wr::ImageKey>& aImageKeys) {
+void BufferTextureHost::PushDisplayItems(wr::DisplayListBuilder& aBuilder,
+                                         const wr::LayoutRect& aBounds,
+                                         const wr::LayoutRect& aClip,
+                                         wr::ImageRendering aFilter,
+                                         const Range<wr::ImageKey>& aImageKeys,
+                                         const bool aPreferCompositorSurface) {
   if (GetFormat() != gfx::SurfaceFormat::YUV) {
     MOZ_ASSERT(aImageKeys.length() == 1);
     aBuilder.PushImage(aBounds, aClip, true, aFilter, aImageKeys[0],
-                       !(mFlags & TextureFlags::NON_PREMULTIPLIED));
+                       !(mFlags & TextureFlags::NON_PREMULTIPLIED),
+                       wr::ColorF{1.0f, 1.0f, 1.0f, 1.0f},
+                       aPreferCompositorSurface);
   } else {
     MOZ_ASSERT(aImageKeys.length() == 3);
     const YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor();
-    aBuilder.PushYCbCrPlanarImage(
-        aBounds, aClip, true, aImageKeys[0], aImageKeys[1], aImageKeys[2],
-        wr::ToWrColorDepth(desc.colorDepth()),
-        wr::ToWrYuvColorSpace(desc.yUVColorSpace()),
-        wr::ToWrColorRange(desc.colorRange()), aFilter);
+    aBuilder.PushYCbCrPlanarImage(aBounds, aClip, true, aImageKeys[0],
+                                  aImageKeys[1], aImageKeys[2],
+                                  wr::ToWrColorDepth(desc.colorDepth()),
+                                  wr::ToWrYuvColorSpace(desc.yUVColorSpace()),
+                                  wr::ToWrColorRange(desc.colorRange()),
+                                  aFilter, aPreferCompositorSurface);
   }
 }
 
 void TextureHost::DeserializeReadLock(const ReadLockDescriptor& aDesc,
                                       ISurfaceAllocator* aAllocator) {
   if (mReadLock) {
     return;
   }
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -656,28 +656,28 @@ class TextureHost : public AtomicRefCoun
     ADD_IMAGE,
     UPDATE_IMAGE,
   };
 
   // Add all necessary TextureHost informations to the resource update queue.
   virtual void PushResourceUpdates(wr::TransactionBuilder& aResources,
                                    ResourceUpdateOp aOp,
                                    const Range<wr::ImageKey>& aImageKeys,
-                                   const wr::ExternalImageId& aExtID,
-                                   const bool aPreferCompositorSurface) {
+                                   const wr::ExternalImageId& aExtID) {
     MOZ_ASSERT_UNREACHABLE("Unimplemented");
   }
 
   // Put all necessary WR commands into DisplayListBuilder for this textureHost
   // rendering.
   virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
                                 const wr::LayoutRect& aBounds,
                                 const wr::LayoutRect& aClip,
                                 wr::ImageRendering aFilter,
-                                const Range<wr::ImageKey>& aKeys) {
+                                const Range<wr::ImageKey>& aKeys,
+                                const bool aPreferCompositorSurface) {
     MOZ_ASSERT_UNREACHABLE(
         "No PushDisplayItems() implementation for this TextureHost type.");
   }
 
   /**
    * Some API's can use the cross-process IOSurface directly, such as OpenVR
    */
   virtual MacIOSurface* GetMacIOSurface() { return nullptr; }
@@ -788,23 +788,23 @@ class BufferTextureHost : public Texture
   void CreateRenderTexture(
       const wr::ExternalImageId& aExternalImageId) override;
 
   uint32_t NumSubTextures() override;
 
   void PushResourceUpdates(wr::TransactionBuilder& aResources,
                            ResourceUpdateOp aOp,
                            const Range<wr::ImageKey>& aImageKeys,
-                           const wr::ExternalImageId& aExtID,
-                           const bool aPreferCompositorSurface) override;
+                           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;
+                        const Range<wr::ImageKey>& aImageKeys,
+                        const bool aPreferCompositorSurface) override;
 
   void ReadUnlock() override;
   bool IsDirectMap() override {
     return mFirstSource && mFirstSource->IsDirectMap();
   };
 
   bool CanUnlock() { return !mFirstSource || mFirstSource->Sync(false); }
 
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -1005,94 +1005,92 @@ uint32_t DXGITextureHostD3D11::NumSubTex
       MOZ_ASSERT_UNREACHABLE("unexpected format");
       return 1;
     }
   }
 }
 
 void DXGITextureHostD3D11::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
-    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
-    const bool aPreferCompositorSurface) {
+    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   if (!gfx::gfxVars::UseWebRenderANGLE()) {
     MOZ_ASSERT_UNREACHABLE("unexpected to be called without ANGLE");
     return;
   }
 
   MOZ_ASSERT(mHandle);
   auto method = aOp == TextureHost::ADD_IMAGE
                     ? &wr::TransactionBuilder::AddExternalImage
                     : &wr::TransactionBuilder::UpdateExternalImage;
   switch (mFormat) {
     case gfx::SurfaceFormat::R8G8B8X8:
     case gfx::SurfaceFormat::R8G8B8A8:
     case gfx::SurfaceFormat::B8G8R8A8:
     case gfx::SurfaceFormat::B8G8R8X8: {
       MOZ_ASSERT(aImageKeys.length() == 1);
 
-      wr::ImageDescriptor descriptor(mSize, GetFormat(),
-                                     aPreferCompositorSurface);
+      wr::ImageDescriptor descriptor(mSize, GetFormat());
       auto imageType =
           wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
       (aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
       break;
     }
     case gfx::SurfaceFormat::P010:
     case gfx::SurfaceFormat::P016:
     case gfx::SurfaceFormat::NV12: {
       MOZ_ASSERT(aImageKeys.length() == 2);
       MOZ_ASSERT(mSize.width % 2 == 0);
       MOZ_ASSERT(mSize.height % 2 == 0);
 
-      wr::ImageDescriptor descriptor0(mSize,
-                                      mFormat == gfx::SurfaceFormat::NV12
-                                          ? gfx::SurfaceFormat::A8
-                                          : gfx::SurfaceFormat::A16,
-                                      aPreferCompositorSurface);
+      wr::ImageDescriptor descriptor0(mSize, mFormat == gfx::SurfaceFormat::NV12
+                                                 ? gfx::SurfaceFormat::A8
+                                                 : gfx::SurfaceFormat::A16);
       wr::ImageDescriptor descriptor1(mSize / 2,
                                       mFormat == gfx::SurfaceFormat::NV12
                                           ? gfx::SurfaceFormat::R8G8
-                                          : gfx::SurfaceFormat::R16G16,
-                                      aPreferCompositorSurface);
+                                          : gfx::SurfaceFormat::R16G16);
       auto imageType =
           wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
       (aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
       (aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
       break;
     }
     default: {
       MOZ_ASSERT_UNREACHABLE("unexpected to be called");
     }
   }
 }
 
 void DXGITextureHostD3D11::PushDisplayItems(
     wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
     const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
-    const Range<wr::ImageKey>& aImageKeys) {
+    const Range<wr::ImageKey>& aImageKeys,
+    const bool aPreferCompositorSurface) {
   switch (GetFormat()) {
     case gfx::SurfaceFormat::R8G8B8X8:
     case gfx::SurfaceFormat::R8G8B8A8:
     case gfx::SurfaceFormat::B8G8R8A8:
     case gfx::SurfaceFormat::B8G8R8X8: {
       MOZ_ASSERT(aImageKeys.length() == 1);
       aBuilder.PushImage(aBounds, aClip, true, aFilter, aImageKeys[0],
-                         !(mFlags & TextureFlags::NON_PREMULTIPLIED));
+                         !(mFlags & TextureFlags::NON_PREMULTIPLIED),
+                         wr::ColorF{1.0f, 1.0f, 1.0f, 1.0f},
+                         aPreferCompositorSurface);
       break;
     }
     case gfx::SurfaceFormat::P010:
     case gfx::SurfaceFormat::P016:
     case gfx::SurfaceFormat::NV12: {
       MOZ_ASSERT(aImageKeys.length() == 2);
-      aBuilder.PushNV12Image(aBounds, aClip, true, aImageKeys[0], aImageKeys[1],
-                             GetFormat() == gfx::SurfaceFormat::NV12
-                                 ? wr::ColorDepth::Color8
-                                 : wr::ColorDepth::Color16,
-                             wr::ToWrYuvColorSpace(mYUVColorSpace),
-                             wr::ToWrColorRange(mColorRange), aFilter);
+      aBuilder.PushNV12Image(
+          aBounds, aClip, true, aImageKeys[0], aImageKeys[1],
+          GetFormat() == gfx::SurfaceFormat::NV12 ? wr::ColorDepth::Color8
+                                                  : wr::ColorDepth::Color16,
+          wr::ToWrYuvColorSpace(mYUVColorSpace),
+          wr::ToWrColorRange(mColorRange), aFilter, aPreferCompositorSurface);
       break;
     }
     default: {
       MOZ_ASSERT_UNREACHABLE("unexpected to be called");
     }
   }
 }
 
@@ -1257,18 +1255,17 @@ void DXGIYCbCrTextureHostD3D11::CreateRe
 
 uint32_t DXGIYCbCrTextureHostD3D11::NumSubTextures() {
   // ycbcr use 3 sub textures.
   return 3;
 }
 
 void DXGIYCbCrTextureHostD3D11::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
-    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
-    const bool aPreferCompositorSurface) {
+    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   if (!gfx::gfxVars::UseWebRenderANGLE()) {
     MOZ_ASSERT_UNREACHABLE("unexpected to be called without ANGLE");
     return;
   }
 
   MOZ_ASSERT(mHandles[0] && mHandles[1] && mHandles[2]);
   MOZ_ASSERT(aImageKeys.length() == 3);
   // Assume the chroma planes are rounded up if the luma plane is odd sized.
@@ -1279,36 +1276,35 @@ void DXGIYCbCrTextureHostD3D11::PushReso
 
   auto method = aOp == TextureHost::ADD_IMAGE
                     ? &wr::TransactionBuilder::AddExternalImage
                     : &wr::TransactionBuilder::UpdateExternalImage;
   auto imageType =
       wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
 
   // y
-  wr::ImageDescriptor descriptor0(mSize, gfx::SurfaceFormat::A8,
-                                  aPreferCompositorSurface);
+  wr::ImageDescriptor descriptor0(mSize, gfx::SurfaceFormat::A8);
   // cb and cr
-  wr::ImageDescriptor descriptor1(mSizeCbCr, gfx::SurfaceFormat::A8,
-                                  aPreferCompositorSurface);
+  wr::ImageDescriptor descriptor1(mSizeCbCr, gfx::SurfaceFormat::A8);
   (aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
   (aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
   (aResources.*method)(aImageKeys[2], descriptor1, aExtID, imageType, 2);
 }
 
 void DXGIYCbCrTextureHostD3D11::PushDisplayItems(
     wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
     const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
-    const Range<wr::ImageKey>& aImageKeys) {
+    const Range<wr::ImageKey>& aImageKeys,
+    const bool aPreferCompositorSurface) {
   MOZ_ASSERT(aImageKeys.length() == 3);
 
   aBuilder.PushYCbCrPlanarImage(
       aBounds, aClip, true, aImageKeys[0], aImageKeys[1], aImageKeys[2],
       wr::ToWrColorDepth(mColorDepth), wr::ToWrYuvColorSpace(mYUVColorSpace),
-      wr::ToWrColorRange(mColorRange), aFilter);
+      wr::ToWrColorRange(mColorRange), aFilter, aPreferCompositorSurface);
 }
 
 bool DXGIYCbCrTextureHostD3D11::AcquireTextureSource(
     CompositableTextureSourceRef& aTexture) {
   if (!EnsureTextureSource()) {
     return false;
   }
   aTexture = mTextureSources[0].get();
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ b/gfx/layers/d3d11/TextureD3D11.h
@@ -349,23 +349,23 @@ class DXGITextureHostD3D11 : public Text
   void CreateRenderTexture(
       const wr::ExternalImageId& aExternalImageId) override;
 
   uint32_t NumSubTextures() override;
 
   void PushResourceUpdates(wr::TransactionBuilder& aResources,
                            ResourceUpdateOp aOp,
                            const Range<wr::ImageKey>& aImageKeys,
-                           const wr::ExternalImageId& aExtID,
-                           const bool aPreferCompositorSurface) override;
+                           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;
+                        const Range<wr::ImageKey>& aImageKeys,
+                        const bool aPreferCompositorSurface) override;
 
  protected:
   bool LockInternal();
   void UnlockInternal();
 
   bool EnsureTextureSource();
 
   RefPtr<ID3D11Device> GetDevice();
@@ -418,23 +418,23 @@ class DXGIYCbCrTextureHostD3D11 : public
   void CreateRenderTexture(
       const wr::ExternalImageId& aExternalImageId) override;
 
   uint32_t NumSubTextures() override;
 
   void PushResourceUpdates(wr::TransactionBuilder& aResources,
                            ResourceUpdateOp aOp,
                            const Range<wr::ImageKey>& aImageKeys,
-                           const wr::ExternalImageId& aExtID,
-                           const bool aPreferCompositorSurface) override;
+                           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;
+                        const Range<wr::ImageKey>& aImageKeys,
+                        const bool aPreferCompositorSurface) override;
 
  private:
   bool EnsureTextureSource();
 
  protected:
   RefPtr<ID3D11Device> GetDevice();
 
   bool EnsureTexture();
--- a/gfx/layers/ipc/ImageBridgeParent.cpp
+++ b/gfx/layers/ipc/ImageBridgeParent.cpp
@@ -675,24 +675,24 @@ RefPtr<TextureHost> GetNullPluginTexture
     void CreateRenderTexture(
         const wr::ExternalImageId& aExternalImageId) override {}
 
     uint32_t NumSubTextures() override { return 0; }
 
     void PushResourceUpdates(wr::TransactionBuilder& aResources,
                              ResourceUpdateOp aOp,
                              const Range<wr::ImageKey>& aImageKeys,
-                             const wr::ExternalImageId& aExtID,
-                             const bool aPreferCompositorSurface) override {}
+                             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 {}
+                          const Range<wr::ImageKey>& aImageKeys,
+                          const bool aPreferCompositorSurface) override {}
   };
 
   static StaticRefPtr<TextureHost> sNullPluginTextureHost;
   if (!sNullPluginTextureHost) {
     sNullPluginTextureHost = new NullPluginTextureHost();
     ClearOnShutdown(&sNullPluginTextureHost);
   };
 
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
@@ -155,18 +155,17 @@ uint32_t MacIOSurfaceTextureHostOGL::Num
       MOZ_ASSERT_UNREACHABLE("unexpected format");
       return 1;
     }
   }
 }
 
 void MacIOSurfaceTextureHostOGL::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
-    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
-    const bool aPreferCompositorSurface) {
+    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   MOZ_ASSERT(mSurface);
 
   auto method = aOp == TextureHost::ADD_IMAGE
                     ? &wr::TransactionBuilder::AddExternalImage
                     : &wr::TransactionBuilder::UpdateExternalImage;
   auto imageType =
       wr::ExternalImageType::TextureHandle(wr::TextureTarget::Rect);
 
@@ -175,89 +174,92 @@ void MacIOSurfaceTextureHostOGL::PushRes
     case gfx::SurfaceFormat::R8G8B8A8: {
       MOZ_ASSERT(aImageKeys.length() == 1);
       MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
       // The internal pixel format of MacIOSurface is always BGRX or BGRA
       // format.
       auto format = GetFormat() == gfx::SurfaceFormat::R8G8B8A8
                         ? gfx::SurfaceFormat::B8G8R8A8
                         : gfx::SurfaceFormat::B8G8R8X8;
-      wr::ImageDescriptor descriptor(GetSize(), format,
-                                     aPreferCompositorSurface);
+      wr::ImageDescriptor descriptor(GetSize(), format);
       (aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
       break;
     }
     case gfx::SurfaceFormat::YUV422: {
       // This is the special buffer format. The buffer contents could be a
       // converted RGB interleaving data or a YCbCr interleaving data depending
       // on the different platform setting. (e.g. It will be RGB at OpenGL 2.1
       // and YCbCr at OpenGL 3.1)
       MOZ_ASSERT(aImageKeys.length() == 1);
       MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
-      wr::ImageDescriptor descriptor(GetSize(), gfx::SurfaceFormat::B8G8R8X8,
-                                     aPreferCompositorSurface);
+      wr::ImageDescriptor descriptor(GetSize(), gfx::SurfaceFormat::B8G8R8X8);
       (aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
       break;
     }
     case gfx::SurfaceFormat::NV12: {
       MOZ_ASSERT(aImageKeys.length() == 2);
       MOZ_ASSERT(mSurface->GetPlaneCount() == 2);
       wr::ImageDescriptor descriptor0(
           gfx::IntSize(mSurface->GetDevicePixelWidth(0),
                        mSurface->GetDevicePixelHeight(0)),
-          gfx::SurfaceFormat::A8, aPreferCompositorSurface);
+          gfx::SurfaceFormat::A8);
       wr::ImageDescriptor descriptor1(
           gfx::IntSize(mSurface->GetDevicePixelWidth(1),
                        mSurface->GetDevicePixelHeight(1)),
-          gfx::SurfaceFormat::R8G8, aPreferCompositorSurface);
+          gfx::SurfaceFormat::R8G8);
       (aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
       (aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
       break;
     }
     default: {
       MOZ_ASSERT_UNREACHABLE("unexpected to be called");
     }
   }
 }
 
 void MacIOSurfaceTextureHostOGL::PushDisplayItems(
     wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
     const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
-    const Range<wr::ImageKey>& aImageKeys) {
+    const Range<wr::ImageKey>& aImageKeys,
+    const bool aPreferCompositorSurface) {
   switch (GetFormat()) {
     case gfx::SurfaceFormat::R8G8B8X8:
     case gfx::SurfaceFormat::R8G8B8A8:
     case gfx::SurfaceFormat::B8G8R8A8:
     case gfx::SurfaceFormat::B8G8R8X8: {
       MOZ_ASSERT(aImageKeys.length() == 1);
       MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
       aBuilder.PushImage(aBounds, aClip, true, aFilter, aImageKeys[0],
-                         !(mFlags & TextureFlags::NON_PREMULTIPLIED));
+                         !(mFlags & TextureFlags::NON_PREMULTIPLIED),
+                         wr::ColorF{1.0f, 1.0f, 1.0f, 1.0f},
+                         aPreferCompositorSurface);
       break;
     }
     case gfx::SurfaceFormat::YUV422: {
       MOZ_ASSERT(aImageKeys.length() == 1);
       MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
       // Those images can only be generated at present by the Apple H264 decoder
       // which only supports 8 bits color depth.
       aBuilder.PushYCbCrInterleavedImage(
           aBounds, aClip, true, aImageKeys[0], wr::ColorDepth::Color8,
           wr::ToWrYuvColorSpace(GetYUVColorSpace()),
-          wr::ToWrColorRange(GetColorRange()), aFilter);
+          wr::ToWrColorRange(GetColorRange()), aFilter,
+          aPreferCompositorSurface);
       break;
     }
     case gfx::SurfaceFormat::NV12: {
       MOZ_ASSERT(aImageKeys.length() == 2);
       MOZ_ASSERT(mSurface->GetPlaneCount() == 2);
       // Those images can only be generated at present by the Apple H264 decoder
       // which only supports 8 bits color depth.
       aBuilder.PushNV12Image(aBounds, aClip, true, aImageKeys[0], aImageKeys[1],
                              wr::ColorDepth::Color8,
                              wr::ToWrYuvColorSpace(GetYUVColorSpace()),
-                             wr::ToWrColorRange(GetColorRange()), aFilter);
+                             wr::ToWrColorRange(GetColorRange()), aFilter,
+                             aPreferCompositorSurface);
       break;
     }
     default: {
       MOZ_ASSERT_UNREACHABLE("unexpected to be called");
     }
   }
 }
 
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
@@ -66,23 +66,23 @@ class MacIOSurfaceTextureHostOGL : publi
   void CreateRenderTexture(
       const wr::ExternalImageId& aExternalImageId) override;
 
   uint32_t NumSubTextures() override;
 
   void PushResourceUpdates(wr::TransactionBuilder& aResources,
                            ResourceUpdateOp aOp,
                            const Range<wr::ImageKey>& aImageKeys,
-                           const wr::ExternalImageId& aExtID,
-                           const bool aPreferCompositorSurface) override;
+                           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;
+                        const Range<wr::ImageKey>& aImageKeys,
+                        const bool aPreferCompositorSurface) override;
 
   gfx::YUVColorSpace GetYUVColorSpace() const override;
   gfx::ColorRange GetColorRange() const override;
 
  protected:
   GLTextureSource* CreateTextureSourceForPlane(size_t aPlane);
 
   RefPtr<GLTextureSource> mTextureSource;
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -643,57 +643,59 @@ void SurfaceTextureHost::CreateRenderTex
       new wr::RenderAndroidSurfaceTextureHostOGL(mSurfTex, mSize, mFormat,
                                                  mContinuousUpdate);
   wr::RenderThread::Get()->RegisterExternalImage(wr::AsUint64(aExternalImageId),
                                                  texture.forget());
 }
 
 void SurfaceTextureHost::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
-    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
-    const bool aPreferCompositorSurface) {
+    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   auto method = aOp == TextureHost::ADD_IMAGE
                     ? &wr::TransactionBuilder::AddExternalImage
                     : &wr::TransactionBuilder::UpdateExternalImage;
   auto imageType =
       wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
 
   switch (GetFormat()) {
     case gfx::SurfaceFormat::R8G8B8X8:
     case gfx::SurfaceFormat::R8G8B8A8: {
       MOZ_ASSERT(aImageKeys.length() == 1);
 
       // XXX Add RGBA handling. Temporary hack to avoid crash
       // With BGRA format setting, rendering works without problem.
       auto format = GetFormat() == gfx::SurfaceFormat::R8G8B8A8
                         ? gfx::SurfaceFormat::B8G8R8A8
                         : gfx::SurfaceFormat::B8G8R8X8;
-      wr::ImageDescriptor descriptor(GetSize(), format,
-                                     aPreferCompositorSurface);
+      wr::ImageDescriptor descriptor(GetSize(), format);
       (aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
       break;
     }
     default: {
       MOZ_ASSERT_UNREACHABLE("unexpected to be called");
     }
   }
 }
 
-void SurfaceTextureHost::PushDisplayItems(
-    wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
-    const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
-    const Range<wr::ImageKey>& aImageKeys) {
+void SurfaceTextureHost::PushDisplayItems(wr::DisplayListBuilder& aBuilder,
+                                          const wr::LayoutRect& aBounds,
+                                          const wr::LayoutRect& aClip,
+                                          wr::ImageRendering aFilter,
+                                          const Range<wr::ImageKey>& aImageKeys,
+                                          const bool aPreferCompositorSurface) {
   switch (GetFormat()) {
     case gfx::SurfaceFormat::R8G8B8X8:
     case gfx::SurfaceFormat::R8G8B8A8:
     case gfx::SurfaceFormat::B8G8R8A8:
     case gfx::SurfaceFormat::B8G8R8X8: {
       MOZ_ASSERT(aImageKeys.length() == 1);
       aBuilder.PushImage(aBounds, aClip, true, aFilter, aImageKeys[0],
-                         !(mFlags & TextureFlags::NON_PREMULTIPLIED));
+                         !(mFlags & TextureFlags::NON_PREMULTIPLIED),
+                         wr::ColorF{1.0f, 1.0f, 1.0f, 1.0f},
+                         aPreferCompositorSurface);
       break;
     }
     default: {
       MOZ_ASSERT_UNREACHABLE("unexpected to be called");
     }
   }
 }
 
@@ -851,45 +853,46 @@ void EGLImageTextureHost::CreateRenderTe
   RefPtr<wr::RenderTextureHost> texture =
       new wr::RenderEGLImageTextureHost(mImage, mSync, mSize);
   wr::RenderThread::Get()->RegisterExternalImage(wr::AsUint64(aExternalImageId),
                                                  texture.forget());
 }
 
 void EGLImageTextureHost::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
-    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
-    const bool aPreferCompositorSurface) {
+    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   auto method = aOp == TextureHost::ADD_IMAGE
                     ? &wr::TransactionBuilder::AddExternalImage
                     : &wr::TransactionBuilder::UpdateExternalImage;
   auto imageType =
       wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
 
   gfx::SurfaceFormat format =
       mHasAlpha ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::R8G8B8X8;
 
   MOZ_ASSERT(aImageKeys.length() == 1);
   // XXX Add RGBA handling. Temporary hack to avoid crash
   // With BGRA format setting, rendering works without problem.
   auto formatTmp = format == gfx::SurfaceFormat::R8G8B8A8
                        ? gfx::SurfaceFormat::B8G8R8A8
                        : gfx::SurfaceFormat::B8G8R8X8;
-  wr::ImageDescriptor descriptor(GetSize(), formatTmp,
-                                 aPreferCompositorSurface);
+  wr::ImageDescriptor descriptor(GetSize(), formatTmp);
   (aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
 }
 
 void EGLImageTextureHost::PushDisplayItems(
     wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
     const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
-    const Range<wr::ImageKey>& aImageKeys) {
+    const Range<wr::ImageKey>& aImageKeys,
+    const bool aPreferCompositorSurface) {
   MOZ_ASSERT(aImageKeys.length() == 1);
   aBuilder.PushImage(aBounds, aClip, true, aFilter, aImageKeys[0],
-                     !(mFlags & TextureFlags::NON_PREMULTIPLIED));
+                     !(mFlags & TextureFlags::NON_PREMULTIPLIED),
+                     wr::ColorF{1.0f, 1.0f, 1.0f, 1.0f},
+                     aPreferCompositorSurface);
 }
 
 //
 
 GLTextureHost::GLTextureHost(TextureFlags aFlags, GLuint aTextureHandle,
                              GLenum aTarget, GLsync aSync, gfx::IntSize aSize,
                              bool aHasAlpha)
     : TextureHost(aFlags),
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -428,23 +428,23 @@ class SurfaceTextureHost : public Textur
   SurfaceTextureHost* AsSurfaceTextureHost() override { return this; }
 
   void CreateRenderTexture(
       const wr::ExternalImageId& aExternalImageId) override;
 
   void PushResourceUpdates(wr::TransactionBuilder& aResources,
                            ResourceUpdateOp aOp,
                            const Range<wr::ImageKey>& aImageKeys,
-                           const wr::ExternalImageId& aExtID,
-                           const bool aPreferCompositorSurface) override;
+                           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;
+                        const Range<wr::ImageKey>& aImageKeys,
+                        const bool aPreferCompositorSurface) override;
 
  protected:
   bool EnsureAttached();
 
   mozilla::java::GeckoSurfaceTexture::GlobalRef mSurfTex;
   const gfx::IntSize mSize;
   const gfx::SurfaceFormat mFormat;
   bool mContinuousUpdate;
@@ -534,23 +534,23 @@ class EGLImageTextureHost final : public
   const char* Name() override { return "EGLImageTextureHost"; }
 
   void CreateRenderTexture(
       const wr::ExternalImageId& aExternalImageId) override;
 
   void PushResourceUpdates(wr::TransactionBuilder& aResources,
                            ResourceUpdateOp aOp,
                            const Range<wr::ImageKey>& aImageKeys,
-                           const wr::ExternalImageId& aExtID,
-                           const bool aPreferCompositorSurface) override;
+                           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;
+                        const Range<wr::ImageKey>& aImageKeys,
+                        const bool aPreferCompositorSurface) override;
 
  protected:
   const EGLImage mImage;
   const EGLSync mSync;
   const gfx::IntSize mSize;
   const bool mHasAlpha;
   RefPtr<EGLImageTextureSource> mTextureSource;
 };
--- a/gfx/layers/opengl/WaylandDMABUFTextureHostOGL.cpp
+++ b/gfx/layers/opengl/WaylandDMABUFTextureHostOGL.cpp
@@ -123,81 +123,83 @@ void WaylandDMABUFTextureHostOGL::Create
   RefPtr<wr::RenderTextureHost> texture =
       new wr::RenderWaylandDMABUFTextureHostOGL(mSurface);
   wr::RenderThread::Get()->RegisterExternalImage(wr::AsUint64(aExternalImageId),
                                                  texture.forget());
 }
 
 void WaylandDMABUFTextureHostOGL::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
-    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
-    const bool aPreferCompositorSurface) {
+    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   MOZ_ASSERT(mSurface);
 
   auto method = aOp == TextureHost::ADD_IMAGE
                     ? &wr::TransactionBuilder::AddExternalImage
                     : &wr::TransactionBuilder::UpdateExternalImage;
   auto imageType =
       wr::ExternalImageType::TextureHandle(wr::TextureTarget::Default);
 
   switch (mSurface->GetFormat()) {
     case gfx::SurfaceFormat::R8G8B8X8:
     case gfx::SurfaceFormat::R8G8B8A8:
     case gfx::SurfaceFormat::B8G8R8X8:
     case gfx::SurfaceFormat::B8G8R8A8: {
       MOZ_ASSERT(aImageKeys.length() == 1);
       // XXX Add RGBA handling. Temporary hack to avoid crash
       // With BGRA format setting, rendering works without problem.
-      wr::ImageDescriptor descriptor(GetSize(), mSurface->GetFormat(),
-                                     aPreferCompositorSurface);
+      wr::ImageDescriptor descriptor(GetSize(), mSurface->GetFormat());
       (aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
       break;
     }
     case gfx::SurfaceFormat::NV12: {
       MOZ_ASSERT(aImageKeys.length() == 2);
       MOZ_ASSERT(mSurface->GetTextureCount() == 2);
       wr::ImageDescriptor descriptor0(
           gfx::IntSize(mSurface->GetWidth(0), mSurface->GetHeight(0)),
-          gfx::SurfaceFormat::A8, aPreferCompositorSurface);
+          gfx::SurfaceFormat::A8);
       wr::ImageDescriptor descriptor1(
           gfx::IntSize(mSurface->GetWidth(1), mSurface->GetHeight(1)),
-          gfx::SurfaceFormat::R8G8, aPreferCompositorSurface);
+          gfx::SurfaceFormat::R8G8);
       (aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
       (aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
       break;
     }
     default: {
       MOZ_ASSERT_UNREACHABLE("unexpected to be called");
     }
   }
 }
 
 void WaylandDMABUFTextureHostOGL::PushDisplayItems(
     wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
     const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
-    const Range<wr::ImageKey>& aImageKeys) {
+    const Range<wr::ImageKey>& aImageKeys,
+    const bool aPreferCompositorSurface) {
   switch (mSurface->GetFormat()) {
     case gfx::SurfaceFormat::R8G8B8X8:
     case gfx::SurfaceFormat::R8G8B8A8:
     case gfx::SurfaceFormat::B8G8R8A8:
     case gfx::SurfaceFormat::B8G8R8X8: {
       MOZ_ASSERT(aImageKeys.length() == 1);
       aBuilder.PushImage(aBounds, aClip, true, aFilter, aImageKeys[0],
-                         !(mFlags & TextureFlags::NON_PREMULTIPLIED));
+                         !(mFlags & TextureFlags::NON_PREMULTIPLIED),
+                         wr::ColorF{1.0f, 1.0f, 1.0f, 1.0f},
+                         aPreferCompositorSurface);
       break;
     }
     case gfx::SurfaceFormat::NV12: {
       MOZ_ASSERT(aImageKeys.length() == 2);
       MOZ_ASSERT(mSurface->GetTextureCount() == 2);
       // Those images can only be generated at present by the VAAPI H264 decoder
       // which only supports 8 bits color depth.
       aBuilder.PushNV12Image(aBounds, aClip, true, aImageKeys[0], aImageKeys[1],
                              wr::ColorDepth::Color8,
                              wr::ToWrYuvColorSpace(GetYUVColorSpace()),
-                             wr::ToWrColorRange(GetColorRange()), aFilter);
+                             wr::ToWrColorRange(GetColorRange()), aFilter,
+                             aPreferCompositorSurface);
       break;
     }
     default: {
       MOZ_ASSERT_UNREACHABLE("unexpected to be called");
     }
   }
 }
 
--- a/gfx/layers/opengl/WaylandDMABUFTextureHostOGL.h
+++ b/gfx/layers/opengl/WaylandDMABUFTextureHostOGL.h
@@ -55,23 +55,23 @@ class WaylandDMABUFTextureHostOGL : publ
   gfx::ColorRange GetColorRange() const override;
 
   void CreateRenderTexture(
       const wr::ExternalImageId& aExternalImageId) override;
 
   void PushResourceUpdates(wr::TransactionBuilder& aResources,
                            ResourceUpdateOp aOp,
                            const Range<wr::ImageKey>& aImageKeys,
-                           const wr::ExternalImageId& aExtID,
-                           const bool aPreferCompositorSurface) override;
+                           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;
+                        const Range<wr::ImageKey>& aImageKeys,
+                        const bool aPreferCompositorSurface) override;
 
  private:
   GLTextureSource* CreateTextureSourceForPlane(size_t aPlane);
 
  protected:
   RefPtr<GLTextureSource> mTextureSource;
   RefPtr<WaylandDMABufSurface> mSurface;
 };
--- a/gfx/layers/wr/AsyncImagePipelineManager.cpp
+++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ -261,18 +261,17 @@ Maybe<TextureHost::ResourceUpdateOp> Asy
   auto op = canUpdate ? TextureHost::UPDATE_IMAGE : TextureHost::ADD_IMAGE;
 
   if (!useExternalImage) {
     return UpdateWithoutExternalImage(texture, aKeys[0], op, aMaybeFastTxn);
   }
 
   Range<wr::ImageKey> keys(&aKeys[0], aKeys.Length());
   auto externalImageKey = wrTexture->GetExternalImageKey();
-  wrTexture->PushResourceUpdates(aMaybeFastTxn, op, keys, externalImageKey,
-                                 /* aPreferCompositorSurface */ true);
+  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) {
@@ -394,17 +393,17 @@ void AsyncImagePipelineManager::ApplyAsy
                               aPipeline->mScaleToSize.value().height);
     }
 
     if (aPipeline->mUseExternalImage) {
       MOZ_ASSERT(aPipeline->mCurrentTexture->AsWebRenderTextureHost());
       Range<wr::ImageKey> range_keys(&keys[0], keys.Length());
       aPipeline->mCurrentTexture->PushDisplayItems(
           builder, wr::ToLayoutRect(rect), wr::ToLayoutRect(rect),
-          aPipeline->mFilter, range_keys);
+          aPipeline->mFilter, range_keys, /* aPreferCompositorSurface */ true);
       HoldExternalImage(aPipelineId, aEpoch, aPipeline->mCurrentTexture);
     } else {
       MOZ_ASSERT(keys.Length() == 1);
       builder.PushImage(wr::ToLayoutRect(rect), wr::ToLayoutRect(rect), true,
                         aPipeline->mFilter, keys[0]);
     }
   }
 
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -829,18 +829,17 @@ bool WebRenderBridgeParent::PushExternal
                     << wr::AsUint64(aExtId);
     return false;
   }
 
   if (!gfxEnv::EnableWebRenderRecording()) {
     WebRenderTextureHost* wrTexture = aTexture->AsWebRenderTextureHost();
     if (wrTexture) {
       wrTexture->PushResourceUpdates(aResources, op, keys,
-                                     wrTexture->GetExternalImageKey(),
-                                     /* aPreferCompositorSurface */ false);
+                                     wrTexture->GetExternalImageKey());
       auto it = mTextureHosts.find(wr::AsUint64(aKey));
       MOZ_ASSERT((it == mTextureHosts.end() && !aIsUpdate) ||
                  (it != mTextureHosts.end() && aIsUpdate));
       if (it != mTextureHosts.end()) {
         // Release Texture if it exists.
         ReleaseTextureOfImage(aKey);
       }
       mTextureHosts.emplace(wr::AsUint64(aKey),
--- a/gfx/layers/wr/WebRenderTextureHost.cpp
+++ b/gfx/layers/wr/WebRenderTextureHost.cpp
@@ -191,34 +191,33 @@ bool WebRenderTextureHost::HasIntermedia
 
 uint32_t WebRenderTextureHost::NumSubTextures() {
   MOZ_ASSERT(mWrappedTextureHost);
   return mWrappedTextureHost->NumSubTextures();
 }
 
 void WebRenderTextureHost::PushResourceUpdates(
     wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
-    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID,
-    const bool aPreferCompositorSurface) {
+    const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
   MOZ_ASSERT(mWrappedTextureHost);
   MOZ_ASSERT(mExternalImageId == aExtID);
 
-  mWrappedTextureHost->PushResourceUpdates(aResources, aOp, aImageKeys, aExtID,
-                                           aPreferCompositorSurface);
+  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) {
+    const Range<wr::ImageKey>& aImageKeys,
+    const bool aPreferCompositorSurface) {
   MOZ_ASSERT(mWrappedTextureHost);
   MOZ_ASSERT(aImageKeys.length() > 0);
 
   mWrappedTextureHost->PushDisplayItems(aBuilder, aBounds, aClip, aFilter,
-                                        aImageKeys);
+                                        aImageKeys, aPreferCompositorSurface);
 }
 
 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
--- a/gfx/layers/wr/WebRenderTextureHost.h
+++ b/gfx/layers/wr/WebRenderTextureHost.h
@@ -70,23 +70,23 @@ class WebRenderTextureHost : public Text
 
   bool HasIntermediateBuffer() const override;
 
   uint32_t NumSubTextures() override;
 
   void PushResourceUpdates(wr::TransactionBuilder& aResources,
                            ResourceUpdateOp aOp,
                            const Range<wr::ImageKey>& aImageKeys,
-                           const wr::ExternalImageId& aExtID,
-                           const bool aPreferCompositorSurface) override;
+                           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;
+                        const Range<wr::ImageKey>& aImageKeys,
+                        const bool aPreferCompositorSurface) override;
 
   bool NeedsYFlip() const override;
 
  protected:
   void CreateRenderTextureHost(const SurfaceDescriptor& aDesc,
                                TextureHost* aTexture);
 
   RefPtr<TextureHost> mWrappedTextureHost;
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -479,32 +479,31 @@ bool WebRenderAPI::HitTest(const wr::Wor
 
   if (result) {
     aOutSideBits = ExtractSideBitsFromHitInfoBits(serialized);
     aOutHitInfo.deserialize(serialized);
   }
   return result;
 }
 
-bool WebRenderAPI::FastHitTest(const wr::WorldPoint& aPoint,
-                               wr::WrPipelineId& aOutPipelineId,
-                               layers::ScrollableLayerGuid::ViewID& aOutScrollId,
-                               gfx::CompositorHitTestInfo& aOutHitInfo,
-                               SideBits& aOutSideBits) {
+bool WebRenderAPI::FastHitTest(
+    const wr::WorldPoint& aPoint, wr::WrPipelineId& aOutPipelineId,
+    layers::ScrollableLayerGuid::ViewID& aOutScrollId,
+    gfx::CompositorHitTestInfo& aOutHitInfo, SideBits& aOutSideBits) {
   static_assert(DoesCompositorHitTestInfoFitIntoBits<16>(),
                 "CompositorHitTestFlags MAX value has to be less than number "
                 "of bits in uint16_t");
 
   if (!mFastHitTester) {
     mFastHitTester = wr_api_request_hit_tester(mDocHandle);
   }
 
   uint16_t serialized = static_cast<uint16_t>(aOutHitInfo.serialize());
-  const bool result = wr_hit_tester_hit_test(mFastHitTester, aPoint, &aOutPipelineId,
-                                             &aOutScrollId, &serialized);
+  const bool result = wr_hit_tester_hit_test(
+      mFastHitTester, aPoint, &aOutPipelineId, &aOutScrollId, &serialized);
 
   if (result) {
     aOutSideBits = ExtractSideBitsFromHitInfoBits(serialized);
     aOutHitInfo.deserialize(serialized);
   }
   return result;
 }
 
@@ -1264,23 +1263,24 @@ void DisplayListBuilder::PushConicGradie
                             aIsBackfaceVisible, &mCurrentSpaceAndClipChain,
                             aCenter, aAngle, aStops.Elements(), aStops.Length(),
                             aExtendMode, aTileSize, aTileSpacing);
 }
 
 void DisplayListBuilder::PushImage(
     const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
     bool aIsBackfaceVisible, wr::ImageRendering aFilter, wr::ImageKey aImage,
-    bool aPremultipliedAlpha, const wr::ColorF& aColor) {
+    bool aPremultipliedAlpha, const wr::ColorF& aColor,
+    bool aPreferCompositorSurface) {
   wr::LayoutRect clip = MergeClipLeaf(aClip);
   WRDL_LOG("PushImage b=%s cl=%s\n", mWrState, Stringify(aBounds).c_str(),
            Stringify(clip).c_str());
   wr_dp_push_image(mWrState, aBounds, clip, aIsBackfaceVisible,
                    &mCurrentSpaceAndClipChain, aFilter, aImage,
-                   aPremultipliedAlpha, aColor);
+                   aPremultipliedAlpha, aColor, aPreferCompositorSurface);
 }
 
 void DisplayListBuilder::PushRepeatingImage(
     const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
     bool aIsBackfaceVisible, const wr::LayoutSize& aStretchSize,
     const wr::LayoutSize& aTileSpacing, wr::ImageRendering aFilter,
     wr::ImageKey aImage, bool aPremultipliedAlpha, const wr::ColorF& aColor) {
   wr::LayoutRect clip = MergeClipLeaf(aClip);
@@ -1292,44 +1292,47 @@ void DisplayListBuilder::PushRepeatingIm
       aStretchSize, aTileSpacing, aFilter, aImage, aPremultipliedAlpha, aColor);
 }
 
 void DisplayListBuilder::PushYCbCrPlanarImage(
     const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
     bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
     wr::ImageKey aImageChannel1, wr::ImageKey aImageChannel2,
     wr::WrColorDepth aColorDepth, wr::WrYuvColorSpace aColorSpace,
-    wr::WrColorRange aColorRange, wr::ImageRendering aRendering) {
-  wr_dp_push_yuv_planar_image(
-      mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
-      &mCurrentSpaceAndClipChain, aImageChannel0, aImageChannel1,
-      aImageChannel2, aColorDepth, aColorSpace, aColorRange, aRendering);
+    wr::WrColorRange aColorRange, wr::ImageRendering aRendering,
+    bool aPreferCompositorSurface) {
+  wr_dp_push_yuv_planar_image(mWrState, aBounds, MergeClipLeaf(aClip),
+                              aIsBackfaceVisible, &mCurrentSpaceAndClipChain,
+                              aImageChannel0, aImageChannel1, aImageChannel2,
+                              aColorDepth, aColorSpace, aColorRange, aRendering,
+                              aPreferCompositorSurface);
 }
 
 void DisplayListBuilder::PushNV12Image(
     const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
     bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
     wr::ImageKey aImageChannel1, wr::WrColorDepth aColorDepth,
     wr::WrYuvColorSpace aColorSpace, wr::WrColorRange aColorRange,
-    wr::ImageRendering aRendering) {
-  wr_dp_push_yuv_NV12_image(mWrState, aBounds, MergeClipLeaf(aClip),
-                            aIsBackfaceVisible, &mCurrentSpaceAndClipChain,
-                            aImageChannel0, aImageChannel1, aColorDepth,
-                            aColorSpace, aColorRange, aRendering);
+    wr::ImageRendering aRendering, bool aPreferCompositorSurface) {
+  wr_dp_push_yuv_NV12_image(
+      mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
+      &mCurrentSpaceAndClipChain, aImageChannel0, aImageChannel1, aColorDepth,
+      aColorSpace, aColorRange, aRendering, aPreferCompositorSurface);
 }
 
 void DisplayListBuilder::PushYCbCrInterleavedImage(
     const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
     bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
     wr::WrColorDepth aColorDepth, wr::WrYuvColorSpace aColorSpace,
-    wr::WrColorRange aColorRange, wr::ImageRendering aRendering) {
+    wr::WrColorRange aColorRange, wr::ImageRendering aRendering,
+    bool aPreferCompositorSurface) {
   wr_dp_push_yuv_interleaved_image(
       mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
       &mCurrentSpaceAndClipChain, aImageChannel0, aColorDepth, aColorSpace,
-      aColorRange, aRendering);
+      aColorRange, aRendering, aPreferCompositorSurface);
 }
 
 void DisplayListBuilder::PushIFrame(const wr::LayoutRect& aBounds,
                                     bool aIsBackfaceVisible,
                                     PipelineId aPipeline,
                                     bool aIgnoreMissingPipeline) {
   mRemotePipelineIds.AppendElement(aPipeline);
   wr_dp_push_iframe(mWrState, aBounds, MergeClipLeaf(aBounds),
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -236,21 +236,22 @@ class WebRenderAPI final {
   /// Send a blocking hit-testing query to the render backend thread.
   bool HitTest(const wr::WorldPoint& aPoint, wr::WrPipelineId& aOutPipelineId,
                layers::ScrollableLayerGuid::ViewID& aOutScrollId,
                gfx::CompositorHitTestInfo& aOutHitInfo, SideBits& aOutSideBits);
 
   /// Do a non-blocking hit-testing query on a shared version of the hit testing
   /// information.
   ///
-  /// This does not guarantee ordering between the query and in-flight transactions,
-  /// but only blocks on a synchronous message to the render backend thread the first
-  /// time the function is called.
-  /// This generally returns much faster than `HitTest`.
-  bool FastHitTest(const wr::WorldPoint& aPoint, wr::WrPipelineId& aOutPipelineId,
+  /// This does not guarantee ordering between the query and in-flight
+  /// transactions, but only blocks on a synchronous message to the render
+  /// backend thread the first time the function is called. This generally
+  /// returns much faster than `HitTest`.
+  bool FastHitTest(const wr::WorldPoint& aPoint,
+                   wr::WrPipelineId& aOutPipelineId,
                    layers::ScrollableLayerGuid::ViewID& aOutScrollId,
                    gfx::CompositorHitTestInfo& aOutHitInfo,
                    SideBits& aOutSideBits);
 
   void SendTransaction(TransactionBuilder& aTxn);
 
   void SetFrameStartTime(const TimeStamp& aTime);
 
@@ -521,43 +522,47 @@ class DisplayListBuilder final {
                          const nsTArray<wr::GradientStop>& aStops,
                          wr::ExtendMode aExtendMode,
                          const wr::LayoutSize aTileSize,
                          const wr::LayoutSize aTileSpacing);
 
   void PushImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
                  bool aIsBackfaceVisible, wr::ImageRendering aFilter,
                  wr::ImageKey aImage, bool aPremultipliedAlpha = true,
-                 const wr::ColorF& aColor = wr::ColorF{1.0f, 1.0f, 1.0f, 1.0f});
+                 const wr::ColorF& aColor = wr::ColorF{1.0f, 1.0f, 1.0f, 1.0f},
+                 bool aPreferCompositorSurface = false);
 
   void PushRepeatingImage(
       const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
       bool aIsBackfaceVisible, const wr::LayoutSize& aStretchSize,
       const wr::LayoutSize& aTileSpacing, wr::ImageRendering aFilter,
       wr::ImageKey aImage, bool aPremultipliedAlpha = true,
       const wr::ColorF& aColor = wr::ColorF{1.0f, 1.0f, 1.0f, 1.0f});
 
   void PushYCbCrPlanarImage(
       const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
       bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
       wr::ImageKey aImageChannel1, wr::ImageKey aImageChannel2,
       wr::WrColorDepth aColorDepth, wr::WrYuvColorSpace aColorSpace,
-      wr::WrColorRange aColorRange, wr::ImageRendering aFilter);
+      wr::WrColorRange aColorRange, wr::ImageRendering aFilter,
+      bool aPreferCompositorSurface = false);
 
   void PushNV12Image(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
                      bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
                      wr::ImageKey aImageChannel1, wr::WrColorDepth aColorDepth,
                      wr::WrYuvColorSpace aColorSpace,
-                     wr::WrColorRange aColorRange, wr::ImageRendering aFilter);
+                     wr::WrColorRange aColorRange, wr::ImageRendering aFilter,
+                     bool aPreferCompositorSurface = false);
 
   void PushYCbCrInterleavedImage(
       const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
       bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
       wr::WrColorDepth aColorDepth, wr::WrYuvColorSpace aColorSpace,
-      wr::WrColorRange aColorRange, wr::ImageRendering aFilter);
+      wr::WrColorRange aColorRange, wr::ImageRendering aFilter,
+      bool aPreferCompositorSurface = false);
 
   void PushIFrame(const wr::LayoutRect& aBounds, bool aIsBackfaceVisible,
                   wr::PipelineId aPipeline, bool aIgnoreMissingPipeline);
 
   // XXX WrBorderSides are passed with Range.
   // It is just to bypass compiler bug. See Bug 1357734.
   void PushBorder(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
                   bool aIsBackfaceVisible, const wr::LayoutSideOffsets& aWidths,
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -2697,22 +2697,29 @@ pub extern "C" fn wr_dp_push_iframe(stat
         pipeline_id,
         ignore_missing_pipeline,
     );
 }
 
 // A helper fn to construct a PrimitiveFlags
 fn prim_flags(
     is_backface_visible: bool,
+    prefer_compositor_surface: bool,
 ) -> PrimitiveFlags {
+    let mut flags = PrimitiveFlags::empty();
+
     if is_backface_visible {
-        PrimitiveFlags::IS_BACKFACE_VISIBLE
-    } else {
-        PrimitiveFlags::empty()
+        flags |= PrimitiveFlags::IS_BACKFACE_VISIBLE;
     }
+
+    if prefer_compositor_surface {
+        flags |= PrimitiveFlags::PREFER_COMPOSITOR_SURFACE;
+    }
+
+    flags
 }
 
 fn common_item_properties_for_rect(
     state: &mut WrState,
     rect: LayoutRect,
     clip: LayoutRect,
     is_backface_visible: bool,
     parent: &WrSpaceAndClipChain
@@ -2722,17 +2729,17 @@ fn common_item_properties_for_rect(
 
     CommonItemProperties {
         // NB: the damp-e10s talos-test will frequently crash on startup if we
         // early-return here for empty rects. I couldn't figure out why, but
         // it's pretty harmless to feed these through, so, uh, we do?
         clip_rect: clip_rect.unwrap_or(LayoutRect::zero()),
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     }
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_rect(state: &mut WrState,
                                   rect: LayoutRect,
@@ -2805,17 +2812,17 @@ pub extern "C" fn wr_dp_push_rect_with_p
 
     let clip_rect = clip.intersection(&rect);
     if clip_rect.is_none() { return; }
 
     let prim_info = CommonItemProperties {
         clip_rect: clip_rect.unwrap(),
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_rect(
         &prim_info,
         color,
     );
@@ -2858,17 +2865,17 @@ pub extern "C" fn wr_dp_push_backdrop_fi
 
     let clip_rect = clip.intersection(&rect);
     if clip_rect.is_none() { return; }
 
     let prim_info = CommonItemProperties {
         clip_rect: clip_rect.unwrap(),
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_backdrop_filter(
         &prim_info,
         &filters,
         &filter_datas,
@@ -2887,17 +2894,17 @@ pub extern "C" fn wr_dp_push_clear_rect(
 
     let clip_rect = clip.intersection(&rect);
     if clip_rect.is_none() { return; }
 
     let prim_info = CommonItemProperties {
         clip_rect: clip_rect.unwrap(),
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(true),
+        flags: prim_flags(true, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_clear_rect(
         &prim_info,
     );
 }
@@ -2914,17 +2921,17 @@ pub extern "C" fn wr_dp_push_hit_test(st
 
     let clip_rect = clip.intersection(&rect);
     if clip_rect.is_none() { return; }
 
     let prim_info = CommonItemProperties {
         clip_rect: clip_rect.unwrap(),
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_hit_test(
         &prim_info,
     );
 }
@@ -2942,17 +2949,17 @@ pub extern "C" fn wr_dp_push_clear_rect_
 
     let clip_rect = clip.intersection(&rect);
     if clip_rect.is_none() { return; }
 
     let prim_info = CommonItemProperties {
         clip_rect: clip_rect.unwrap(),
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(true),
+        flags: prim_flags(true, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_clear_rect(
         &prim_info,
     );
 }
@@ -2961,26 +2968,27 @@ pub extern "C" fn wr_dp_push_clear_rect_
 pub extern "C" fn wr_dp_push_image(state: &mut WrState,
                                    bounds: LayoutRect,
                                    clip: LayoutRect,
                                    is_backface_visible: bool,
                                    parent: &WrSpaceAndClipChain,
                                    image_rendering: ImageRendering,
                                    key: WrImageKey,
                                    premultiplied_alpha: bool,
-                                   color: ColorF) {
+                                   color: ColorF,
+                                   prefer_compositor_surface: bool) {
     debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, prefer_compositor_surface),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     let alpha_type = if premultiplied_alpha {
         AlphaType::PremultipliedAlpha
     } else {
         AlphaType::Alpha
@@ -3011,17 +3019,17 @@ pub extern "C" fn wr_dp_push_repeating_i
     debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     let alpha_type = if premultiplied_alpha {
         AlphaType::PremultipliedAlpha
     } else {
         AlphaType::Alpha
@@ -3047,26 +3055,27 @@ pub extern "C" fn wr_dp_push_yuv_planar_
                                               is_backface_visible: bool,
                                               parent: &WrSpaceAndClipChain,
                                               image_key_0: WrImageKey,
                                               image_key_1: WrImageKey,
                                               image_key_2: WrImageKey,
                                               color_depth: WrColorDepth,
                                               color_space: WrYuvColorSpace,
                                               color_range: WrColorRange,
-                                              image_rendering: ImageRendering) {
+                                              image_rendering: ImageRendering,
+                                              prefer_compositor_surface: bool) {
     debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, prefer_compositor_surface),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder
          .dl_builder
          .push_yuv_image(&prim_info,
                          bounds,
@@ -3084,26 +3093,27 @@ pub extern "C" fn wr_dp_push_yuv_NV12_im
                                             clip: LayoutRect,
                                             is_backface_visible: bool,
                                             parent: &WrSpaceAndClipChain,
                                             image_key_0: WrImageKey,
                                             image_key_1: WrImageKey,
                                             color_depth: WrColorDepth,
                                             color_space: WrYuvColorSpace,
                                             color_range: WrColorRange,
-                                            image_rendering: ImageRendering) {
+                                            image_rendering: ImageRendering,
+                                            prefer_compositor_surface: bool) {
     debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, prefer_compositor_surface),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder
          .dl_builder
          .push_yuv_image(&prim_info,
                          bounds,
@@ -3120,26 +3130,27 @@ pub extern "C" fn wr_dp_push_yuv_interle
                                                    bounds: LayoutRect,
                                                    clip: LayoutRect,
                                                    is_backface_visible: bool,
                                                    parent: &WrSpaceAndClipChain,
                                                    image_key_0: WrImageKey,
                                                    color_depth: WrColorDepth,
                                                    color_space: WrYuvColorSpace,
                                                    color_range: WrColorRange,
-                                                   image_rendering: ImageRendering) {
+                                                   image_rendering: ImageRendering,
+                                                   prefer_compositor_surface: bool) {
     debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, prefer_compositor_surface),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder
          .dl_builder
          .push_yuv_image(&prim_info,
                          bounds,
@@ -3166,17 +3177,17 @@ pub extern "C" fn wr_dp_push_text(state:
     let glyph_slice = unsafe { make_slice(glyphs, glyph_count as usize) };
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         spatial_id: space_and_clip.spatial_id,
         clip_id: space_and_clip.clip_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder
          .dl_builder
          .push_text(&prim_info,
                     bounds,
@@ -3223,17 +3234,17 @@ pub extern "C" fn wr_dp_push_line(state:
     debug_assert!(unsafe { is_in_main_thread() });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: *clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder
          .dl_builder
          .push_line(&prim_info,
                     bounds,
@@ -3269,17 +3280,17 @@ pub extern "C" fn wr_dp_push_border(stat
     });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder
          .dl_builder
          .push_border(&prim_info,
                       rect,
@@ -3319,17 +3330,17 @@ pub extern "C" fn wr_dp_push_border_imag
         repeat_vertical: params.repeat_vertical,
     });
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_border(
         &prim_info,
         rect,
         params.widths,
@@ -3378,17 +3389,17 @@ pub extern "C" fn wr_dp_push_border_grad
     });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_border(
         &prim_info,
         rect,
         widths.into(),
@@ -3441,17 +3452,17 @@ pub extern "C" fn wr_dp_push_border_radi
     });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_border(
         &prim_info,
         rect,
         widths.into(),
@@ -3504,17 +3515,17 @@ pub extern "C" fn wr_dp_push_border_coni
     });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_border(
         &prim_info,
         rect,
         widths.into(),
@@ -3548,17 +3559,17 @@ pub extern "C" fn wr_dp_push_linear_grad
                                          extend_mode.into());
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_gradient(
         &prim_info,
         rect,
         gradient,
@@ -3593,17 +3604,17 @@ pub extern "C" fn wr_dp_push_radial_grad
                                                 extend_mode.into());
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_radial_gradient(
         &prim_info,
         rect,
         gradient,
@@ -3637,17 +3648,17 @@ pub extern "C" fn wr_dp_push_conic_gradi
                                                extend_mode.into());
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder.dl_builder.push_conic_gradient(
         &prim_info,
         rect,
         gradient,
@@ -3671,17 +3682,17 @@ pub extern "C" fn wr_dp_push_box_shadow(
     debug_assert!(unsafe { is_in_main_thread() });
 
     let space_and_clip = parent.to_webrender(state.pipeline_id);
 
     let prim_info = CommonItemProperties {
         clip_rect: clip,
         clip_id: space_and_clip.clip_id,
         spatial_id: space_and_clip.spatial_id,
-        flags: prim_flags(is_backface_visible),
+        flags: prim_flags(is_backface_visible, /* prefer_compositor_surface */ false),
         hit_info: state.current_tag,
         item_key: state.current_item_key,
     };
 
     state.frame_builder
          .dl_builder
          .push_box_shadow(&prim_info,
                           box_bounds,