Skip to contentSkip to conversation

Backport some sanity patches for weston

PATCH Superseded [email protected] 3 participants 5 messages Feb 15, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Backport some sanity patches for weston

From: Randolph Sapp <[email protected]>

Backport some sanity patches from newer versions of Weston that fix issues related to display systems that have primary and overlay planes with mutable zpos.

Older versions of Weston never attempted to force primary planes to zpos 0 or check to make sure overlay planes were ordered in such a way that prevented z-fighting. These patches are backported from newer versions for use with Kirkstone's locked version of Weston. They have all already been upstreamed.

Randolph Sapp (2):
weston: backport patches related to plane positioning
weston: include backported patches in bbappend

 ...kend-drm-Pre-sort-plane-list-by-zpos.patch | 48 +++++++++++++++
 .../0002-backend-drm-fix-plane-sorting.patch  | 38 ++++++++++++
 ...mber-to-set-the-zpos-for-the-scanout.patch | 33 +++++++++++
 ...Assign-plane_idx-by-plane-list-order.patch | 58 +++++++++++++++++++
 .../wayland/weston_10.0.2.bbappend            |  4 ++
 5 files changed, 181 insertions(+)
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0001-backend-drm-Pre-sort-plane-list-by-zpos.patch
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0002-backend-drm-fix-plane-sorting.patch
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0003-drm-backend-Remember-to-set-the-zpos-for-the-scanout.patch
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0004-backend-drm-Assign-plane_idx-by-plane-list-order.patch
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 weston: backport patches related to plane positioning

From: Randolph Sapp <[email protected]>

Backport some sanity patches related to plane ordering and positioning. These are all mandatory for display subsystems that allow primary and overlay mutable zpos.

Otherwise Weston will attempt to place sprite/overlay planes above whatever active primary plane it chooses for scanout, running into issues if the primary plane is above zpos 0 and there isn't enough headroom.

They have all already been accepted upstream already and are only necessary for Kirkstone's version of Weston.

