From 601cd1ffa9d428bbdb7ec931f5eea763402bc66c Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Sun, 1 Nov 2026 10:44:44 +1100 Subject: [PATCH] tools/asahi: extract the AVD AV1 reference timestamp helper Commit 89e658c7 ("media: apple: avd: bound AV1 reference indices before using them") moved the reference timestamp lookup in avd_av1_set_prob() into a new u64 helper, avd_av1_ref_ts(). The AV1 tail host test only extracts int and void functions and did not list the helper, so the generated controls.c no longer compiled and all ten avd-av1-tail-tests cases failed in run-host-tests.py (148/158). Teach the extractor u64 return types, extract avd_av1_ref_ts() ahead of avd_av1_set_prob(), and give the fixture the u64 and U64_MAX it needs. The base run passes again and each of the six mutations still fails on its own assertion. Assisted-by: LLM Signed-off-by: Ryan Murray --- tools/asahi/avd-av1-tail-tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/asahi/avd-av1-tail-tests.py b/tools/asahi/avd-av1-tail-tests.py index d602801b7c0a7..171c97822e5b8 100644 --- a/tools/asahi/avd-av1-tail-tests.py +++ b/tools/asahi/avd-av1-tail-tests.py @@ -15,7 +15,7 @@ def function(source, name): - match = re.search(r'^(?:static )?(?:int|void)\s+' + name + r'\(', source, re.M) + match = re.search(r'^(?:static )?(?:int|void|u64)\s+' + name + r'\(', source, re.M) if not match: raise ValueError(name) start = match.start() @@ -48,6 +48,8 @@ def structure(source, name): typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t dma_addr_t; +typedef uint64_t u64; +#define U64_MAX UINT64_MAX #define ALIGN(x,a) (((x)+(a)-1)&~((__typeof__(x))(a)-1)) #define ALIGN_DOWN(x,a) ((x)&~((__typeof__(x))(a)-1)) #define WARN_ON(x) (x) @@ -211,7 +213,7 @@ def main(): text = {name: p.read_text() for name, p in paths.items()} src = text['avd-av1.c'] macros = src[src.index('#define AVD_CDFS_SIZE'):src.index('struct avd_av1_run {')] - functions = {n: function(src, n) for n in ['avd_av1_set_prob', 'avd_av1_set_seg', 'avd_av1_seg_size', 'avd_color_size', 'avd_av1_run_preamble', 'avd_av1_adjust_decoded_fmt']} + functions = {n: function(src, n) for n in ['avd_av1_ref_ts', 'avd_av1_set_prob', 'avd_av1_set_seg', 'avd_av1_seg_size', 'avd_color_size', 'avd_av1_run_preamble', 'avd_av1_adjust_decoded_fmt']} unaligned = ('\n#define UNALIGNED_CDFS_OFFSET(dst,cl) ((dst)-ALIGN(cl,AVD_ALIGN)-ALIGN(AVD_CDFS_SIZE,AVD_ALIGN))\n' '#define UNALIGNED_SEG_OFFSET(dst,cl,sl) (UNALIGNED_CDFS_OFFSET(dst,cl)-(sl))\n') # Each mutation names the extracted text it rewrites; a stale one is refused, never run as a no-op.