Bug 1078189 - Back out bug 1059023 for causing regression. r=dwilson
authorSushil Chauhan <sushilchauhan@codeaurora.org>
Mon, 06 Oct 2014 16:28:46 -0700
changeset 232323 a672893cedcaaa4c79fa224ad70514172ec56107
parent 232321 cd1935deb8af22feec01f9e7b0d09a9c1f8a8a3b
child 232324 0db99022584b0eaf62367c435379c2b15bc39b1f
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdwilson
bugs1078189, 1059023
milestone35.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 1078189 - Back out bug 1059023 for causing regression. r=dwilson
widget/gonk/HwcComposer2D.cpp
widget/gonk/HwcUtils.cpp
widget/gonk/HwcUtils.h
--- a/widget/gonk/HwcComposer2D.cpp
+++ b/widget/gonk/HwcComposer2D.cpp
@@ -438,31 +438,27 @@ HwcComposer2D::PrepareLayerList(Layer* a
                           &(displayFrame)))
     {
         return true;
     }
 
     // OK!  We can compose this layer with hwc.
     int current = mList ? mList->numHwLayers : 0;
 
+    // Do not compose any layer below full-screen Opaque layer
+    // Note: It can be generalized to non-fullscreen Opaque layers.
     bool isOpaque = (opacity == 0xFF) && (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
     if (current && isOpaque) {
-        nsIntRect displayRect = HwcUtils::HwcToIntRect(displayFrame);
+        nsIntRect displayRect = nsIntRect(displayFrame.left, displayFrame.top,
+            displayFrame.right - displayFrame.left, displayFrame.bottom - displayFrame.top);
         if (displayRect.Contains(mScreenRect)) {
-            // In z-order, all previous layers are below current layer
-            // Do not compose any layer below full-screen opaque layer
+            // In z-order, all previous layers are below
+            // the current layer. We can ignore them now.
             mList->numHwLayers = current = 0;
             mHwcLayerMap.Clear();
-        } else {
-            nsIntRect rect = HwcUtils::HwcToIntRect(mList->hwLayers[current-1].displayFrame);
-            if (displayRect.Contains(rect)) {
-                // Do not compose layer hidden under the opaque layer
-                mHwcLayerMap.RemoveElementAt(current-1);
-                current = --mList->numHwLayers;
-            }
         }
     }
 
     if (!mList || current >= mMaxLayerCount) {
         if (!ReallocLayerList() || current >= mMaxLayerCount) {
             LOGE("PrepareLayerList failed! Could not increase the maximum layer count");
             return false;
         }
--- a/widget/gonk/HwcUtils.cpp
+++ b/widget/gonk/HwcUtils.cpp
@@ -141,15 +141,9 @@ HwcUtils::CalculateClipRect(const gfx::M
     gfxRect trClip = aTransform.TransformBounds(r);
     trClip.Round();
     gfxUtils::GfxRectToIntRect(trClip, &clip);
 
     aRenderClip->IntersectRect(*aRenderClip, clip);
     return true;
 }
 
-nsIntRect
-HwcUtils::HwcToIntRect(hwc_rect_t aRect) {
-    return nsIntRect(aRect.left, aRect.top, aRect.right - aRect.left,
-                aRect.bottom - aRect.top);
-}
-
 } // namespace mozilla
--- a/widget/gonk/HwcUtils.h
+++ b/widget/gonk/HwcUtils.h
@@ -113,16 +113,13 @@ static bool PrepareVisibleRegion(const n
  *         false if the layer can be skipped
  */
 static bool PrepareLayerRects(nsIntRect aVisible, const gfx::Matrix& aTransform,
                               nsIntRect aClip, nsIntRect aBufferRect,
                               bool aYFlipped,
                               hwc_rect_t* aSourceCrop,
                               hwc_rect_t* aVisibleRegionScreen);
 
-/* Converts hwc_rect_t to nsIntRect */
-static nsIntRect HwcToIntRect(hwc_rect_t aRect);
-
 };
 
 } // namespace mozilla
 
 #endif // mozilla_HwcUtils