---
 ...kend-drm-Pre-sort-plane-list-by-zpos.patch | 48 +++++++++++++++
 .../0002-backend-drm-fix-plane-sorting.patch  | 38 ++++++++++++
 ...mber-to-set-the-zpos-for-the-scanout.patch | 33 +++++++++++
 ...Assign-plane_idx-by-plane-list-order.patch | 58 +++++++++++++++++++
 4 files changed, 177 insertions(+)
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0001-backend-drm-Pre-sort-plane-list-by-zpos.patch
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0002-backend-drm-fix-plane-sorting.patch
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0003-drm-backend-Remember-to-set-the-zpos-for-the-scanout.patch
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0004-backend-drm-Assign-plane_idx-by-plane-list-order.patch
meta-arago-distro/recipes-graphics/wayland/weston/0001-backend-drm-Pre-sort-plane-list-by-zpos.patch new file +48 -0
new file mode 100644
index 00000000..04ae08f5
@@ -0,0 +1,48 @@
+From 9d2fda2a77cfa0932b2cef9af59033c187ec21d7 Mon Sep 17 00:00:00 2001
+From: Daniel Stone <[email protected]>
+Date: Tue, 7 Dec 2021 15:55:42 +0000
+Subject: [PATCH 1/3] backend-drm: Pre-sort plane list by zpos
+
+Rather than constructing a zpos-sorted list every time, just have
+plane_list be pre-sorted.
+
+Backport: 6609840479934a1145372e8a850592eeffbdaf83
+
+Signed-off-by: Daniel Stone <[email protected]>
+---
+ libweston/backend-drm/drm.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 42787702..102fa2d7 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -760,7 +760,7 @@ init_pixman(struct drm_backend *b)
+ static struct drm_plane *
+ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ {
+-	struct drm_plane *plane;
++	struct drm_plane *plane, *tmp;
+ 	drmModeObjectProperties *props;
+ 	uint64_t *zpos_range_values;
+
+@@ -817,7 +817,15 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ 		goto err_props;
+
+ 	weston_plane_init(&plane->base, b->compositor, 0, 0);
+-	wl_list_insert(&b->plane_list, &plane->link);
++
++	wl_list_for_each(tmp, &b->plane_list, link) {
++		if (tmp->zpos_max > plane->zpos_max) {
++			wl_list_insert(tmp->link.prev, &plane->link);
++			break;
++		}
++	}
++	if (plane->link.next == NULL)
++		wl_list_insert(b->plane_list.prev, &plane->link);
+
+ 	return plane;
+
+--
+2.43.0
+
meta-arago-distro/recipes-graphics/wayland/weston/0002-backend-drm-fix-plane-sorting.patch new file +38 -0
new file mode 100644
index 00000000..cd9a8c5e
@@ -0,0 +1,38 @@
+From 450987334af6546b62aa8f5cce8a4c1b07fe5a5e Mon Sep 17 00:00:00 2001
+From: Michael Olbrich <[email protected]>
+Date: Tue, 30 Aug 2022 17:10:27 +0200
+Subject: [PATCH 2/3] 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.
+
+Backport: 4cde507be6a116b3828f3a86a0e97639f04d9046
+
+Signed-off-by: Michael Olbrich <[email protected]>
+---
+ libweston/backend-drm/drm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 102fa2d7..4c18f76c 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -819,7 +819,7 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ 	weston_plane_init(&plane->base, b->compositor, 0, 0);
+
+ 	wl_list_for_each(tmp, &b->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;
+ 		}
+--
+2.43.0
+
meta-arago-distro/recipes-graphics/wayland/weston/0003-drm-backend-Remember-to-set-the-zpos-for-the-scanout.patch new file +33 -0
new file mode 100644
index 00000000..eaf074e8
@@ -0,0 +1,33 @@
+From 84a7c7a7317b0cfd3a34557351041b560645a002 Mon Sep 17 00:00:00 2001
+From: Derek Foreman <[email protected]>
+Date: Tue, 31 Jan 2023 10:11:42 -0600
+Subject: [PATCH 3/3] drm-backend: Remember to set the zpos for the scanout
+ plane
+
+We can clear this via drm_plane_state_put_back() at the end of
+drm_output_propose_state(). We need to set it back to the minimum zpos
+when rendering.
+
+Backport: 58dde0e0c0000f1430624ee2fbf12886774ccd40
+
+Signed-off-by: Derek Foreman <[email protected]>
+---
+ libweston/backend-drm/drm.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 4c18f76c..67d471aa 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -404,6 +404,8 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage)
+ 	scanout_state->dest_w = output->base.current_mode->width;
+ 	scanout_state->dest_h = output->base.current_mode->height;
+
++	scanout_state->zpos = scanout_plane->zpos_min;
++
+ 	pixman_region32_subtract(&c->primary_plane.damage,
+ 				 &c->primary_plane.damage, damage);
+
+--
+2.43.0
+
meta-arago-distro/recipes-graphics/wayland/weston/0004-backend-drm-Assign-plane_idx-by-plane-list-order.patch new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

Re: [meta-arago][kirkstone][PATCH 1/2] weston: backport patches related to plane positioning

Missing Upstream-Status?

Quoted 229 lines · Randolph Sapp via lists.yoctoproject.org

From: Randolph Sapp <[email protected]>

Backport some sanity patches related to plane ordering and positioning. These are all mandatory for display subsystems that allow primary and overlay mutable zpos.

Otherwise Weston will attempt to place sprite/overlay planes above whatever active primary plane it chooses for scanout, running into issues if the primary plane is above zpos 0 and there isn't enough headroom.

They have all already been accepted upstream already and are only necessary for Kirkstone's version of Weston.

