drm_hwcomposer: reorder source layers according to zorder
Precomp layers may be added to the back at different points which may
cause elements to be unsorted. Make sure that these are sorted after
provisioning planes to ensure right composition based on zorder.
Bug: 65587393
Change-Id: Ica6d12093818341eaeca6c63735c558511679f7b
Signed-off-by: Adrian Salido <salidoa@google.com>
diff --git a/drmdisplaycomposition.cpp b/drmdisplaycomposition.cpp
index 949f4a3..b7f8d1a 100644
--- a/drmdisplaycomposition.cpp
+++ b/drmdisplaycomposition.cpp
@@ -375,6 +375,9 @@
if (!i.plane())
continue;
+ // make sure that source layers are ordered based on zorder
+ std::sort(i.source_layers().begin(), i.source_layers().end());
+
std::vector<DrmPlane *> *container;
if (i.plane()->type() == DRM_PLANE_TYPE_PRIMARY)
container = primary_planes;