tools: read split AdrenoDisplay and AdrenoX2 units whole

SnapAdreno now keeps AdrenoDisplay.cpp and AdrenoX2.cpp as a main
file plus ordered parts in src/AdrenoDisplay/ and src/AdrenoX2/. Tools
that read or hash those files by name saw only the main file.

- test-adreno-residency.py: VAKext reads AdrenoDisplay.cpp through
  read_source. On the main file alone its #if ADRENO_VA_RECLAIM guard
  check would see 1 of the 4 guarded lines and still pass.
- build-panel-mode-candidate.py, qualify-adreno-gui-components.py,
  qualify-adreno-ib-command.py, qualify-adreno-resource-kext.py: record
  the hash of every file of the unit (source_files), not the main only.
- bind-ca-metal-components.py, bind-composite-metal-components.py:
  compare the display unit with the accepted checkout's file by file.

On an unsplit checkout source_files returns the main file alone, so
records of older trees bind what they bound before.

Left as they are: qualify-early-stop-kext.py and qualify-display8-kext.py
(their file lists are one historical change set; their rglob binding
already covers the parts), check-iomfb-vtable.py and
build-deployed-b12.sh (they compile the main file, which includes the
parts).

test-adreno-residency.py passes on the split tree and on the base tree.
The other six need historical build trees and were not run end to end;
each loads with source_text and its changed expression lists the
unit's files (smoke check).
This commit is contained in:
Acelogic committed 2026-10-23 04:04:50 -04:00
1 parent 4c07284535
commit 4b83aba2d2
7 files changed
+28 -8

No files matched your search

