Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions GPU/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

The encoding fix keeps its own history in `encode/CHANGELOG.md`.

## JPEG decoder 1.0.0 (not released; host tests only, not booted)

- New, optional, macOS 26.7.3 only: `VCNJpeg.kext` (`jpeg/`) and the VideoToolbox plug-in
`JPEGVCNDecoder.bundle` (`decode/jpeg/`) decode JPEG and Motion JPEG (`jpeg`, `dmb1`) on
the JPEG block of the VCN, which Apple's driver carries but never starts. Baseline 4:2:0
and 4:2:2; anything else goes to Apple's software decoder.
- The kext creates the JPEG queue and a 128 MiB block of buffers (`vcnjpegpool=<MiB>`, 8 to
128) when the driver starts its video queues, and powers the block only while pictures
arrive: PowerPlay client 21 and the queue start with the first picture, both are given
back two seconds after the last one.
- Off by default: `install/install.sh --with-jpeg`, or `install/jpeg.sh install` and
`install/decoders.sh install --jpeg`. The package carries them only when built with
`VCNVT_JPEG_DECODER=1`. The loader kext lists the JPEG plug-in too.
- It comes from the test kext that decoded through the same plug-in on an RX 6800 XT
(4:2:0, 4:2:2 and `dmb1` at 1280x720, under 5 ms a frame, within 1 of FFmpeg). The
product kext itself has not run yet.

## Decoders 0.3.5 (RyzenStatus 1.89.0)

- The `stats` line's slow-frame count now uses the stream's own frame time. It used to count
Expand Down
3 changes: 3 additions & 0 deletions GPU/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ without replacing any Apple driver:
| **Decoders** (`decode/`) | Safari and Chrome play AV1 and VP9 video (YouTube up to 4K60 and 8K) on the GPU instead of the CPU | Two of macOS's VideoToolbox plug-ins that send AV1 and VP9 to the card's video engine through Apple's own driver |
| **Encoding fix** (`encode/`, optional) | Hardware HEVC/H.264 encoding at full speed: OBS at 4K60 without repeated frames, sizes wider than 4096 without GPU stalls | A small kernel extension for Lilu (a kext OpenCore loads, 1.7.0 or newer) that keeps the video engine's clocks up while encoding, and a service that corrects two settings in Apple's encoder process |
| **GPU sensors** (`sensors/`, optional) | Edge, memory and VR temperatures, voltages, throttling, video and fabric clocks, and PCIe link | A Lilu kernel extension that publishes the readings Apple's AMD driver already takes and hides, and `gpusensors` to print them |
| **JPEG decoder** (`jpeg/`, optional, macOS 26.7.3 only) | Motion JPEG (webcam recordings, camera clips) decoded on the GPU in apps that use VideoToolbox | A Lilu kernel extension that starts the card's JPEG block, which Apple's driver carries but never uses, and a VideoToolbox plug-in for `jpeg` and `dmb1` |
| **Installer app** (`installer/`, optional) | Graphical front end for checking, installing, updating and removing each part | A SwiftUI app for the command-line tools in `install/` |

## Before you start
Expand All @@ -38,6 +39,7 @@ Inc.
| Encoding fix kext (`encode/kext/`) | 1.3.0 (code as 1.2.6) | RX 6800 XT (Tahoe 26.7.3); 1.2.1 reported on RX 6900 XT (Sequoia 15.8.3); Navi 23 static only |
| Encoding fix service (`encode/tool/`) | 1.3.0 | RX 6800 XT (Tahoe 26.7.3; FaceTime encoder part in a test process); 1.2.1 reported on RX 6900 XT (Sequoia 15.8.3); cc decoder part run with an iPhone camera on RX 6900 XT (15.8.2) |
| GPU sensors kext (`sensors/`) | 0.8.1 | 0.8.0 on RX 6800 XT (Tahoe 26.7.3) |
| JPEG decoder kext (`jpeg/`) | 1.0.0 | not run yet; the test kext it comes from decoded through the same plug-in on RX 6800 XT (Tahoe 26.7.3) |

Full test results, dates and what has never been tried are in [docs/status.md](docs/status.md).

