summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2022-08-30 17:10:27 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2022-08-31 08:28:55 +0200
commit4cde507be6a116b3828f3a86a0e97639f04d9046 (patch)
treec70d800bd6f6c3079c0d041be9840417a6f7ce06
parent4990e28ff266e5cce5031bceccdd079f9449149c (diff)
backend-drm: fix plane sorting
The planes in the plane_list must be sorted from largest zpos_max to smallest. Currently the plane order is only correct when the planes are already ordered and added starting with the smallest zpos_max. This works accidentally in most cases because the primary plane is usually first and there is often only one overlay plane or the zpos is sufficiantly configurable. To fix this, insert a new plane before the first plane with a smaller zpos_max. And if none is found, insert it at the end of the list. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--libweston/backend-drm/drm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
index 7d352b9d..962cc284 100644
--- a/libweston/backend-drm/drm.c
+++ b/libweston/backend-drm/drm.c
@@ -840,13 +840,13 @@ drm_plane_create(struct drm_device *device, const drmModePlane *kplane)
weston_plane_init(&plane->base, compositor, 0, 0);
wl_list_for_each(tmp, &device->plane_list, link) {
- if (tmp->zpos_max > plane->zpos_max) {
+ if (tmp->zpos_max < plane->zpos_max) {
wl_list_insert(tmp->link.prev, &plane->link);
break;
}
}
if (plane->link.next == NULL)
- wl_list_insert(&device->plane_list, &plane->link);
+ wl_list_insert(device->plane_list.prev, &plane->link);
return plane;