Skip to content

obs-nvenc: Reuse obs-nvenc-test's answer while the driver, GPUs and test are unchanged - #1176

Merged
zackees merged 2 commits into
masterfrom
fix/nvenc-caps-cache
Oct 17, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/nvenc-caps-cache

Conversation

@zackees

@zackees zackees commented Oct 17, 2026

Copy link
Copy Markdown
Member

Fixes #1170

RED: test_nvenc_caps_cache against stubs fails saved_caps_are_read_back_for_their_key, key_names_driver_and_nvidia_gpus, key_changes_with_driver_gpus_and_test. GREEN: 6/6 (fake sysfs fixture).

Cache file nvenc-caps-cache.ini in obs-nvenc's config dir: key = kernel driver version, every NVIDIA display controller (slot=device id, bus order), test program size:mtime; only successful answers are kept. Windows: no key, test runs as before (nvenc-caps-cache-windows.c).

Measured (with #1168): launch → window 1.43 s → 1.14 s; nvenc_check 300 ms → 1.5 ms. Verified an NVENC H.264 recording (simple output, obs-nvenc encoder) made from the cached answer.

…st (RED, Refs #1170)

test_nvenc_caps_cache (tests.d) checks the cache file format and the key built
from a fake sysfs (driver version, NVIDIA display controllers in bus order,
test program identity) against stubs in nvenc-caps-cache*.c.h, their own
unity groups (BUILD.md) so the test builds them without CUDA or NVENC. Fails:
saved_caps_are_read_back_for_their_key, key_names_driver_and_nvidia_gpus,
key_changes_with_driver_gpus_and_test.
@zackees
zackees force-pushed the fix/nvenc-caps-cache branch from 64c245c to 070a3f3 Compare October 17, 2026 06:43
@zackees

zackees commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Rebuilt on master after the BUILD.md unity-group conversion of this plugin (and #1184's Fast Gate fix): the policy/cache code is now .c.h files in their own small groups (so the cmocka test builds them without libva/CUDA), new includes are in the group precompiled headers, and the test is a test/cmocka/tests.d fragment. Same RED → GREEN commits and behavior; re-measured on this build.

…est are unchanged (GREEN, Fixes #1170)

obs-nvenc-test initialises CUDA and opens an encoder session on every GPU,
~0.3 s at every start, and OBS reads only static capabilities from it. A
successful answer is now kept in obs-nvenc's config directory
(nvenc-caps-cache.ini) with a key of the kernel driver version, every NVIDIA
display controller on the PCI bus and the test program's size and mtime; the
test runs again when any of them changes. Failures are never kept. Windows has
no key yet and runs the test as before.

Launch to main window (2x NVIDIA, after #1168): 1.43 s -> 1.07 s; nvenc_check
300 ms -> 1.5 ms. An NVENC H.264 recording made from the cached answer plays.
test_nvenc_caps_cache: 6/6.
@zackees
zackees force-pushed the fix/nvenc-caps-cache branch from 070a3f3 to 8ee6317 Compare October 17, 2026 07:05
@zackees
zackees merged commit 481af19 into master Oct 17, 2026
29 checks passed
@zackees
zackees deleted the fix/nvenc-caps-cache branch October 26, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

obs-nvenc: obs-nvenc-test costs ~0.3 s at every start for an answer that rarely changes

1 participant