3333
3434# shellcheck disable=SC1091
3535. " $TOOLS /functestlib.sh"
36+ # shellcheck disable=SC1091
37+ . " $TOOLS /lib_display.sh"
3638
3739TESTNAME=" weston-simple-egl"
3840RES_FILE=" ./${TESTNAME} .res"
@@ -78,7 +80,19 @@ log_info "Config: DURATION=${DURATION} STOP_GRACE=${STOP_GRACE} EXPECT_FPS=${EXP
7880if command -v display_debug_snapshot > /dev/null 2>&1 ; then
7981 display_debug_snapshot " pre-display-check"
8082fi
81-
83+
84+ # Always print modetest as part of the snapshot (best-effort).
85+ # (Some lib_display.sh variants override display_debug_snapshot without modetest.)
86+ if command -v modetest > /dev/null 2>&1 ; then
87+ log_info " ----- modetest -M msm -ac (capped at 200 lines) -----"
88+ modetest -M msm -ac 2>&1 | sed -n ' 1,200p' | while IFS= read -r l; do
89+ [ -n " $l " ] && log_info " [modetest] $l "
90+ done
91+ log_info " ----- End modetest -M msm -ac -----"
92+ else
93+ log_warn " modetest not found in PATH skipping modetest snapshot."
94+ fi
95+
8296have_connector=0
8397if command -v display_connected_summary > /dev/null 2>&1 ; then
8498 sysfs_summary=$( display_connected_summary)
@@ -87,13 +101,12 @@ if command -v display_connected_summary >/dev/null 2>&1; then
87101 log_info " Connected display (sysfs): $sysfs_summary "
88102 fi
89103fi
90-
104+
91105if [ " $have_connector " -eq 0 ]; then
92106 log_warn " No connected DRM display found, skipping ${TESTNAME} ."
93107 echo " ${TESTNAME} SKIP" > " $RES_FILE "
94108 exit 0
95109fi
96-
97110# ---------------------------------------------------------------------------
98111# Wayland / Weston environment (runtime detection, no hardcoded flavour)
99112# ---------------------------------------------------------------------------
103116
104117sock=" "
105118
106- # 1) Try to find any existing Wayland socket (base or overlay)
119+ # Try to find any existing Wayland socket (base or overlay)
107120if command -v discover_wayland_socket_anywhere > /dev/null 2>&1 ; then
108121 sock=$( discover_wayland_socket_anywhere | head -n 1 || true)
109122fi
@@ -116,9 +129,13 @@ if [ -n "$sock" ] && command -v adopt_wayland_env_from_socket >/dev/null 2>&1; t
116129 fi
117130fi
118131
119- # 2) If no usable socket yet, try starting a private Weston (overlay-style helper)
132+ # If no usable socket yet, try starting a private Weston (overlay-style helper)
120133if [ -z " $sock " ] && command -v overlay_start_weston_drm > /dev/null 2>&1 ; then
121134 log_info " No usable Wayland socket; trying overlay_start_weston_drm helper..."
135+ if command -v weston_force_primary_1080p60_if_not_60 > /dev/null 2>&1 ; then
136+ log_info " Pre-configuring primary output to ~60Hz before starting Weston (best-effort) ..."
137+ weston_force_primary_1080p60_if_not_60 || true
138+ fi
122139 if overlay_start_weston_drm; then
123140 # Re-scan for a socket after attempting to start Weston
124141 if command -v discover_wayland_socket_anywhere > /dev/null 2>&1 ; then
@@ -137,7 +154,7 @@ if [ -z "$sock" ] && command -v overlay_start_weston_drm >/dev/null 2>&1; then
137154 fi
138155fi
139156
140- # 3) Final decision: run or SKIP
157+ # Final decision: run or SKIP
141158if [ -z " $sock " ]; then
142159 log_warn " No Wayland socket found after autodetection; skipping ${TESTNAME} ."
143160 echo " ${TESTNAME} SKIP" > " $RES_FILE "
@@ -152,7 +169,35 @@ if command -v wayland_connection_ok >/dev/null 2>&1; then
152169 fi
153170 log_info " Wayland connection test: OK"
154171else
155- log_warn " wayland_connection_ok helper not found; continuing without explicit Wayland probe."
172+ log_warn " wayland_connection_ok helper not found continuing without explicit Wayland probe."
173+ fi
174+
175+ # ---------------------------------------------------------------------------
176+ # Ensure primary output is ~60Hz (best-effort, no churn if already ~60Hz)
177+ # - Must NOT change weston.ini behavior: that remains inside lib_display.sh
178+ # - First checks current mode (modetest path) or config (weston.ini path)
179+ # - Only attempts changes when NOT ~60Hz
180+ # ---------------------------------------------------------------------------
181+ if command -v display_debug_snapshot > /dev/null 2>&1 ; then
182+ display_debug_snapshot " ${TESTNAME} : before-ensure-60hz"
183+ fi
184+ if command -v wayland_debug_snapshot > /dev/null 2>&1 ; then
185+ wayland_debug_snapshot " ${TESTNAME} : before-ensure-60hz"
186+ fi
187+
188+ if command -v weston_force_primary_1080p60_if_not_60 > /dev/null 2>&1 ; then
189+ log_info " Ensuring primary output is ~60Hz (best-effort) ..."
190+ if weston_force_primary_1080p60_if_not_60; then
191+ log_info " Primary output is ~60Hz (or was already ~60Hz)."
192+ else
193+ log_warn " Unable to force ~60Hz (continuing; not a hard failure)."
194+ fi
195+ else
196+ log_warn " weston_force_primary_1080p60_if_not_60 helper not found; skipping ~60Hz enforcement."
197+ fi
198+
199+ if command -v display_debug_snapshot > /dev/null 2>&1 ; then
200+ display_debug_snapshot " ${TESTNAME} : after-ensure-60hz"
156201fi
157202
158203# ---------------------------------------------------------------------------
0 commit comments