Re: [yocto] weston 13.0.1 assert fail #scarthgap

Gyorgy Sarvari <[email protected]>
Newsgroups org.yoctoproject.lists.yocto
Message-ID <[email protected]>
On 11/25/25 16:39, Jarno via Lists.Yoctoproject.Org wrote:
> git rev-parse HEAD
> 5240b5c200e594b494a7f1a8f9d81e7c09bc8939
>  
> MACHINE=raspberrypi4-64 bitbake -e weston | grep ^SRC_URI
> SRC_URI="file://0001-libweston-tools-Include-libgen.h-for-basename-signat.patch
> file://0001-vnc-Allow-neatvnc-in-version-0.8.0.patch file://weston.png
> file://weston.desktop file://xwayland.weston-start
> file://systemd-notify.weston-start
> file://0001-Adapt-weston-to-64-bit-plane-IDs.patch"
>  
> After build and flash same behaviour persist.

Hmmm... this is strange, I tested using the same hw (rpi4-64) with the
same revision, and just verified the patch again earlier today with both
6.6 and 6.12 kernels.

I have attached another patch, which is similar to the one in the
repository. You can just overwrite
0001-Adapt-weston-to-64-bit-plane-IDs.patch in meta-raspberrypi with
this (as a test, revert it afterwards), and build a new image. 

Does it crash also?

If yes, do you get the same backtrace, or is it different?


>  
> core dump:
>  
> #4  0x0000007f93ba55a0 in __assert_fail_base
>     (fmt=0x7f93cbdb70 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
> assertion=assertion@entry=0x7f92e6f420 "fb",
> file=file@entry=0x7f92e6ead0
> "/usr/src/debug/weston/13.0.1/libweston/backend-drm/state-propose.c",
> line=line@entry=506, function=function@entry=0x7f92e70ab0
> <__PRETTY_FUNCTION__.5> "drm_output_find_plane_for_view") at assert.c:96
> #5  0x0000007f93ba5624 in __assert_fail
>     (assertion=assertion@entry=0x7f92e6f420 "fb",
> file=file@entry=0x7f92e6ead0
> "/usr/src/debug/weston/13.0.1/libweston/backend-drm/state-propose.c",
> line=line@entry=506, function=function@entry=0x7f92e70ab0
> <__PRETTY_FUNCTION__.5> "drm_output_find_plane_for_view") at assert.c:105
> #6  0x0000007f92e6784c in drm_output_find_plane_for_view
>     (current_lowest_zpos=18446744073709551615, scanout_state=0x0,
> mode=DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY, pnode=0x55812dab90,
> state=0x558137fc70) at
> /usr/src/debug/weston/13.0.1/libweston/backend-drm/state-propose.c:506
>  
>  
0001-Adapt-weston-to-64-bit-plane-IDs.patch (text/x-patch, 4.3 KB)
From b66f14a812c96b92a83cec4bb637c1b982168d24 Mon Sep 17 00:00:00 2001
From: Gyorgy Sarvari <[email protected]>
Date: Sat, 22 Nov 2025 09:00:39 +0100
Subject: [PATCH] backend-drm: support 64-bit plane_mask

This change was prompted by a recent change in the Raspberry Pi
kernel[1], which has changed the plane_mask width to 64-bit in
their drm driver. Due to this weston behaved in an erratic way
on Raspberry Pi devices - usually this manifested in a crash
immediatelly when the mouse is moved (which was worked around
since by removing a failing assert[2]).

This change adapts libweston to accept 64-bit wide plane masks.

NB: the mentioned kernel change seems to be Raspberry Pi specific,
and there are no signs of it being mainlined.

[1]: https://github.com/raspberrypi/linux/commit/8181e682d6f4ef209845ec24f0a1eb37764d6731
[2]: https://gitlab.freedesktop.org/wayland/weston/-/issues/1039

Upstream-Status: Pending

