[PATCH hwc] drm_hwcomposer: make sure primary plane is allocated for squash

Adrian Salido salidoa at google.com
Mon Oct 2 18:31:27 UTC 2017


There are instances where the primary plane may have been disabled, look
through disabled planes as well to find primary plane to use for squash.

Signed-off-by: Adrian Salido <salidoa at google.com>
---
 drmdisplaycompositor.cpp | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index a07d3588d1f5..80e3eba60ccf 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -933,10 +933,13 @@ int DrmDisplayCompositor::SquashFrame(DrmDisplayComposition *src,
       goto move_layers_back;
     }
 
-    if (comp_plane.type() == DrmCompositionPlane::Type::kDisable) {
+    if (comp_plane.plane()->type() == DRM_PLANE_TYPE_PRIMARY)
+      squashed_comp.set_plane(comp_plane.plane());
+    else
       dst->AddPlaneDisable(comp_plane.plane());
+
+    if (comp_plane.type() == DrmCompositionPlane::Type::kDisable)
       continue;
-    }
 
     for (auto i : comp_plane.source_layers()) {
       DrmHwcLayer &layer = src_layers[i];
@@ -955,11 +958,12 @@ int DrmDisplayCompositor::SquashFrame(DrmDisplayComposition *src,
       squashed_comp.source_layers().push_back(
           squashed_comp.source_layers().size());
     }
+  }
 
-    if (comp_plane.plane()->type() == DRM_PLANE_TYPE_PRIMARY)
-      squashed_comp.set_plane(comp_plane.plane());
-    else
-      dst->AddPlaneDisable(comp_plane.plane());
+  if (squashed_comp.plane() == NULL) {
+    ALOGE("Primary plane not found for squash");
+    ret = -ENOTSUP;
+    goto move_layers_back;
   }
 
   ret = dst->SetLayers(dst_layers.data(), dst_layers.size(), false);
-- 
2.14.2.822.g60be5d43e6-goog



More information about the dri-devel mailing list