Bug 993160 - Use GPU for children of container which needs intermediate surface. r=dwilson, a=1.4+
authorSushil Chauhan <sushilchauhan@codeaurora.org>
Mon, 14 Apr 2014 16:39:53 -0700
changeset 192882 73704c34b2fd9b9c3bb7451bb8578899a9c6b15e
parent 192881 7a869c7d9b191849a551ecac7b7b1b5dfc59f484
child 192883 368e886d71bcf4d8d79bd8714dddc6baf95b5533
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdwilson, 1
bugs993160
milestone30.0a2
Bug 993160 - Use GPU for children of container which needs intermediate surface. r=dwilson, a=1.4+
widget/gonk/HwcComposer2D.cpp
--- a/widget/gonk/HwcComposer2D.cpp
+++ b/widget/gonk/HwcComposer2D.cpp
@@ -237,20 +237,16 @@ HwcComposer2D::PrepareLayerList(Layer* a
 
     if (!transform3D.Is2D(&transform) || !transform.PreservesAxisAlignedRectangles()) {
         LOGD("Layer has a 3D transform or a non-square angle rotation");
         return false;
     }
 
 
     if (ContainerLayer* container = aLayer->AsContainerLayer()) {
-        if (container->UseIntermediateSurface()) {
-            LOGD("Container layer needs intermediate surface");
-            return false;
-        }
         nsAutoTArray<Layer*, 12> children;
         container->SortChildrenBy3DZOrder(children);
 
         for (uint32_t i = 0; i < children.Length(); i++) {
             if (!PrepareLayerList(children[i], clip, transform, aGLWorldTransform)) {
                 return false;
             }
         }
@@ -325,22 +321,34 @@ HwcComposer2D::PrepareLayerList(Layer* a
     if (!mList || current >= mMaxLayerCount) {
         if (!ReallocLayerList() || current >= mMaxLayerCount) {
             LOGE("PrepareLayerList failed! Could not increase the maximum layer count");
             return false;
         }
     }
 
     HwcLayer& hwcLayer = mList->hwLayers[current];
+    hwcLayer.flags = 0;
+
+    if (ContainerLayer* parent = aLayer->GetParent()) {
+        if (parent->UseIntermediateSurface()) {
+            LOGD("Parent container needs intermediate surface");
+            hwcLayer.flags = HWC_SKIP_LAYER;
+#if ANDROID_VERSION < 18
+            // No partial HWC Composition on older versions
+            return false;
+#endif
+        }
+    }
+
     hwcLayer.displayFrame = displayFrame;
     setCrop(&hwcLayer, sourceCrop);
     buffer_handle_t handle = fillColor ? nullptr : state.mSurface->getNativeBuffer()->handle;
     hwcLayer.handle = handle;
 
-    hwcLayer.flags = 0;
     hwcLayer.hints = 0;
     hwcLayer.blending = isOpaque ? HWC_BLENDING_NONE : HWC_BLENDING_PREMULT;
 #if ANDROID_VERSION >= 17
     hwcLayer.compositionType = HWC_FRAMEBUFFER;
 
     hwcLayer.acquireFenceFd = -1;
     hwcLayer.releaseFenceFd = -1;
 #if ANDROID_VERSION >= 18