Bug 1434503 - Round video frame images bounds to device pixel boundaries before passing to WebRender. r=sotaro
authorChris Pearce <cpearce@mozilla.com>
Wed, 26 Sep 2018 00:18:21 +0000
changeset 438225 db833c9360407670f3fbaf0db668eb5a5c05d2ff
parent 438224 44ec48f51186608486aa55ed29f75daad0e2930c
child 438226 5d624ee1b23d29116055ca149d24e8b95b086d91
push id34712
push useraiakab@mozilla.com
push dateWed, 26 Sep 2018 12:35:23 +0000
treeherdermozilla-central@cfe90e5953d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1434503
milestone64.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 1434503 - Round video frame images bounds to device pixel boundaries before passing to WebRender. r=sotaro When scrolling on Twitter video frames can sometimes be drawn with a flicker above or below them. This is because the bounds for video frames' images that we pass to WebRender are not rounded to pixel boundaries, and so they can end up being rounded off in WebRender unexpectedly when composited. So round off the bounds of video frame images to device pixel boundaries before passing to WebRender. Differential Revision: https://phabricator.services.mozilla.com/D6857
gfx/layers/wr/AsyncImagePipelineManager.cpp
--- a/gfx/layers/wr/AsyncImagePipelineManager.cpp
+++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ -376,17 +376,17 @@ AsyncImagePipelineManager::ApplyAsyncIma
 
   aPipeline->mIsChanged = false;
 
   wr::LayoutSize contentSize { aPipeline->mScBounds.Width(), aPipeline->mScBounds.Height() };
   wr::DisplayListBuilder builder(aPipelineId, contentSize);
 
   float opacity = 1.0f;
   Maybe<wr::WrClipId> referenceFrameId = builder.PushStackingContext(
-    wr::ToLayoutRect(aPipeline->mScBounds),
+    wr::ToRoundedLayoutRect(aPipeline->mScBounds),
     nullptr,
     nullptr,
     &opacity,
     aPipeline->mScTransform.IsIdentity() ? nullptr : &aPipeline->mScTransform,
     wr::TransformStyle::Flat,
     nullptr,
     aPipeline->mMixBlendMode,
     nsTArray<wr::WrFilterOp>(),
@@ -399,25 +399,25 @@ AsyncImagePipelineManager::ApplyAsyncIma
     if (aPipeline->mScaleToSize.isSome()) {
       rect = LayoutDeviceRect(0, 0, aPipeline->mScaleToSize.value().width, 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),
+                                                  wr::ToRoundedLayoutRect(rect),
+                                                  wr::ToRoundedLayoutRect(rect),
                                                   aPipeline->mFilter,
                                                   range_keys);
       HoldExternalImage(aPipelineId, aEpoch, aPipeline->mCurrentTexture->AsWebRenderTextureHost());
     } else {
       MOZ_ASSERT(keys.Length() == 1);
-      builder.PushImage(wr::ToLayoutRect(rect),
-                        wr::ToLayoutRect(rect),
+      builder.PushImage(wr::ToRoundedLayoutRect(rect),
+                        wr::ToRoundedLayoutRect(rect),
                         true,
                         aPipeline->mFilter,
                         keys[0]);
     }
   }
 
   builder.PopStackingContext(referenceFrameId.isSome());