Repository navigation
fix(tonemap): ship Intel's legacy OpenCL runtime and log the probe result - #3660
Conversation
…sult Intel's current compute runtime only drives Gen12 and newer graphics, so on Gen8 to Gen11 GPUs (UHD 630, Jasper Lake) the QSV tone-map probe could not open an OpenCL device and every HDR transcode fell back to software. Install the legacy1 runtime and its IGC 1.x compiler alongside the current ones, as Jellyfin's image does, and retry the runtime downloads. The probe also dropped every smoke failure silently. Log one line per distinct result: the executors and source kinds that validated, a warning with the FFmpeg error when a configured hardware backend validated nothing, or a warning naming the command that ran out of time when the probe did not finish.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Successful HDR hardware tone-mapping test on Intel Gen9 (QNAP NAS)Hi! I tested this PR on my QNAP NAS with an older Intel Gen9 integrated GPU, Test environment
Previous behaviorBefore testing this PR, regular SDR transcoding using Intel QSV worked I had previously confirmed that Test source
Test 1: Hardware acceleration enabledWith hardware acceleration and hardware tone mapping enabled, Silo The playback dashboard reported: Playback information: Result: Playback worked with Silo reporting hardware-accelerated QSV This is a significant improvement over the previous behavior, where HDR Test 2: Hardware acceleration manually disabledFor comparison, I manually disabled hardware acceleration and hardware Silo reported: Result: Software transcoding and software tone mapping also worked. This was an intentional configuration change, not an unexpected Test 3: Hardware acceleration re-enabledAfter the software test, I enabled hardware acceleration and hardware Silo automatically selected the hardware transcoding path by default. Summary
Test 4: FFmpeg OpenCL filter-chain verificationWhile the HDR video was actively playing with hardware acceleration enabled, I inspected the running FFmpeg process inside the test container (PID 3688). The live process arguments explicitly contained: opencl=ocl@va And the following hardware tone-mapping pipeline: hwmap=derive_device=opencl:mode=read, Verified: OpenCL is initialized using the VA-API device. The active FFmpeg filter graph explicitly includes tonemap_opencl. HDR tone mapping uses the BT.2390 algorithm. Output color parameters are set to BT.709 (SDR). Hardware frames are mapped back to VA-API and QSV for encoding. Conclusion: The live FFmpeg process confirms that Silo selects tonemap_opencl for HDR-to-SDR transcoding on my Intel Gen9 GPU (8086:9BE6). Combined with successful playback and Silo reporting HW QSV and Tone mapping: Hardware, this provides strong evidence that the OpenCL hardware tone-mapping pipeline works on this GPU with PR #3660. ConclusionThis PR looks very promising for older Intel GPUs. Previously, HDR transcoding was blocked by the missing validated tone-mapping recipe. With this PR, Silo now automatically selects and successfully plays through a hardware-accelerated HDR transcoding path on my Intel Gen9 GPU. Thank you for your work on improving support for older Intel hardware! |
… one The fake Jellyfin server moved item-250 only after writing the first page. The client can decode that page and request the next one before the handler returns, so on a busy runner page two came from the unmoved list, the read never restarted, and TestJellyfinFetchPlayedSince_RestartsWhenAPlayMovesTheList failed. Move the list first and guard it with a mutex.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Review summaryReviewed head: What I checked
Answered without a change
Left for maintainers
Validation: no case on #1172 to #1175 has passed yet; every case is still not run. The User manual: no change needed. The playback page already says hardware tone mapping runs once Silo has tested that the GPU can do it, and no page lists supported Intel generations. Apple/Android: not affected; this is server-side only. Fit: 8/10 · Readiness: 7/10 — conditional
Cross-provider review: one round (Codex, gpt-6.1-sol) on 🤖 Claude Code (claude-opus-5-5) |
Problem
Closes #3630
Closes #610
Related issue: #1171
Validation tasks: unblocks #1173 C3 and #1174 C3 on Gen8 to Gen11 Intel GPUs; can reach a passed C3 result on newer Intel GPUs, which now have a second OpenCL ICD installed beside the one they use
On Intel GPUs from Gen8 to Gen11 (UHD 630, Jasper Lake and the Celerons in a lot of NAS boxes), hardware HDR tone mapping never works. Silo detects QSV and SDR transcodes run on the GPU, but every HDR to SDR transcode falls back to
libx264withtonemapx. With software tone mapping turned off, playback is refused with "no validated HDR-preserving or tone-map recipe is installed". Nothing in the log says why.Intel HDR tone mapping goes through
tonemap_opencl, and the image only ships Intel's current compute runtime (26.18). That runtime dropped Gen8 to Gen11, so the probe's-init_hw_device opencl=ocl@vafails with "No such device". The probe throws its smoke failures away, so the operator is left with a software session and no reason.This change installs Intel's legacy runtime alongside the current one, and makes the probe log what it validated and why hardware failed.
Approach
DockerfileandDockerfile.dev(amd64 only) now also installintel-opencl-icd-legacy124.35.30872.36 and its IGC 1.0.17537.24 compiler, the same packages and versions Jellyfin's image uses for these GPUs. They sit next to the current runtime with their own ICD file, so newer GPUs keep using the runtime they use today. The runtime downloads also retry now, like the PGDG key fetch already does.internal/tonemaplogs the probe result once per distinct outcome:An incomplete result is re-probed every 15 seconds, and a probe that times out runs again on the next request, so the lines are de-duplicated by the probe cache key and only repeat when the result changes. FFmpeg's
@ 0x…pointers are stripped from the error first, because they differ on every run. Playback behaviour and the capability results are unchanged.One unrelated test fix rides along:
TestJellyfinFetchPlayedSince_RestartsWhenAPlayMovesTheListfailed on this PR twice in a row. Its fake Jellyfin server moved an item only after writing the first page, so a client that had already decoded that page could fetch the next one from the unmoved list. The server now moves the item before writing and guards the list with a mutex. I can split it into its own PR if you'd rather.Validating Intel's VAAPI tone mapper as a fallback when OpenCL is missing (also suggested on #610) would bring back the colour problems from #2414, so I left it out.
Validation
go test ./internal/tonemap/ -count=1andgo vet ./internal/tonemap/pass.internal/playback,internal/transcodenodeandinternal/downloadsbuild. The new test covers a probe that times out, a hardware smoke that fails with a changing FFmpeg pointer, an unchanged re-probe that must not log again, and a recovered GPU.go test -race ./internal/historyimport/ -run TestJellyfinFetchPlayedSince -count=50passes with the test fix, and the whole package passes.docker buildon my test host (BuildKit can't apply AppArmor profiles inside its LXC container). Instead I took my current image, which has the same Dockerfile andinternal/tonemapasmain, and ran this branch's new Intel runtimeRUNstep on it unchanged, apart from where the packages came from. The three legacy packages installed beside the current ones with no conflicts.github.com/<owner>/<repo>/releases/downloadURLs were returning 504 from two networks at the time, so I fetched the same seven.debfiles through the GitHub API. The first full image build ofmainafter merge is the real check of the Dockerfile.Evidence
Same host, GPU and FFmpeg build, with the image I run today (before) and the same image plus this branch's runtime step and probe (after). The probe was run through a small throwaway helper that calls
tonemap.Probedirectly and prints the result. Pointers and the PCI address are trimmed.Surface and build: server log and container contents, before = image built from
mainwith the Dockerfile andinternal/tonemapunchanged, after = that image plus commit e48d410.OpenCL runtime in the image
intel-opencl-icd 26.18.38308.1-0intel-igc-core-2 2.34.4intel-igc-opencl-2 2.34.4ICDs:
intel.icdintel-opencl-icd 26.18.38308.1-0intel-opencl-icd-legacy1 24.35.30872.36intel-igc-core-2 2.34.4,intel-igc-core 1.0.17537.24intel-igc-opencl-2 2.34.4,intel-igc-opencl 1.0.17537.24ICDs:
intel.icd,intel_legacy1.icd-init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl=ocl@va: opensProbe result when OpenCL can't open the GPU (ICDs hidden, the failure Gen8 to Gen11 GPUs hit today)
Before, the probe silently returns software only:
After, the same result plus a warning:
Probe that runs out of time (Arc A310, QSV)
Before, there was nothing in the log, and callers got
context deadline exceeded. After:Benchmarks
Not applicable to playback speed: no transcode path changes. Image size goes up by about 535 MiB (Installed-Size:
intel-igc-core262,121 KiB,intel-igc-opencl273,680 KiB,intel-opencl-icd-legacy110,551 KiB). On my test image that took it from 2.63 GB to 3.17 GB.Risks
.debdownloads aren't checksum-pinned. That was already true, and this change adds three more.Checklist
AI Disclosure
Note
Ship Intel's legacy OpenCL runtime and log tonemap probe results
hardwareProbeVerdictduring probing: selected hardware filter, missing FFmpeg prerequisites, first smoke-conversion failure text (normalized, bounded to 300 bytes), and the first timed-out command categoryInvalidateProbeCacheclears the de-duplication map so re-probes after invalidation can log againsmokeSourceKindsandhardwareSmokeSourceKindsreturn an extra failure-text value; check callers in probe.go and the updated tests in probe_test.goMacroscope summarized 75e561d.