Expand Down Expand Up @@ -102,6 +104,7 @@ in [install/README.md](install/README.md#undo-everything).
| `decode/` | The two decoder plug-ins: `av1/`, `vp9/`, the code they share in `common/`, the kext that lets them load without AMFIPass in `loader/`, and their tests |
| `encode/` | The encoding fix: `kext/`, the service in `tool/`, a test encoder in `vtenc/`, its scripts and tests |
| `sensors/` | The GPU sensors: a kext that publishes the readings the driver takes and hides, and `gpusensors` to show them |
| `jpeg/` | The JPEG decoder kext; its VideoToolbox plug-in is in `decode/jpeg/` |
| `install/` | Command-line installers and the list of validated macOS builds |
| `installer/` | Graphical installer app (SwiftUI front end for `install/`) |
| `tools/` | Dependency bootstrap, the repository cleanliness check, formatting, binary comparison, driver validation helpers |
Expand Down
12 changes: 9 additions & 3 deletions GPU/build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#!/bin/zsh
# build.sh - builds every part of the repository. Installs nothing.
#
# ./build.sh the decoders, their loader kext, the GPU sensors and the encoding fix
# ./build.sh the decoders, their loader kext, the GPU sensors, the encoding fix and
# the JPEG decoder kext
# ./build.sh decode only the decoders
# ./build.sh loader only the loader kext (needs tools/bootstrap.sh once)
# ./build.sh sensors only the GPU sensors (the kext needs tools/bootstrap.sh once)
# ./build.sh encode only the encoding fix (needs tools/bootstrap.sh once)
# ./build.sh jpeg only the JPEG decoder kext (needs tools/bootstrap.sh once)
emulate -L zsh
setopt err_exit no_unset pipe_fail
cd "${0:A:h}"
what=${1:-all}
case $what in
all|decode|loader|sensors|encode) ;;
*) print "usage: ./build.sh [decode|loader|sensors|encode]"; exit 2 ;;
all|decode|loader|sensors|encode|jpeg) ;;
*) print "usage: ./build.sh [decode|loader|sensors|encode|jpeg]"; exit 2 ;;
esac
if [[ $what == (all|decode) ]]; then
print "== decoders"
Expand All @@ -30,3 +32,7 @@ if [[ $what == (all|encode) ]]; then
print "== encoding fix"
encode/build.sh
fi
if [[ $what == (all|jpeg) ]]; then
print "== JPEG decoder kext"
jpeg/build.sh
fi
10 changes: 8 additions & 2 deletions GPU/decode/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# VP9VCNDecoder.bundle vp09 on the same block
# MPEG2VCNDecoder.bundle mp2v, VC1VCNDecoder.bundle vc-1/WVC1/WMV3 and
# MPEG4VCNDecoder.bundle mp4v on the same block (common/vcnlegacy.c)
# JPEGVCNDecoder.bundle jpeg and dmb1 on the JPEG block of the VCN, through the VCNJpeg kext
# (jpeg/); installed only on request (install/decoders.sh --jpeg)
# lvprobe the installer's helper that asks macOS whether it would accept them
# kextentry the installers' helper that edits OpenCore's config.plist for the
# loader kext and the sensors kext
Expand Down Expand Up @@ -57,6 +59,7 @@ LEGACY=(common/vcnlegacy.c common/vcndriver.c common/vcnsession.c)
build_bundle MPEG2VCNDecoder mpeg2 mpeg2/MPEG2VCNDecoder.c mpeg2/vcnmpeg2.c mpeg2/mpeg2parse.c $LEGACY
build_bundle VC1VCNDecoder vc1 vc1/VC1VCNDecoder.c vc1/vcnvc1.c vc1/vc1parse.c $LEGACY
build_bundle MPEG4VCNDecoder mpeg4 mpeg4/MPEG4VCNDecoder.c mpeg4/vcnmpeg4.c mpeg4/mpeg4parse.c $LEGACY
build_bundle JPEGVCNDecoder jpeg jpeg/JPEGVCNDecoder.c jpeg/vcnjpeg.c jpeg/jpegprep.c

