Skip to content

graphics: harden weston-simple-egl against wall-clock steps - #552

Merged
Srikanth Muppandam (smuppand) merged 2 commits into
qualcomm-linux:mainfrom
ricardosalveti:harden-weston-egl-clock-step
Aug 26, 2026
Merged

graphics: harden weston-simple-egl against wall-clock steps#552
Srikanth Muppandam (smuppand) merged 2 commits into
qualcomm-linux:mainfrom
ricardosalveti:harden-weston-egl-clock-step

Conversation

@ricardosalveti

Copy link
Copy Markdown
Contributor

weston-simple-egl fails intermittently on iq-9075-evk while every other test
on the same boot passes, including weston-simple-shm, KMSCube and core_auth,
with EGL running on real hardware (freedreno FD663).

Failing run:

Client finished, rc=143 elapsed=2885113s
FPS stats, samples=1471 avg=0.253841 min=0.200000 max=74.800003
[FAIL] Average FPS below detected-refresh threshold: avg=0.253841 < 64

Passing run, same test, same board:

Client finished, rc=143 elapsed=30s
FPS stats, samples=4 avg=74.850002 min=74.800003 max=75.000000

The difference is not the GPU. These boards have no valid RTC:

rtc-pm8xxx ...: setting system clock to 1970-01-01T00:00:16 UTC (16)

systemd bumps the clock to the image's build-time fallback, and NTP later
steps it 33 days to real time — that is the 2885113s. When the step lands
inside the 30s window the client's frame accounting jumps with it and prints
one single-frame report per frame; those flood the sample set and drag the
mean under the gate, even though the first window read 74.8 fps, the same
figure the passing run averages on a 75Hz link. Whether the correction lands
inside the window is timing, hence the flakiness.

Wait for the clock to settle before measuring, take elapsed from a monotonic
source, and check for a step afterwards. When one occurred, report SKIP
instead of asserting on numbers that cannot be right, and record the step
size and single-frame count in the summary.

Single-frame samples are counted, not filtered out: dropping them would hide
this flake but would equally hide a genuine 0.2 fps regression.

Tested:

  • shellcheck -s sh -e SC1091,SC2230,SC3043 clean on both files
  • FPS parser against captured logs: healthy log gives count=4 avg=74.9
    single=0; the 1471-line stepped log gives single=1470
  • step arithmetic for no-step, the real 33-day forward step, a backward
    step, and malformed input
  • tolerance validation rejects non-integer values

Runner/suites/Multimedia/Graphics/X11_GLX/run.sh uses the same FPS parser and
has the same exposure; left alone here for lack of failing data.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread Runner/utils/lib_display.sh Outdated
@ricardosalveti
Ricardo Salveti (ricardosalveti) force-pushed the harden-weston-egl-clock-step branch 2 times, most recently from c609604 to 5399afc Compare August 26, 2026 15:37
Comment thread Runner/utils/functestlib.sh Outdated
Comment thread Runner/suites/Multimedia/Graphics/weston-simple-egl/run.sh
Boards without a valid RTC boot at the epoch, get bumped to a build-time
fallback by systemd, then stepped to real time once NTP reaches them:

  rtc-pm8xxx ...: setting system clock to 1970-01-01T00:00:16 UTC (16)

A step landing inside a measurement invalidates every wall-clock interval
taken across it.

Add get_monotonic_seconds() for interval measurement,
clock_step_seconds() to report how far the wall clock moved beyond an
interval's monotonic duration, and wait_for_time_sync() to settle the
clock beforehand, bounded and skipped when no time source exists. These
live in functestlib.sh rather than lib_display.sh because nothing about
them is display-specific; they validate input through the existing
is_unsigned_number(), and rt_now_seconds() in lib_rt.sh now delegates to
get_monotonic_seconds() instead of carrying its own copy, so display and
real-time suites share one timing implementation.

Whether a time source exists is decided by time_sync_service_active(),
not by timedatectl being installed: timedatectl ships on every systemd
image, configured or not, and waiting on its presence alone would stall
every run on images with no synchronization service. Check the timedated
NTP property, the systemd-timesyncd runtime directory, and running
systemd-timesyncd, chronyd or ntpd daemons instead.

Also count single-frame samples in display_parse_fps_log() and export
DISPLAY_FPS_SINGLE_FRAME. A clock step turns every reporting window into
one, so a high count next to a healthy max distinguishes bad samples from
slow rendering.

Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
weston-simple-egl fails intermittently on iq-9075-evk while every other
test on the same boot passes, including weston-simple-shm and KMSCube.
A failing run:

  Client finished, rc=143 elapsed=2885113s
  FPS stats, samples=1471 avg=0.253841 min=0.200000 max=74.800003

A passing run on the same board:

  Client finished, rc=143 elapsed=30s
  FPS stats, samples=4 avg=74.850002 min=74.800003 max=75.000000

The difference is not the GPU. In failing runs the clock steps 33 days
mid-measurement, from the image's build-time fallback to real time, which
is the 2885113s. The client's frame accounting jumps with it and prints
one single-frame report per frame; those flood the sample set and drag
the mean under the gate, even though the first window read 74.8 fps, the
same figure the passing run averages on a 75Hz link. Whether the
correction lands inside the 30s window is timing, hence the flakiness.

Wait for the clock to settle, take elapsed from a monotonic source, and
check for a step afterwards. When one occurred, report SKIP rather than
asserting on numbers that cannot be right, and record the step size and
single-frame count in the summary. The wait bound and step tolerance are
tunable through TIME_SYNC_WAIT and CLOCK_STEP_TOLERANCE, exposed as
parameters in the LAVA test definition so jobs can override them
consistently.

Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
@smuppand
Srikanth Muppandam (smuppand) merged commit abe0960 into qualcomm-linux:main Aug 26, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants