Repository navigation
WIP: HEVC encoder, guest side: kernel gen codec, the archive in kernel.kc, device faults fixed, a real stand-in for the PC - #59
Draft
akshaynexus wants to merge 3 commits into
Draft
akshaynexus wants to merge 3 commits into
akshaynexus wants to merge 3 commits into
Conversation
…kernel.kc, four device faults fixed, a real stand-in encoder for the PC Stopped by the owner before the PC boot finished: built and tested as below, the iOS-side proof is not done. Guest (kernel): - oneios-tool kernel gen codec (build_oneios_codec.rs, staged/codec.rs): liboneioscodec.a from UniXNU-droidvm's DroidVMVirtioMedia.c, DroidVMVTParavirt.cpp (late object), DroidVMVTHost.cpp (staged with one edit) and OneiOSCodec.c; kernel/build-hosted.sh builds it after audio and force-loads it. - The edit: the hvcC's profile, tier and level bytes were copied from the SPS with its emulation prevention bytes, which every HEVC SPS has there (level 0 and 03 bytes as flags in the hvcC); taken without them. - OneiOSCodec.c: the start line says "registered" only at stage 2; the device's own line; every 30 s while a figure moves the counters, the messages (process, type) and DroidVMVTHost's session lines. Host (runtime/bridges/encoder), read against the real guest transport: - MMAP answered the buffer's guest address; the guest expects its place in the pool (every buffer was refused). - CLOSE comes with no answer buffer and was dropped: no session ever closed, two slots, gone after one encode. - ENUM_FMT answered nothing; a coded unit larger than the guest's buffer came back as an error at every poll. - The worker polled its backend 50 times a second for ever; it sleeps until a command with no session open. - The stand-in encoder writes a real stream: HEVC with I_PCM coding units (the standard's CABAC encoder for part_mode and the terminating bins) at the PCM bit depth that fits the guest's buffer, H.264 I_PCM or grey. - xnuhost: encoder=auto with the bridges off (a PC boot) and encoder=sim run the stand-in inside xnuhost; in a session auto stays the MediaCodec helper. encctl: MMAP and CLOSE as the guest does, NAL types, an output file. Tested on the Linux PC: make -C runtime/bridges/encoder test (test_standin 173 checks, ffmpeg decodes its 16 streams to exactly the picture given, test_encoder 214 checks through the helper and in process); xnuhost unit tests 14036 checks; cargo test golden 13 of 13; the hosted kernel built (xnu.macho 972b9132), kernel.kc e4ffcabd with audit 0 failures and stubs-check 666 good; compare-golden.sh the same after UPDATE=1 (which no longer removes golden/synthetic). A PC boot with encoder=auto, its first 40 s: "ONEIOS CODEC: 1 virtio-media device(s), 1 up; VideoToolbox paravirtualization registered (stage 2)" and "device 0: oneios-encoder caps 0x4004000 out: NV12 cap: HEVC H264". Not done: that boot to the home screen, iOS's log (chronod's hvc1 errors, WidgetRenderer's Content load failed) before and after, the phone. Docs: hardware.md 7g, booter.md, building.md, the codec and encoder READMEs, the hosted and prelink READMEs, tools/oneios-tool/README.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
main's fix-audio-latency changed the staged audio (speaker ring cap, output latency 6480 -> 720 frames); keep main's audio lines and add the guest-side codec lines (build order: audio then codec). No numbered patch collisions: the codec is an unnumbered archive, main's 0076/0078/0080 kept. Host unit tests after the merge: encoder standin 173/173 with 16 ffmpeg-decoded streams, encoder 214/214; xnuhost 14081 checks 0 failed; cargo test all green including kernel golden 13/13.
The hunk appended at the create() done: label with one line of context
('done:', five of them in the file) and a line number four off pristine,
so git apply refused it and every hosted build after 7b81012 failed at
patch 0080. Anchor it with the four lines that only occur at create()'s
done: (if (shared_region) {, the TRACE_INFO, its format line). No
behaviour change: the inserted block is byte-identical.
Proved by the hevc-guest merge build (HOSTED_OUT=hevc): 0080 applies,
xnu.macho links, compare-golden.sh 17/17 + 11 hashes + stdout, kernel.kc
with audit 0 failures, image set built, 10-min PC boot with encoder=auto
clean (codec registered, cameracaptured 'encs' answered, no panic).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #48 (the host side). Draft: stopped by the owner before the PC boot finished. Do not merge yet.
Done and tested (Linux PC)
oneios-tool kernel gen codecbuildsliboneioscodec.a(UniXNU-droidvm'sDroidVMVirtioMedia.c,DroidVMVTParavirt.cpp,DroidVMVTHost.cppwith one edit,OneiOSCodec.c);kernel/build-hosted.shbuilds it afteraudioand force-loads it.cargo test ... --test golden13 of 13;compare-golden.shthe same afterUPDATE=1.xnu.macho972b9132...;kernel.kce4ffcabd1d95f25eb542b7226be3235ac2317743d667f22dcc094a5b59198d8b,audit: 2711 paired, 93 functions on the stub, 9 data unpaired; 0 failures;prelink stubs-check: 666 good, 0 bad. No pairing record was needed.DroidVMVTHost.cpp.make -C runtime/bridges/encoder test: 173 checks, ffmpeg decodes all 16 streams to exactly the picture given, and 214 device checks (through the helper process and in process). xnuhost runs it withencoder=autowhen the bridges are off (a PC boot) and withencoder=sim; xnuhost unit tests 14036 checks.runtime/package.sh(ELF and Apple-file checks pass):bin/oneios-encoder28,184 bytes,bin/encctl29,824 bytes as packaged before the lastencctlchange (the stage rebuilt after it passed the same checks).--set encoder=auto, its first 40 s:Changed but unproven
OneiOSCodec.c'scounters,messageandsessionlines are there to show it.DroidVMVTHost.cppon this iPhone build (upstream proved them on iPadOS 27).backend_ndk.c(NV12 ByteBuffer input toc2.qti.hevc.encoder), the helper,encctl.Still to do
encoder=autoand the same boot without it; count chronod'sCMPhotoCompressionSessionAddImage ... 'hvc1'errors and WidgetRenderer'sContent load failedinoneios-tool ioslogfor both. Three finished PC boots of other work have neither line at all, so the PC may not reach the widget snapshot without a GPU; then only the phone can show the count.encctl hevc,encctl h264 640 480as root, then a session withencoder=auto(runtime/bridges/encoder/README.md, "On the phone";kernel/patches/oneios-hosted/codec/README.md, "What a session on the phone must show").🤖 Generated with Claude Code