Repository navigation
drm/imagination: apple: share S8003 PM pools between VMs - #121
Merged
Merged
Conversation
Account for live PM pool objects, including replacements prepared for a later geometry job. Expose that total and each reserved set's capacity, last firmware feedback and control words through apple_jobs. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
The A9 firmware runs one scene at a time per VM. The job dependency code orders a VM's geometry after the previous VM's fragment work, so up to two scenes can be live on the two sets of one VM. Each set's free list names the PM pages directly. Share one pool per set index between VMs, as the A10 shares free-list pages. This keeps 128 blocks per scene and limits pinned PM pool memory to 32 MiB, down from 16 MiB per allocated set. Count any wait for a previous user of a shared pool and retain per-set allocation behind apple_pm_shared=0. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
This was referenced Dec 3, 2026
|
Merged, thank you Berkay! Sharing one PM pool per set index between VMs means far less pinned memory per app, and the pool report in What changed after the merge: your fork doesn't accept maintainer pushes, so the cleanup landed as a follow-up in #141:
Nothing else was left out. One small follow-up you could pick up: with sharing always on, the per-set pool growth path in Follow-up: the device numbers came from your integration kernel. A run of the merged |
henrikklee
pushed a commit
to ricktav/linux
that referenced
this pull request
Dec 4, 2026
The coded-format table was the H.264 unit's own array, installed whole by apple_vxd_h264_register(). Make it a table of pointers in the device that each codec unit appends to with apple_vxd_register_coded_fmt(), so a second codec can sit next to H.264 without the core knowing about it. The first unit registered stays the default OUTPUT format. Add apple_vxd_buf_aux_cpu() and apple_vxd_buf_aux_size() next to apple_vxd_buf_aux_va(): a codec that keeps per-picture state in the CAPTURE side buffer needs to read and write it. apple_vxd_cmdbuf_pair_chunk_end() had no user. Make it match the HEVC per-picture chunk it was written for: AppleD5500 (0xfffffff0062b7ab0) zeroes 0x40 - (pairs & 7) * 8 bytes past the write pointer and neither counts them in the packet's byte count nor advances over them. H.264 output is unchanged: its host command-stream compare still matches the reference generator on all 76 pictures. [Orchard: from orchard PR OrchardLinux#121, commit 4016f5e; unchanged] Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com> Link: OrchardLinux/orchard#231 (comment)
henrikklee
pushed a commit
to ricktav/linux
that referenced
this pull request
Dec 4, 2026
AppleD5500 decodes HEVC with a register program of its own, distinct
from the AVC one: per slice segment a chunk with the 0x90000000
descriptor, the whole slice NAL by DMA ({0xb0000001, header bits, bytes}
and {0xa.., address}), the 0x30xx/0x34xx command registers and a slice
structure the core copies into the picture's slice parameter buffer
(0xf), each with a kind-1 packet (mailbox 0x81); then one chunk of
single register writes for the picture, the 0x50xx/0x54xx entropy and
0x70xx/0x71xx render registers with the output and reference surfaces
and the scaling lists, with a kind-4 packet (mailbox 0x88) that ends the
job. The layouts come from the iOS 16.7.10 kext (picture path
0xfffffff0062960a0, per slice 0x62b37d4, per picture 0x62b7ab0) and are
listed register by register in the comments.
This builds that program from the V4L2 HEVC controls. It is pure code,
like the H.264 builder, so it also builds on the host: a harness feeds
it x265 and VideoToolbox test streams and compares every command word,
slice structure and packet against an independent generator written from
the kext.
Supported: 8-bit 4:2:0, I/P/B, multiple and dependent slice segments,
tiles, WPP, long-term references, weighted prediction, PCM and scaling
lists. Refused: other chroma formats and bit depths (the Main 10 output
layout is not established), more than 15 references.
The 15 hardware reference slots are named by the V4L2 DPB index; the
kext numbers them in its own DPB order, which never leaves the host.
Nothing calls the builder yet.
[Orchard: from orchard PR OrchardLinux#121, commit 4016f5e; unchanged]
Assisted-by: LLM
Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
Link: OrchardLinux/orchard#231 (comment)
henrikklee
pushed a commit
to ricktav/linux
that referenced
this pull request
Dec 4, 2026
Expose V4L2_PIX_FMT_HEVC_SLICE next to H.264: frame-based decoding with Annex-B start codes (what FFmpeg's v4l2request hwaccel, GStreamer's v4l2slh265dec and libva-v4l2-request send), the SPS, PPS, SLICE_PARAMS, SCALING_MATRIX and DECODE_PARAMS controls, NV12 output. Per picture the unit locates the slice NALs in the OUTPUT buffer, resolves the DPB to CAPTURE buffers by timestamp and runs the builder. The slice header's length comes from data_byte_offset, which FFmpeg and libva count from the buffer and GStreamer from the slice's start code; both are accepted. ENTRY_POINT_OFFSETS is not offered: the hardware does not take them (the kext never reads them from its slice header). Buffers follow CHEVCDecoder: per context the four Genc buffers sized from the picture, the intra, aux-line and stream-state buffers and the slice structure buffer; per CAPTURE buffer the temporal MVs, fragment pointer table, above parameters and the record the co-located picture's words are read back from. The kext's 1 MiB slice parameter buffer per picture is one per context here, as it is only read while its picture decodes. The unit registers only when the SoC's match data gives the HEVC parameters, and not on core revision 0x70600 (S8000 A0/A1), which needs AppleD5500's BRN50577 dummy-picture workaround. [Orchard: from orchard PR OrchardLinux#121, commit 4016f5e; context adapted to main, which does not carry the VXD sleep patches of PR OrchardLinux#117] Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com> Link: OrchardLinux/orchard#231 (comment)
henrikklee
pushed a commit
to ricktav/linux
that referenced
this pull request
Dec 4, 2026
AppleD5500 advertises HEVCSupported for vxd-version 7, 9 and 10 and keys its HEVC choices on that version (VACreateDecodeDeviceHEVC, 0xfffffff006293f2c, called with the ADT vxd-version): the aux-line and stream-state buffers are scaled by 2 from version 9 on, versions 7 and 9 write 0x7474 twice after every slice structure, and the 0x701c line split starts from 0x1800 instead of 0xc00 from version 10 on. Give the S8000 (vxd-version 7, A9) and T8010 (10, A10) variants those values, which turns the HEVC unit on for both. The J71t decodes HEVC bit-exact against software decoding; the T8010 has not been tried yet. [Orchard: from orchard PR OrchardLinux#121, commit 4016f5e; the S8000 variant without the sleep_stop flag of PR OrchardLinux#117 (not on main); message updated: HEVC decodes on the J71t] Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com> Link: OrchardLinux/orchard#231 (comment)
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.
On the A9 every rendering VM pinned its own two PM pools, 16 MiB per allocated set. The firmware runs one scene at a time per VM, and the job dependency code orders a VM's geometry after the previous VM's fragment work, so at most two scenes are live at once across the system.
apple_jobs.guard_waits).powervr.apple_pm_shared=0restores per-set pools.Tested on the iPad 5 (j71t), 2026-12-02, booted with these two commits:
a9 pm pools bytes 33554432 shared 1.ctl24 4095, 128 × 32 − 1) at idle, after a glmark2 burst and after cross-client stress.guard_waits 0, no faults or timeouts.Built for j71t with Orchard's
kernel/build --kernel-tree(with the follow-up timestamp commit on top).How to test
On a stock Orchard install with this kernel:
A/B: boot with
powervr.apple_pm_shared=0. Expected on the iPad 5: the same scores, and PM memory no longer growing per client. A10: unchanged, because this is the S8003 (A9) path. The A10 already shares its free-list pages.