ValidateDisplay()'s algorithm for achieving minimal GPU load assumes that the lowest z-order is zero and that layers have sequential z-orders. CalcPixOps() and MarkValidated() are also written with the same assumption. However, there is no such guarantee provided by SurfaceFlinger and VTS tests like PRESENT_DISPLAY_NO_LAYER_STATE_CHANGES fail as they only have one layer with z-order of 10.
Normalise the mapping between layers and z-order so that the algorithm works as intended.
Signed-off-by: Liviu Dudau email@example.com Fixes commit b7b81cfb ("drm_hwcomposer: Choose client layer range to achieve minimal GPU load") Signed-off-by: John Stultz firstname.lastname@example.org Change-Id: I71b76b9d151bf506ad6026f5b1f9de6b6c0dc7c1