---
 ...kend-drm-Pre-sort-plane-list-by-zpos.patch | 48 +++++++++++++++
 .../0002-backend-drm-fix-plane-sorting.patch  | 38 ++++++++++++
 ...mber-to-set-the-zpos-for-the-scanout.patch | 33 +++++++++++
 ...Assign-plane_idx-by-plane-list-order.patch | 58 +++++++++++++++++++
 4 files changed, 177 insertions(+)
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0001-backend-drm-Pre-sort-plane-list-by-zpos.patch
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0002-backend-drm-fix-plane-sorting.patch
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0003-drm-backend-Remember-to-set-the-zpos-for-the-scanout.patch
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0004-backend-drm-Assign-plane_idx-by-plane-list-order.patch
meta-arago-distro/recipes-graphics/wayland/weston/0001-backend-drm-Pre-sort-plane-list-by-zpos.patch new file +48 -0
new file mode 100644
index 00000000..04ae08f5
@@ -0,0 +1,48 @@
+From 9d2fda2a77cfa0932b2cef9af59033c187ec21d7 Mon Sep 17 00:00:00 2001
+From: Daniel Stone <[email protected]>
+Date: Tue, 7 Dec 2021 15:55:42 +0000
+Subject: [PATCH 1/3] backend-drm: Pre-sort plane list by zpos
+
+Rather than constructing a zpos-sorted list every time, just have
+plane_list be pre-sorted.
+
+Backport: 6609840479934a1145372e8a850592eeffbdaf83
+
+Signed-off-by: Daniel Stone <[email protected]>
+---
+ libweston/backend-drm/drm.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 42787702..102fa2d7 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -760,7 +760,7 @@ init_pixman(struct drm_backend *b)
+ static struct drm_plane *
+ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ {
+-	struct drm_plane *plane;
++	struct drm_plane *plane, *tmp;
+ 	drmModeObjectProperties *props;
+ 	uint64_t *zpos_range_values;
+
+@@ -817,7 +817,15 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ 		goto err_props;
+
+ 	weston_plane_init(&plane->base, b->compositor, 0, 0);
+-	wl_list_insert(&b->plane_list, &plane->link);
++
++	wl_list_for_each(tmp, &b->plane_list, link) {
++		if (tmp->zpos_max > plane->zpos_max) {
++			wl_list_insert(tmp->link.prev, &plane->link);
++			break;
++		}
++	}
++	if (plane->link.next == NULL)
++		wl_list_insert(b->plane_list.prev, &plane->link);
+
+ 	return plane;
+
+--
+2.43.0
+
meta-arago-distro/recipes-graphics/wayland/weston/0002-backend-drm-fix-plane-sorting.patch new file +38 -0
new file mode 100644
index 00000000..cd9a8c5e
@@ -0,0 +1,38 @@
+From 450987334af6546b62aa8f5cce8a4c1b07fe5a5e Mon Sep 17 00:00:00 2001
+From: Michael Olbrich <[email protected]>
+Date: Tue, 30 Aug 2022 17:10:27 +0200
+Subject: [PATCH 2/3] 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.
+
+Backport: 4cde507be6a116b3828f3a86a0e97639f04d9046
+
+Signed-off-by: Michael Olbrich <[email protected]>
+---
+ libweston/backend-drm/drm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 102fa2d7..4c18f76c 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -819,7 +819,7 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ 	weston_plane_init(&plane->base, b->compositor, 0, 0);
+
+ 	wl_list_for_each(tmp, &b->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;
+ 		}
+--
+2.43.0
+
meta-arago-distro/recipes-graphics/wayland/weston/0003-drm-backend-Remember-to-set-the-zpos-for-the-scanout.patch new file +33 -0
new file mode 100644
index 00000000..eaf074e8
@@ -0,0 +1,33 @@
+From 84a7c7a7317b0cfd3a34557351041b560645a002 Mon Sep 17 00:00:00 2001
+From: Derek Foreman <[email protected]>
+Date: Tue, 31 Jan 2023 10:11:42 -0600
+Subject: [PATCH 3/3] drm-backend: Remember to set the zpos for the scanout
+ plane
+
+We can clear this via drm_plane_state_put_back() at the end of
+drm_output_propose_state(). We need to set it back to the minimum zpos
+when rendering.
+
+Backport: 58dde0e0c0000f1430624ee2fbf12886774ccd40
+
+Signed-off-by: Derek Foreman <[email protected]>
+---
+ libweston/backend-drm/drm.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 4c18f76c..67d471aa 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -404,6 +404,8 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage)
+ 	scanout_state->dest_w = output->base.current_mode->width;
+ 	scanout_state->dest_h = output->base.current_mode->height;
+
++	scanout_state->zpos = scanout_plane->zpos_min;
++
+ 	pixman_region32_subtract(&c->primary_plane.damage,
+ 				 &c->primary_plane.damage, damage);
+
+--
+2.43.0
+
meta-arago-distro/recipes-graphics/wayland/weston/0004-backend-drm-Assign-plane_idx-by-plane-list-order.patch new file +58 -0
new file mode 100644
index 00000000..ae76af7f
@@ -0,0 +1,58 @@
+From af42fc1e336748b4e401e4441729dd79914425e6 Mon Sep 17 00:00:00 2001
+From: Daniel Stone <[email protected]>
+Date: Tue, 7 Dec 2021 15:58:49 +0000
+Subject: [PATCH] backend-drm: Assign plane_idx by plane list order
+
+Backport: af42fc1e336748b4e401e4441729dd79914425e6
+
+Signed-off-by: Daniel Stone <[email protected]>
+---
+ libweston/backend-drm/drm-internal.h | 1 -
+ libweston/backend-drm/drm.c          | 5 ++++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h
+index 55e9414b..86d7368e 100644
+--- a/libweston/backend-drm/drm-internal.h
++++ b/libweston/backend-drm/drm-internal.h
+@@ -276,7 +276,6 @@ struct drm_backend {
+ 	int min_height, max_height;
+ 
+ 	struct wl_list plane_list;
+-	uint32_t next_plane_idx;
+ 
+ 	void *repaint_data;
+ 
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 102fa2d7..203b8a4e 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -771,7 +771,6 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ 	}
+ 
+ 	plane->backend = b;
+-	plane->plane_idx = b->next_plane_idx++;
+ 	plane->state_cur = drm_plane_state_alloc(NULL, plane);
+ 	plane->state_cur->complete = true;
+ 	plane->possible_crtcs = kplane->possible_crtcs;
+@@ -919,6 +918,7 @@ create_sprites(struct drm_backend *b)
+ 	drmModePlane *kplane;
+ 	struct drm_plane *drm_plane;
+ 	uint32_t i;
++	uint32_t next_plane_idx = 0;
+ 	kplane_res = drmModeGetPlaneResources(b->drm.fd);
+ 	if (!kplane_res) {
+ 		weston_log("failed to get plane resources: %s\n",
+@@ -942,6 +942,9 @@ create_sprites(struct drm_backend *b)
+ 						      &b->compositor->primary_plane);
+ 	}
+ 
++	wl_list_for_each (drm_plane, &b->plane_list, link)
++		drm_plane->plane_idx = next_plane_idx++;
++
+ 	drmModeFreePlaneResources(kplane_res);
+ }
+ 
+-- 
+2.43.0
+
Signature · 1 line
2.43.0
#3 lore raw

Re: [meta-arago][kirkstone][PATCH 1/2] weston: backport patches related to plane positioning

Yes. We need to get into the habit of adding the Upstream-Status to these patches, even if kirkstone does not require them. Master and scarthgap do, so let's get into the habit.

Quoted 232 lines · Denys Dmytriyenko

Missing Upstream-Status?

Quoted 229 lines · Randolph Sapp via lists.yoctoproject.org

From: Randolph Sapp <[email protected]>

Backport some sanity patches related to plane ordering and positioning. These are all mandatory for display subsystems that allow primary and overlay mutable zpos.

Otherwise Weston will attempt to place sprite/overlay planes above whatever active primary plane it chooses for scanout, running into issues if the primary plane is above zpos 0 and there isn't enough headroom.

They have all already been accepted upstream already and are only necessary for Kirkstone's version of Weston.

---
  ...kend-drm-Pre-sort-plane-list-by-zpos.patch | 48 +++++++++++++++
  .../0002-backend-drm-fix-plane-sorting.patch  | 38 ++++++++++++
  ...mber-to-set-the-zpos-for-the-scanout.patch | 33 +++++++++++
  ...Assign-plane_idx-by-plane-list-order.patch | 58 +++++++++++++++++++
  4 files changed, 177 insertions(+)

