Skip to content

drm/atomic: Stable sort for atomic request de-duplication

Daniel Stone requested to merge daniels/drm:atomic-stable-sort into main

Atomic request property lists are defined to be de-duplicated: an atomic request can contain multiple sets for the same property on the same object, and only the last one will take effect.

drmModeAtomicCommit already sorts the property set by object and property ID. We were relying on qsort to also sort by cursor - i.e. pointer value - when object and property ID are equal, however whilst glibc does this, the sort order is explicitly undefined when the comparator is equal. Using the pointer is also not stable on all implementations.

Add an explicit 'cursor' member to each property set which is used as the tie-breaker comparator.

Signed-off-by: Daniel Stone daniels@collabora.com

Fixes: #46 (closed)

Edited by Daniel Stone

Merge request reports