From 97903d55f4b3378fc32ec142c734558535ef9972 Mon Sep 17 00:00:00 2001 From: BFE Engineering Date: Wed, 11 Nov 2026 11:52:46 -0600 Subject: [PATCH] VOP pixel clock: bench helpers for the 30 MHz proof [skip ci] Panel-side helpers for the bfe-core1106-sdk#43 bench proof on panels .52 to .56 (2026-11-11): the clock and eth0 check (vopcheck.sh), the 30-minute UI stats workload (uirun.sh), the GIC 121 frame-start count (gic121.sh) and the run summary (summarize.py). The helpers read clk_summary and the DRM mode; they add no build or kernel change. Refs bfe-core1106-sdk#43. Image built from flare-edge 201f74f9c, which pins this branch at feb66fd. Co-Authored-By: Claude Haiku 5.5 Claude-Session: https://claude.ai/code/session_01BdKQBPu4qHGnopkHjchmwz --- tests/vop-dclk/bench/README.md | 19 ++++++++++++++ tests/vop-dclk/bench/gic121.sh | 13 ++++++++++ tests/vop-dclk/bench/summarize.py | 42 +++++++++++++++++++++++++++++++ tests/vop-dclk/bench/uirun.sh | 27 ++++++++++++++++++++ tests/vop-dclk/bench/vopcheck.sh | 23 +++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100644 tests/vop-dclk/bench/README.md create mode 100755 tests/vop-dclk/bench/gic121.sh create mode 100755 tests/vop-dclk/bench/summarize.py create mode 100755 tests/vop-dclk/bench/uirun.sh create mode 100755 tests/vop-dclk/bench/vopcheck.sh diff --git a/tests/vop-dclk/bench/README.md b/tests/vop-dclk/bench/README.md new file mode 100644 index 0000000..e4a807c --- /dev/null +++ b/tests/vop-dclk/bench/README.md @@ -0,0 +1,19 @@ +# VOP pixel clock bench helpers (bfe-core1106-sdk#43) + +Helpers for the bench proof of the CPLL 900 MHz clock plan. They run on a Warden panel +(busybox sh), read-only except for the UI workload, and need the panel's warden-ui test +hook (FIFO `/tmp/warden-ui.ctl`). + +- `vopcheck.sh candidate|baseline`: reads clk_summary and the eth0 carrier. Candidate expects + pll_cpll 900000000, dclk_vop 30000000, clk_50m_src 50000000, clk_100m_src 100000000, + aclk_ddr_root 450000000 and clk_250m_src 225000000. Baseline expects pll_cpll 1000000000 and + dclk_vop 31250000. Exit 0 when all rows pass. +- `uirun.sh LABEL SECONDS`: fixed UI workload (wake, nav, two scrolls, home), one `stats` read + after each action. Writes `/tmp/vop-ui-LABEL.csv` and `.log` on the panel. +- `gic121.sh`: VOP frame-start count (GIC 121) in three-second windows, with INTR_EN0 and + DSP_CTRL0 read only. `WINDOWS=n` sets the number of windows. +- `summarize.py FILE...`: render_ms and render_max_ms statistics for each CSV + (`python3 -I summarize.py`). + +Run a helper with `sh /tmp/.sh` after copying it to the panel. Hold the panel's bench +lock for the whole run (`bench-lock run --class SOAK` for a workload). diff --git a/tests/vop-dclk/bench/gic121.sh b/tests/vop-dclk/bench/gic121.sh new file mode 100755 index 0000000..fc4012f --- /dev/null +++ b/tests/vop-dclk/bench/gic121.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# gic121.sh: VOP frame-start count (GIC 121) over three 3 s windows, read-only (no UI verbs, INTR_EN0 untouched). +cnt() { awk '/GIC-0 121 /{s=0; for(i=2;i<=NF;i++){ if($i ~ /^[0-9]+$/){s+=$i} else break }; print s; exit}' /proc/interrupts; } +bl=$(cat /sys/class/backlight/*/bl_power 2>/dev/null | head -1); br=$(cat /sys/class/backlight/*/brightness 2>/dev/null | head -1) +echo "backlight bl_power=$bl brightness=$br" +echo "INTR_EN0=$(devmem 0xff990034 2>/dev/null) DSP_CTRL0=$(devmem 0xff990020 2>/dev/null)" +i=1 +while [ $i -le ${WINDOWS:-3} ]; do + c1=$(cnt); t1=$(cut -d' ' -f1 /proc/uptime); sleep 3; c2=$(cnt); t2=$(cut -d' ' -f1 /proc/uptime) + echo "window $i: count=$((c2-c1)) span=$(awk -v a=$t1 -v b=$t2 'BEGIN{printf "%.3f", b-a}') s rate=$(awk -v d=$((c2-c1)) -v a=$t1 -v b=$t2 'BEGIN{printf "%.2f", d/(b-a)}')/s" + i=$((i+1)) +done +echo "GIC121DONE" diff --git a/tests/vop-dclk/bench/summarize.py b/tests/vop-dclk/bench/summarize.py new file mode 100755 index 0000000..6b61fd8 --- /dev/null +++ b/tests/vop-dclk/bench/summarize.py @@ -0,0 +1,42 @@ +"""Summarize one UI-run CSV: stats samples per action and overall (python3 -I summarize.py FILE...).""" +import csv +import statistics +import sys + + +def num(v): + try: + return float(v) + except (TypeError, ValueError): + return None + + +def summarize(path): + rows = list(csv.DictReader(open(path, encoding="ascii"))) + ok = [r for r in rows if num(r["render_ms"]) is not None and num(r["render_max_ms"]) is not None] + busy = [r for r in ok if (num(r["fps"]) or 0) > 0] + rmax = [num(r["render_max_ms"]) for r in ok] + rms = [num(r["render_ms"]) for r in busy] + fps = [num(r["fps"]) for r in busy] + out = { + "file": path, + "samples": len(rows), + "parsed": len(ok), + "busy_windows": len(busy), + "fps_mean": round(statistics.mean(fps), 2) if fps else None, + "render_ms_mean_busy": round(statistics.mean(rms), 3) if rms else None, + "render_ms_p95_busy": round(sorted(rms)[int(0.95 * (len(rms) - 1))], 3) if rms else None, + "render_max_ms_max": round(max(rmax), 2) if rmax else None, + "render_max_ms_p95": round(sorted(rmax)[int(0.95 * (len(rmax) - 1))], 2) if rmax else None, + "render_max_ms_mean": round(statistics.mean(rmax), 3) if rmax else None, + } + per = {} + for r in ok: + per.setdefault(r["action"], []).append(num(r["render_max_ms"])) + out["render_max_by_action"] = {a: round(max(v), 2) for a, v in per.items()} + return out + + +if __name__ == "__main__": + for p in sys.argv[1:]: + print(summarize(p)) diff --git a/tests/vop-dclk/bench/uirun.sh b/tests/vop-dclk/bench/uirun.sh new file mode 100755 index 0000000..e0cb8c7 --- /dev/null +++ b/tests/vop-dclk/bench/uirun.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# uirun.sh LABEL SECONDS: fixed UI workload for SECONDS. Each action is followed by one stats read. +LABEL=$1; DUR=$2 +OUT=/tmp/vop-ui-$LABEL.csv; LOG=/tmp/vop-ui-$LABEL.log +ui() { rm -f /tmp/warden-ui.dbg; printf '%s\n' "$1" > /tmp/warden-ui.ctl; n=0; while [ ! -s /tmp/warden-ui.dbg ] && [ $n -lt 100 ]; do sleep 0.05; n=$((n+1)); done; cat /tmp/warden-ui.dbg 2>/dev/null; } +key() { printf '%s\n' "$1" | awk -F': ' -v k="$2" '$1==k {print $2; exit}' | awk '{print $1}' | tr -d '%'; } +pid0=$(pidof warden-ui 2>/dev/null); echo "start uptime=$(cut -d' ' -f1 /proc/uptime) warden-ui=$pid0" > $LOG +dmesg | grep -i -E 'ddr|axi|vop|rga|error|fail|underflow|oops|bug|warn|timeout' | wc -l > /tmp/vop-dmesg-$LABEL.before +echo "uptime_s,action,reply1,page,cpu,fps,render_ms,render_max_ms,idle,memavail_kb" > $OUT +start=$(cut -d' ' -f1 /proc/uptime); cycles=0 +while :; do + now=$(cut -d' ' -f1 /proc/uptime) + done_=$(awk -v a=$start -v b=$now -v d=$DUR 'BEGIN{print (b-a>=d)?1:0}') + [ "$done_" = 1 ] && break + for act in "wake" "nav settings/system" "scroll 360 300 300" "scroll 360 300 -300" "home"; do + r1=$(ui "$act" | head -1 | tr ',' ';') + sleep 1.2 + s=$(ui stats) + page=$(key "$s" page); cpu=$(key "$s" cpu); fps=$(key "$s" fps); rms=$(key "$s" render); rmax=$(key "$s" render_max); idle=$(key "$s" idle); mem=$(key "$s" memavail) + echo "$(cut -d' ' -f1 /proc/uptime),$act,$r1,$page,$cpu,$fps,$rms,$rmax,$idle,$mem" >> $OUT + sleep 0.3 + done + cycles=$((cycles+1)); sleep 1 +done +echo "end uptime=$(cut -d' ' -f1 /proc/uptime) warden-ui=$(pidof warden-ui 2>/dev/null) cycles=$cycles" >> $LOG +dmesg | grep -i -E 'ddr|axi|vop|rga|error|fail|underflow|oops|bug|warn|timeout' | wc -l > /tmp/vop-dmesg-$LABEL.after +echo "DONE $LABEL" >> $LOG diff --git a/tests/vop-dclk/bench/vopcheck.sh b/tests/vop-dclk/bench/vopcheck.sh new file mode 100755 index 0000000..fe22b5f --- /dev/null +++ b/tests/vop-dclk/bench/vopcheck.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# vopcheck.sh MODE (candidate|baseline): read-only clock plan and eth0 check on a bench panel. +MODE=${1:-candidate} +CS=/sys/kernel/debug/clk/clk_summary +rate() { awk -v n="$1" '$1==n {print $5; exit}' $CS; } +fail=0 +chk() { if [ "$3" = "$2" ]; then echo "PASS $1 = $3"; else echo "FAIL $1 = $3 (want $2)"; fail=1; fi; } +if [ "$MODE" = candidate ]; then + chk pll_cpll 900000000 "$(rate pll_cpll)" + chk dclk_vop_src 30000000 "$(rate dclk_vop_src)" + chk dclk_vop 30000000 "$(rate dclk_vop)" + chk clk_50m_src 50000000 "$(rate clk_50m_src)" + chk clk_100m_src 100000000 "$(rate clk_100m_src)" + chk aclk_ddr_root 450000000 "$(rate aclk_ddr_root)" + chk clk_250m_src 225000000 "$(rate clk_250m_src)" +else + chk pll_cpll 1000000000 "$(rate pll_cpll)" + chk dclk_vop 31250000 "$(rate dclk_vop)" +fi +carrier=$(cat /sys/class/net/eth0/carrier 2>/dev/null) +if [ "$carrier" = 1 ]; then echo "PASS eth0 carrier=1 speed=$(cat /sys/class/net/eth0/speed 2>/dev/null)"; else echo "FAIL eth0 carrier=$carrier"; fail=1; fi +echo "VOPCHECK mode=$MODE release=$(sed -n 's/.*GIT_COMMIT=\([^ ]*\).*/\1/p' /etc/warden-release) rc=$fail" +exit $fail