Signed-off-by: Gyorgy Sarvari <[email protected]>
---
 libweston/backend-drm/drm-internal.h  |  2 +-
 libweston/backend-drm/drm.c           |  4 ++++
 libweston/backend-drm/fb.c            |  2 +-
 libweston/backend-drm/state-propose.c | 10 +++++-----
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h
index e008a8d1..305abbce 100644
--- a/libweston/backend-drm/drm-internal.h
+++ b/libweston/backend-drm/drm-internal.h
@@ -410,7 +410,7 @@ struct drm_fb {
 	int width, height;
 	int fd;
 
-	uint32_t plane_mask;
+	uint64_t plane_mask;
 
 	/* Used by gbm fbs */
 	struct gbm_bo *bo;
diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c
index 350aaf60..7baaa1b9 100644
--- a/libweston/backend-drm/fb.c
+++ b/libweston/backend-drm/fb.c
@@ -760,7 +760,7 @@ drm_fb_get_from_paint_node(struct drm_output_state *state,
 			continue;
 
 		if (drm_fb_compatible_with_plane(fb, plane))
-			fb->plane_mask |= 1 << (plane->plane_idx);
+			fb->plane_mask |= 1UL << (plane->plane_idx);
 	}
 	if (fb->plane_mask == 0) {
 		drm_fb_unref(fb);
--- ./libweston/backend-drm/state-propose.c.oeig	2025-11-25 12:49:15.280259892 +0100
+++ ./libweston/backend-drm/state-propose.c	2025-11-25 12:50:08.247823256 +0100
@@ -393,7 +393,7 @@
 	struct drm_fb *fb = NULL;
 
 	bool view_matches_entire_output, scanout_has_view_assigned;
-	uint32_t possible_plane_mask = 0;
+	uint64_t possible_plane_mask = 0;
 
 	pnode->try_view_on_plane_failure_reasons = FAILURE_REASONS_NONE;
 
@@ -437,7 +437,7 @@
 			return NULL;
 		}
 
-		possible_plane_mask = (1 << output->cursor_plane->plane_idx);
+		possible_plane_mask = (1UL << output->cursor_plane->plane_idx);
 	} else {
 		if (mode == DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY) {
 			drm_debug(b, "\t\t\t\t[view] not assigning view %p "
@@ -450,7 +450,7 @@
 				continue;
 
 			if (drm_paint_node_transform_supported(pnode, plane))
-				possible_plane_mask |= 1 << plane->plane_idx;
+				possible_plane_mask |= 1UL << plane->plane_idx;
 		}
 
 		if (!possible_plane_mask) {
@@ -483,10 +483,10 @@
 		if (possible_plane_mask == 0)
 			break;
 
-		if (!(possible_plane_mask & (1 << plane->plane_idx)))
+		if (!(possible_plane_mask & (1UL << plane->plane_idx)))
 			continue;
 
-		possible_plane_mask &= ~(1 << plane->plane_idx);
+		possible_plane_mask &= ~(1UL << plane->plane_idx);
 
 		switch (plane->type) {
 		case WDRM_PLANE_TYPE_CURSOR:
--- ./libweston/backend-drm/state-propose.c.orig	2025-11-25 13:26:58.173810837 +0100
+++ ./libweston/backend-drm/state-propose.c	2025-11-25 13:28:21.576255290 +0100
@@ -43,6 +43,8 @@
 #include "presentation-time-server-protocol.h"
 #include "linux-dmabuf-unstable-v1-server-protocol.h"
 
+#define MAX_PLANE_NR 64
+
 enum drm_output_propose_state_mode {
 	DRM_OUTPUT_PROPOSE_STATE_MIXED, /**< mix renderer & planes */
 	DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY, /**< only assign to renderer & cursor */
@@ -395,6 +397,8 @@
 	bool view_matches_entire_output, scanout_has_view_assigned;
 	uint64_t possible_plane_mask = 0;
 
+	assert(output->cursor_plane->plane_idx < MAX_PLANE_NR);
+
 	pnode->try_view_on_plane_failure_reasons = FAILURE_REASONS_NONE;
 
 	/* check view for valid buffer, doesn't make sense to even try */
@@ -449,6 +453,7 @@
 			if (plane->type == WDRM_PLANE_TYPE_CURSOR)
 				continue;
 
+			assert(plane->plane_idx < MAX_PLANE_NR);
 			if (drm_paint_node_transform_supported(pnode, plane))
 				possible_plane_mask |= 1UL << plane->plane_idx;
 		}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.