# lvprobe (install/lvprobe.c) asks macOS whether it would accept a plug-in; the installer
# runs it. It must carry the library-validation flag, or the kernel says yes to everything.
Expand Down Expand Up @@ -84,8 +87,8 @@ if [[ ${1:-} == tests ]]; then
xcrun clang $TFLAGS -Iav1 -Ivp9 -Icommon tests/colortest.c av1/av1parse.c vp9/vp9parse.c \
-framework CoreFoundation -framework CoreMedia -framework CoreVideo -o $T/colortest
xcrun clang $TFLAGS -Ivp9 tests/vp9state.c vp9/vp9parse.c -o $T/vp9state
for c in AV1 VP9; do
xcrun clang $TFLAGS -DTEST_$c -Icommon tests/plugintest.c -framework CoreFoundation -framework CoreMedia \
for c in AV1 VP9 JPEG; do
xcrun clang $TFLAGS -DTEST_$c -Icommon -Ijpeg tests/plugintest.c -framework CoreFoundation -framework CoreMedia \
-framework CoreVideo -framework VideoToolbox -o $T/plugintest-${(L)c}
done
for c in MPEG2 VC1 MPEG4; do
Expand Down Expand Up @@ -117,6 +120,9 @@ if [[ ${1:-} == tests ]]; then
common/vcnsession.c -framework CoreFoundation -framework CoreVideo -framework IOKit \
-framework IOSurface -o $T/sessiontest-$c
done
# The JPEG plug-in's preparer and session against a made-up kext (it is tested also when it is not built).
xcrun clang $TFLAGS -Ijpeg tests/jpegtest.c jpeg/vcnjpeg.c jpeg/jpegprep.c -framework CoreFoundation \
-framework CoreVideo -framework CoreGraphics -framework ImageIO -framework IOKit -o $T/jpegtest
xcrun clang++ -std=c++17 $TFLAGS -Iloader tests/loadertest.cpp -o $T/loadertest
print "built the test programs in decode/$T"
fi
81 changes: 81 additions & 0 deletions GPU/decode/jpeg/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>JPEGVCNDecoder</string>
<key>CFBundleIdentifier</key>
<string>com.droga.videodecoder.jpeg.vcn</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>JPEGVCNDecoder</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>__VERSION__</string>
<key>CFBundleVersion</key>
<string>__VERSION__</string>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
<key>CMClassImplementations</key>
<array>
<dict>
<key>CMClassID</key>
<string>com.apple.videotoolbox.videodecoder</string>
<key>CMClassImplementationID</key>
<string>com.droga.videodecoder.jpeg.vcn</string>
<key>CMClassImplementationName</key>
<string>AMD VCN JPEG Decoder</string>
<key>CMClassImplementationVersion</key>
<integer>1</integer>
<key>CMExecutableArchitectures</key>
<array>
<string>x86_64</string>
</array>
<key>CMFactoryFunction</key>
<string>JPEGVCN_VTDecoder_CreateInstance</string>
<key>CMManufacturer</key>
<string>droga</string>
<key>CMMatchingInfo</key>
<dict>
<key>VTCodecType</key>
<string>jpeg</string>
<key>VTIsHardwareAccelerated</key>
<true/>
<key>VTRating</key>
<integer>400</integer>
</dict>
</dict>
<dict>
<key>CMClassID</key>
<string>com.apple.videotoolbox.videodecoder</string>
<key>CMClassImplementationID</key>
<string>com.droga.videodecoder.dmb1.vcn</string>
<key>CMClassImplementationName</key>
<string>AMD VCN Motion JPEG (OpenDML) Decoder</string>
<key>CMClassImplementationVersion</key>
<integer>1</integer>
<key>CMExecutableArchitectures</key>
<array>
<string>x86_64</string>
</array>
<key>CMFactoryFunction</key>
<string>JPEGVCN_VTDecoder_CreateInstance</string>
<key>CMManufacturer</key>
<string>droga</string>
<key>CMMatchingInfo</key>
<dict>
<key>VTCodecType</key>
<string>dmb1</string>
<key>VTIsHardwareAccelerated</key>
<true/>
<key>VTRating</key>
<integer>400</integer>
</dict>
</dict>
</array>
</dict>
</plist>
Loading
Loading