+3 -1
View File
@@ -12,6 +12,8 @@ import hashlib
import json
import subprocess
from source_text import source_files
ROOT = Path(__file__).resolve().parents[1]
ORIGINAL = ROOT.parent / 'Snapintosh'
sha = lambda p: hashlib.sha256(Path(p).read_bytes()).hexdigest()
@@ -102,7 +104,7 @@ kext = ROOT / 'build/ca-integrated-kext-20260928-v1/AdrenoX2.kext'
bind(kext / 'Contents/MacOS/AdrenoX2', '54d32bb79af174703a17a21286231b6af6d555ca67d57d7662815a9c4717a9d1')
display = ROOT / 'gpu/adreno-kext/kext/src/AdrenoDisplay.cpp'
accepted = ROOT.parent / 'Snapintosh-adreno-fill/gpu/adreno-kext/kext/src/AdrenoDisplay.cpp'
assert bind(display) == bind(accepted)
assert [bind(p) for p in source_files(display)] == [bind(p) for p in source_files(accepted)] # with its parts
assert b'AdrenoIBCopyABI' in (kext / 'Contents/MacOS/AdrenoX2').read_bytes()
for tree in (bundle, ROOT / 'gpu/adreno-kext/kext', ROOT / 'gpu/adreno-kext/plugin'):
for path in tree.rglob('*'):
+5 -2
View File
@@ -13,6 +13,8 @@ import hashlib
import json
import subprocess
from source_text import source_files
ROOT = Path(__file__).resolve().parents[1]
NETWORK = ROOT.parent / 'Snapintosh-adreno-buffer-textures'
PIPELINE = ROOT.parent / 'Snapintosh-adreno-pipeline'
@@ -67,8 +69,9 @@ def main():
kext = Path(network['kext_bundle'])
bind(kext / 'Contents/MacOS/AdrenoX2', network['kext_sha256'])
assert b'AdrenoIBCopyABI' in (kext / 'Contents/MacOS/AdrenoX2').read_bytes()
assert bind(ROOT / 'gpu/adreno-kext/kext/src/AdrenoDisplay.cpp') == bind(
ROOT.parent / 'Snapintosh-adreno-fill/gpu/adreno-kext/kext/src/AdrenoDisplay.cpp')
display_unit = source_files(ROOT / 'gpu/adreno-kext/kext/src/AdrenoDisplay.cpp') # with its ordered parts
accepted_unit = source_files(ROOT.parent / 'Snapintosh-adreno-fill/gpu/adreno-kext/kext/src/AdrenoDisplay.cpp')
assert [bind(p) for p in display_unit] == [bind(p) for p in accepted_unit]
native_path = ROOT / 'build/qc-pipelines-composite-20260928-v1.json'
native = read(native_path,
+4 -1
View File
@@ -8,6 +8,8 @@ from pathlib import Path
import shutil
import subprocess
from source_text import source_files
ROOT = Path(__file__).resolve().parents[1]
BASELINE = ROOT / 'build/virtual-ethernet-clock-20260927/native-link-v3'
SOURCE = ROOT.parent / 'Snapintosh-adreno-clear'
@@ -32,7 +34,8 @@ def main():
for name, expected in objects.items():
assert sha(BASELINE / name) == expected, name
source = SOURCE / 'gpu/adreno-kext/kext/src/AdrenoDisplay.cpp'
inputs = {str(source): sha(source), str(BASELINE / 'qualification.json'): sha(BASELINE / 'qualification.json')}
inputs = {str(f): sha(f) for f in source_files(source)} # the unit: AdrenoDisplay.cpp and its parts
inputs[str(BASELINE / 'qualification.json')] = sha(BASELINE / 'qualification.json')
for folder in ['gpu/adreno-kext/kext/src', 'gpu/adreno-kext/kext/include', 'gpu/adreno-kext/include']:
for f in (SOURCE / folder).glob('*.h'):
inputs[str(f)] = sha(f)
+4 -1
View File
@@ -12,6 +12,8 @@ import sys
import time
from source_text import read_source
from source_text import source_files
ROOT = Path(__file__).resolve().parents[1]
sha = lambda p: hashlib.sha256(p.read_bytes()).hexdigest()
@@ -146,7 +148,8 @@ def main():
bind(Path(abi['kernelcache']))
for name in ['tools/check-iomfb-vtable.py', 'tools/test-display-profile.py',
'gpu/adreno-kext/kext/src/AdrenoDisplay.cpp', 'gpu/adreno-kext/kext/src/AdrenoDisplay.h']:
bind(ROOT/name)
for path in source_files(ROOT/name): # a split unit binds its ordered parts too
bind(path)
out = args.output.resolve()
out.mkdir(parents=True, exist_ok=False)
command = [sys.executable, 'tools/test-display-profile.py', '--firmware', str(original/'downloads/extracted/j700ap')]
+4 -1
View File
@@ -40,6 +40,8 @@ import subprocess
import sys
from source_text import source_files
from source_text import source_files
ROOT = Path(__file__).resolve().parents[1]
Q1N1 = ROOT.parent / 'q1n1' / 'tools'
PLANS = ROOT / 'build' / 'adreno-pipeline-compiler-20260927'
@@ -665,7 +667,8 @@ def main():
if monitor:
inputs.append('compat/adreno-ib.h')
for kext_source in ('AdrenoX2.cpp', 'AdrenoX2.h', 'AdrenoSegmentList.cpp', 'AdrenoMemoryMap.cpp'):
inputs.append(f'gpu/adreno-kext/kext/src/{kext_source}')
for path in source_files(ROOT / f'gpu/adreno-kext/kext/src/{kext_source}'): # with its ordered parts
inputs.append(str(path.relative_to(ROOT)))
inputs.append('gpu/adreno-kext/kext/build.sh')
inputs += [str(q.relative_to(ROOT)) for p in inputs if p.endswith('.c') for q in source_files(ROOT / p)[1:]]
external = {str(p): sha(p) for p in [PLANS / 'draw-plan-v2/draw.ib.bin', PLANS / 'draw-plan-v2/references.json',
+5 -1
View File
@@ -13,6 +13,8 @@ import re
import struct
import subprocess
from source_text import source_files
ROOT = Path(__file__).resolve().parents[1]
KDK = Path('/Library/Developer/KDKs/KDK_27.0_26A428.kdk/System/Library')
sha = lambda data: hashlib.sha256(data).hexdigest()
@@ -152,8 +154,10 @@ def main():
funcs = {f['symbol']: f for im in native['images'] for f in im['functions']}
update = funcs['__ZN14IOGPUMemoryMap10update_pteEjP18IOMemoryDescriptorS1_']['instructions']
assert any(i['mnemonic'] == 'tbnz' and i['operands'].startswith('w0, #0,') for i in update)
# AdrenoX2.cpp and its ordered parts
x2_unit = [str(p.relative_to(ROOT)) for p in source_files(ROOT/'gpu/adreno-kext/kext/src/AdrenoX2.cpp')]
sources = ['compat/adreno-resource.c','compat/adreno-resource.h','compat/adreno-guest.h',
'gpu/adreno-kext/kext/src/AdrenoMemoryMap.cpp','gpu/adreno-kext/kext/src/AdrenoX2.cpp',
'gpu/adreno-kext/kext/src/AdrenoMemoryMap.cpp',*x2_unit,
'gpu/adreno-kext/kext/src/AdrenoX2.h','gpu/adreno-kext/kext/include/IOGPUFamily26A428.h',
'gpu/adreno-kext/kext/Info.plist','gpu/adreno-kext/kext/build.sh',
'tools/trace-adreno-resource-kext.py','tools/trace-adreno-memory-map.py',
+3 -1
View File
@@ -31,6 +31,8 @@ import sys
import tempfile
import unittest
from source_text import read_source
ROOT = Path(__file__).resolve().parents[1]
CORE = ROOT / 'compat/adreno-resource.c'
HARNESS = ROOT / 'tools/test-adreno-residency.c'
@@ -527,7 +529,7 @@ class VAKext(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.source = MAP.read_text()
cls.display = (KEXT / 'src/AdrenoDisplay.cpp').read_text()
cls.display = read_source(KEXT / 'src/AdrenoDisplay.cpp') # with its ordered parts
def test_filler_is_read_only_and_never_released(self):
insert = between(self.source, 'static int fillerInsert(')