From f02d4f680acd241548f68d6cf8f36e0ec0a3fe31 Mon Sep 17 00:00:00 2001 From: Wenwen Fu Date: Fri, 21 Aug 2026 10:24:45 +0800 Subject: [PATCH] quickboot-display: trigger weston on msm_dpu driver instead of card0 The udev rule matched KERNEL=="card0" to start weston, and the service ordered itself with Requires=/After=dev-dri-card0.device. The cardN numbering is assigned in probe order and is not guaranteed to be the display controller when more than one DRM device is present (e.g. a discrete GPU or a DP/HDMI bridge exposing its own card). Match on DRIVERS=="msm_dpu" instead -- the msm display-controller driver name, which is stable and board-independent across the msm display stack. DEVTYPE=="drm_minor" + KERNEL=="card[0-9]*" restrict the match to the card node itself, excluding renderD* and card*- child nodes that share the same driver. To keep an explicit ordering without the unstable cardN name, the rule also publishes SYSTEMD_ALIAS=/dev/dri/msm_dpu_card, exposing the node as the stable device unit dev-dri-msm_dpu_card.device; weston.service orders itself with Requires=/After=dev-dri-msm_dpu_card.device. Verified on rb3gen2-core-kit: card0's parent display-controller driver is msm_dpu, the rule matches only the card0 minor (not renderD128 or the DP/HDMI connector nodes), the alias device unit comes up active, and the service loads with the alias dependency. Co-Authored-By: Claude Opus 4.8 (1M context) Signed-off-by: Wenwen Fu --- quickboot-display/files/03-drm.rules | 19 ++++++++++++++++--- quickboot-display/files/weston.service | 9 ++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/quickboot-display/files/03-drm.rules b/quickboot-display/files/03-drm.rules index 64b2f1e..e40b17a 100644 --- a/quickboot-display/files/03-drm.rules +++ b/quickboot-display/files/03-drm.rules @@ -1,7 +1,20 @@ # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. # SPDX-License-Identifier: BSD-3-Clause-Clear # -# Trigger Weston immediately when the primary DRM card is detected by the kernel. -# This eliminates delays waiting for generic multi-user targets. +# Trigger Weston immediately when the primary display controller's DRM card is +# detected by the kernel. This eliminates delays waiting for generic multi-user +# targets. +# +# Match on the msm_dpu display-controller driver (DRIVERS=="msm_dpu") rather than +# a fixed KERNEL=="card0". The cardN numbering is assigned in probe order and is +# not guaranteed to be the display controller when more than one DRM device is +# present (e.g. a discrete GPU or a DP/HDMI bridge exposing its own card). The +# msm_dpu driver name is stable and board-independent across the msm display +# stack. DEVTYPE=="drm_minor" + KERNEL=="card[0-9]*" restrict the match to the +# card node itself, excluding renderD* and card*- child nodes. +# +# SYSTEMD_ALIAS exposes this node as a stable device unit +# "dev-dri-msm_dpu_card.device" so weston.service can order itself against it +# (Requires=/After=) without hardcoding the unstable cardN name. -ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", ENV{SYSTEMD_READY}="1", ENV{SYSTEMD_WANTS}="weston.service" +ACTION=="add", SUBSYSTEM=="drm", ENV{DEVTYPE}=="drm_minor", DRIVERS=="msm_dpu", KERNEL=="card[0-9]*", ENV{SYSTEMD_ALIAS}="/dev/dri/msm_dpu_card", TAG+="systemd", ENV{SYSTEMD_READY}="1", ENV{SYSTEMD_WANTS}="weston.service" diff --git a/quickboot-display/files/weston.service b/quickboot-display/files/weston.service index abc6318..44a360e 100644 --- a/quickboot-display/files/weston.service +++ b/quickboot-display/files/weston.service @@ -14,9 +14,12 @@ # Remove default dependenies (sysinit.target, basic.target) to enable early start DefaultDependencies=no -# Start as soon as display card appear -Requires=dev-dri-card0.device -After=dev-dri-card0.device +# Start as soon as the display card appears. Order against the stable device-unit +# alias published by 03-drm.rules (SYSTEMD_ALIAS=/dev/dri/msm_dpu_card) instead of +# a hardcoded dev-dri-card0.device -- dev-dri-msm_dpu_card.device tracks the +# msm_dpu display controller regardless of its cardN enumeration. +Requires=dev-dri-msm_dpu_card.device +After=dev-dri-msm_dpu_card.device # Since we are part of the graphical session, make sure we are started before # it is complete.