Skip to main content

stack_zpos

Function stack_zpos 

Source
pub fn stack_zpos(entries: &mut [StackEntry<'_>]) -> bool
Expand description

Number the armed planes’ zpos densely, in requested order.

A mutable plane gets max(previous + 1, zpos_min); a fixed-slot plane keeps its slot. Only the planes actually armed take values, so layers that end up composited do not use up the range, and the stack stays clear of its top, which some controllers advertise but refuse (the SA8155P advertises [0, 10] and rejects 9 and 10 even on a lone plane). Ties are broken by plane id, except that a below_ties entry goes under the others. Order is preserved, so stacking_consistent’s rulings stand.

Greedy-lowest is optimal, so when it overflows a plane’s zpos_max, or meets a fixed slot at or below the previous value, no dense numbering exists: every written is left equal to requested and this returns false. Entries with no requested zpos or no zpos range are not numbered.