create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0001-backend-drm-Pre-sort-plane-list-by-zpos.patch create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0002-backend-drm-fix-plane-sorting.patch create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0003-drm-backend-Remember-to-set-the-zpos-for-the-scanout.patch create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0004-backend-drm-Assign-plane_idx-by-plane-list-order.patch

meta-arago-distro/recipes-graphics/wayland/weston/0001-backend-drm-Pre-sort-plane-list-by-zpos.patch new file +48 -0
new file mode 100644
index 00000000..04ae08f5
@@ -0,0 +1,48 @@
+From 9d2fda2a77cfa0932b2cef9af59033c187ec21d7 Mon Sep 17 00:00:00 2001
+From: Daniel Stone <[email protected]>
+Date: Tue, 7 Dec 2021 15:55:42 +0000
+Subject: [PATCH 1/3] backend-drm: Pre-sort plane list by zpos
+
+Rather than constructing a zpos-sorted list every time, just have
+plane_list be pre-sorted.
+
+Backport: 6609840479934a1145372e8a850592eeffbdaf83
+
+Signed-off-by: Daniel Stone <[email protected]>
+---
+ libweston/backend-drm/drm.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 42787702..102fa2d7 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -760,7 +760,7 @@ init_pixman(struct drm_backend *b)
+ static struct drm_plane *
+ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ {
+-	struct drm_plane *plane;
++	struct drm_plane *plane, *tmp;
+ 	drmModeObjectProperties *props;
+ 	uint64_t *zpos_range_values;
+
+@@ -817,7 +817,15 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ 		goto err_props;
+
+ 	weston_plane_init(&plane->base, b->compositor, 0, 0);
+-	wl_list_insert(&b->plane_list, &plane->link);
++
++	wl_list_for_each(tmp, &b->plane_list, link) {
++		if (tmp->zpos_max > plane->zpos_max) {
++			wl_list_insert(tmp->link.prev, &plane->link);
++			break;
++		}
++	}
++	if (plane->link.next == NULL)
++		wl_list_insert(b->plane_list.prev, &plane->link);
+
+ 	return plane;
+
+--
+2.43.0
+
meta-arago-distro/recipes-graphics/wayland/weston/0002-backend-drm-fix-plane-sorting.patch new file +38 -0
new file mode 100644
index 00000000..cd9a8c5e
@@ -0,0 +1,38 @@
+From 450987334af6546b62aa8f5cce8a4c1b07fe5a5e Mon Sep 17 00:00:00 2001
+From: Michael Olbrich <[email protected]>
+Date: Tue, 30 Aug 2022 17:10:27 +0200
+Subject: [PATCH 2/3] 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.
+
+Backport: 4cde507be6a116b3828f3a86a0e97639f04d9046
+
+Signed-off-by: Michael Olbrich <[email protected]>
+---
+ libweston/backend-drm/drm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 102fa2d7..4c18f76c 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -819,7 +819,7 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ 	weston_plane_init(&plane->base, b->compositor, 0, 0);
+
+ 	wl_list_for_each(tmp, &b->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;
+ 		}
+--
+2.43.0
+
meta-arago-distro/recipes-graphics/wayland/weston/0003-drm-backend-Remember-to-set-the-zpos-for-the-scanout.patch new file +33 -0
new file mode 100644
index 00000000..eaf074e8
@@ -0,0 +1,33 @@
+From 84a7c7a7317b0cfd3a34557351041b560645a002 Mon Sep 17 00:00:00 2001
+From: Derek Foreman <[email protected]>
+Date: Tue, 31 Jan 2023 10:11:42 -0600
+Subject: [PATCH 3/3] drm-backend: Remember to set the zpos for the scanout
+ plane
+
+We can clear this via drm_plane_state_put_back() at the end of
+drm_output_propose_state(). We need to set it back to the minimum zpos
+when rendering.
+
+Backport: 58dde0e0c0000f1430624ee2fbf12886774ccd40
+
+Signed-off-by: Derek Foreman <[email protected]>
+---
+ libweston/backend-drm/drm.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 4c18f76c..67d471aa 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -404,6 +404,8 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage)
+ 	scanout_state->dest_w = output->base.current_mode->width;
+ 	scanout_state->dest_h = output->base.current_mode->height;
+
++	scanout_state->zpos = scanout_plane->zpos_min;
++
+ 	pixman_region32_subtract(&c->primary_plane.damage,
+ 				 &c->primary_plane.damage, damage);
+
+--
+2.43.0
+
meta-arago-distro/recipes-graphics/wayland/weston/0004-backend-drm-Assign-plane_idx-by-plane-list-order.patch new file +58 -0
new file mode 100644
index 00000000..ae76af7f
@@ -0,0 +1,58 @@
+From af42fc1e336748b4e401e4441729dd79914425e6 Mon Sep 17 00:00:00 2001
+From: Daniel Stone <[email protected]>
+Date: Tue, 7 Dec 2021 15:58:49 +0000
+Subject: [PATCH] backend-drm: Assign plane_idx by plane list order
+
+Backport: af42fc1e336748b4e401e4441729dd79914425e6
+
+Signed-off-by: Daniel Stone <[email protected]>
+---
+ libweston/backend-drm/drm-internal.h | 1 -
+ libweston/backend-drm/drm.c          | 5 ++++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h
+index 55e9414b..86d7368e 100644
+--- a/libweston/backend-drm/drm-internal.h
++++ b/libweston/backend-drm/drm-internal.h
+@@ -276,7 +276,6 @@ struct drm_backend {
+ 	int min_height, max_height;
+
+ 	struct wl_list plane_list;
+-	uint32_t next_plane_idx;
+
+ 	void *repaint_data;
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 102fa2d7..203b8a4e 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -771,7 +771,6 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
+ 	}
+
+ 	plane->backend = b;
+-	plane->plane_idx = b->next_plane_idx++;
+ 	plane->state_cur = drm_plane_state_alloc(NULL, plane);
+ 	plane->state_cur->complete = true;
+ 	plane->possible_crtcs = kplane->possible_crtcs;
+@@ -919,6 +918,7 @@ create_sprites(struct drm_backend *b)
+ 	drmModePlane *kplane;
+ 	struct drm_plane *drm_plane;
+ 	uint32_t i;
++	uint32_t next_plane_idx = 0;
+ 	kplane_res = drmModeGetPlaneResources(b->drm.fd);
+ 	if (!kplane_res) {
+ 		weston_log("failed to get plane resources: %s\n",
+@@ -942,6 +942,9 @@ create_sprites(struct drm_backend *b)
+ 						      &b->compositor->primary_plane);
+ 	}
+
++	wl_list_for_each (drm_plane, &b->plane_list, link)
++		drm_plane->plane_idx = next_plane_idx++;
++
+ 	drmModeFreePlaneResources(kplane_res);
+ }
+
+--
+2.43.0
+
Signature · 1 line
2.43.0
Signature · 3 lines
Ryan Eatmon                [email protected]
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS
#4 lore raw

