Skip to content

Commit e5ecb2a

Browse files
committed
display: add DRM node helper and Weston stale socket cleanup
Update Runner/utils/lib_display.sh to add two reusable display helpers: - get_drm_primary_node() Returns the first available DRM primary node under /dev/dri/card* so display and IGT tests can detect primary DRM availability consistently. - weston_cleanup_stale_sockets() Removes stale Wayland socket files only when Weston is not running, using best-effort cleanup for common Weston runtime locations. These helpers improve reuse across display-related tests and remove runtime noise from Weston stop/start paths without changing normal execution flow. Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
1 parent 613074a commit e5ecb2a

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Runner/utils/lib_display.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,42 @@ display__debugfs_mode_for_crtc_name() {
110110
' "$st" 2>/dev/null
111111
}
112112

113+
# Return the first available DRM primary node (/dev/dri/card*).
114+
# Prints the node path and returns 0 on success, 1 if no primary DRM node exists.
115+
get_drm_primary_node() {
116+
for node in /dev/dri/card*; do
117+
case "$node" in
118+
/dev/dri/card[0-9]*)
119+
if [ -e "$node" ]; then
120+
printf '%s\n' "$node"
121+
return 0
122+
fi
123+
;;
124+
esac
125+
done
126+
return 1
127+
}
128+
129+
# Remove stale Wayland socket files only when Weston is not running.
130+
# Best-effort cleanup for common Weston runtime paths; ignores missing files and permission errors.
131+
weston_cleanup_stale_sockets() {
132+
if weston_is_running; then
133+
return 0
134+
fi
135+
136+
for s in \
137+
/dev/socket/weston/wayland-* \
138+
/run/user/0/wayland-* \
139+
/run/user/1000/wayland-* \
140+
/tmp/wayland-* \
141+
"${XDG_RUNTIME_DIR:-/nonexistent}"/wayland-*; do
142+
[ -S "$s" ] || continue
143+
rm -f "$s" 2>/dev/null || true
144+
done
145+
146+
return 0
147+
}
148+
113149
drm_card_index_from_dev() {
114150
dev="$1"
115151
case "$dev" in

0 commit comments

Comments
 (0)