All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gyorgy Sarvari <skandigraun@gmail.com>
To: jarno.katajainen@solotop.fi, yocto@lists.yoctoproject.org
Subject: Re: [yocto] weston 13.0.1 assert fail #scarthgap
Date: Tue, 25 Nov 2025 18:16:46 +0100	[thread overview]
Message-ID: <4bdd99dc-9607-45de-b4a0-66f99c692241@gmail.com> (raw)
In-Reply-To: <699212.1764085168440917647@lists.yoctoproject.org>

[-- Attachment #1: Type: text/plain, Size: 2092 bytes --]

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
>  
>  

[-- Attachment #2: 0001-Adapt-weston-to-64-bit-plane-IDs.patch --]
[-- Type: text/x-patch, Size: 4449 bytes --]

From b66f14a812c96b92a83cec4bb637c1b982168d24 Mon Sep 17 00:00:00 2001
From: Gyorgy Sarvari <skandigraun@gmail.com>
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 <skandigraun@gmail.com>
---
 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;
 		}

  reply	other threads:[~2025-11-25 17:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 13:52 weston 13.0.1 assert fail #scarthgap Jarno
2025-11-19 15:17 ` [yocto] " Gyorgy Sarvari
2025-11-20  9:21   ` Jarno
2025-11-21 19:56     ` Gyorgy Sarvari
2025-11-24 14:15       ` Jarno
2025-11-24 14:46         ` Gyorgy Sarvari
2025-11-25 15:39           ` Jarno
2025-11-25 17:16             ` Gyorgy Sarvari [this message]
2025-11-26 16:58               ` Jarno
2025-11-27 12:37                 ` Jarno
2025-11-27 19:52                   ` Jarno
2025-11-28  6:45                     ` Gyorgy Sarvari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4bdd99dc-9607-45de-b4a0-66f99c692241@gmail.com \
    --to=skandigraun@gmail.com \
    --cc=jarno.katajainen@solotop.fi \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.