PATCH 2/2 weston: include backported patches in bbappend

In reply to [email protected]

From: Randolph Sapp <[email protected]>

Backport some sanity patches related to plane ordering and positioning. These are all mandatory for display subsystems that allow primary and overlay mutable zpos.

They have all already been accepted upstream already and are only necessary for Kirkstone's version of Weston.

---
 .../recipes-graphics/wayland/weston_10.0.2.bbappend           | 4 ++++
 1 file changed, 4 insertions(+)
meta-arago-distro/recipes-graphics/wayland/weston_10.0.2.bbappend +4 -0
index 698ff03e..3c577c6d 100644
@@ -9,6 +9,10 @@ PR:append = ".arago1"
 SRC_URI += " \
         file://0001-backend-drm-Select-plane-based-on-current-attached-C.patch \
         file://0001-Revert-require-GL_EXT_unpack_subimage-commit.patch \
+        file://0001-backend-drm-Pre-sort-plane-list-by-zpos.patch \
+        file://0002-backend-drm-fix-plane-sorting.patch \
+        file://0003-drm-backend-Remember-to-set-the-zpos-for-the-scanout.patch \
+        file://0004-backend-drm-Assign-plane_idx-by-plane-list-order.patch \
 "
 
 # required for weston user to interact with the render devices
Signature · 1 line
2.43.0