Skip to content

graphics: swap planar capability queries to safe Rust (Refs #5218) - #5227

Merged
zackees merged 2 commits into
masterfrom
port/5218-planar-capability-queries
Nov 19, 2026
Merged

zackees merged 2 commits into
masterfrom
port/5218-planar-capability-queries

Conversation

@zackees

@zackees zackees commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Refs #5218. Replace the extracted NV12/P010 availability queries with a safe Rust core and thin ABI shims in obs-graphics. The core rejects a missing TLS context before reading fields, preserves the existing LOG_DEBUG diagnostic, checks the matching optional callback before dispatch, and returns its boolean unchanged with the exact current-context device. Both callbacks remain independent. The existing graphics device-query seam and its demand-linked support archive provide the real C layout access for libobs and standalone Rust-static consumers.

The original function bodies remain reference-only, and a byte-identical legacy copy supplies the C oracle. Public headers, existing C tests and the WebSocket plugin are unchanged. All capability expectations use fake devices; this does not assert actual host NV12/P010 support. There are no intentional behavior differences or new public layouts. Tier 4 does not apply to these non-protocol queries.

RED d556394 fails all three Tier 1 mirrors at the stub. GREEN e0692e8 passes all 1,030 graphics tests and all 320 native_build:: tests. Tier 3 compares all 64 context/callback/result/device combinations and bounded random query sequences through the real ABI and adapters. Inverting the callback result fails both differential tests; restoring it returns the tests to GREEN. One clud-review primary reviewer found no issues.

Test cost: the five new tests ran 25 times with reduced parity; longest 0.029 seconds, peak RSS 9,284 KiB, no own threads. They remain modules in the existing Graphics category binary.

Focused Linux Tier 2 built hybrid libobs, the C reference, the frozen characterization and every one of the 64 configured *_rust targets. The characterization passed 25 repeats per implementation, and both libraries expose the same 1,769 dynamic symbols.

ci/windows_link_check.py passed: Windows MSVC Rust category binaries, plus hybrid libobs and all 55 configured *_rust fixtures on each Windows MSVC x64 and Darwin ARM64. These are cross-link checks; native Windows/macOS execution and the full cmocka suite remain with hosted validation.

soldr cargo fmt --all --check and the single full SOLDR_PORCELAIN=0 ./lint run passed; lint completed in 405.0 seconds. Final forced-refspec merge-tree checks are clean against current master, which includes merged #5222. Held #5155 has only its 16 pre-existing conflicts; the temporary refs were deleted.

Complete client gates passed before publication: Clippy and Dylint on all six supported targets, repository validators, 9,163 host tests (six skipped), 920 additional feature tests (none skipped), workspace doctests and GNU Windows category links. The final head was signed after stamping the 19 client attestation records.

Refs #5218. Mirror the unchanged fake-device characterization in the existing Graphics category binary before implementing the swap.
Reuse the existing device-query context, logging and demand-linked adapter seam. Preserve the frozen C characterization and original oracle bodies; cover every fake-device/callback/result combination and bounded query sequences. The inverted-callback mutation fails both differential tests.

Ci-Attestation: {"at":1795085856,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"db8898d9e524e7ed3a7e69a47fd1c7f5","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085856,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"b23abb311e26701cfde86bf97206fce9","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085856,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"671ca01fff32806af391f66944d714ed","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085856,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"161ea8f5fccc9b3afa868571c3e2bec1","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"general/all/client-lint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"abddbb3a29b4f7f61fb2b0c21bd4f470","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085856,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"531a92504ca123f17be3b31fc037996c","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085743,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"56ad2a4742ace71afe2bb5a157273d36","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085743,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"6f6dc864ecb0657242d97e20776acfc8","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"3a8027210998fce2d610193c66276b70","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"1cc4fa24b171beb9b2a87049431f66f1","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"f5f4080c37131cb910b89f50084384f0","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"60169cf33aa6a22f907be83948df7282","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"00c182afdc2d9d5f1ab2b7fe8a1ba0ee","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085743,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"ef0578d4edf29656ab9f841e9c603d69","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"d97201dd09a83da7311f3bc936206062","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"0d5fb05d3e3423c368325dfa79bfb5b8","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"31162d12b27d5757d82440943f93e27e","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"1b54412ef7df28dc829fa2d0e71b47ec","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}
Ci-Attestation: {"at":1795086579,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"5a103e8c0d14fc05ad18500f25f96e30a2ce0345c6a0a27ba178974464af911d","lane":"client-test-x86_64-unknown-linux-gnu","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":721,"stamp":"3235240423fbd61c503bb630fbfe3089","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"d8f5045f0882951a2806b9decaf82b97cac656b6","coverage":"all-tracked-applicable-files","diff":[".github/workflows/build-project.yaml","ci/test_ci_job_timeouts.py","ci/test_tier2_apt_cache.py","libobs/build/libobs.core+.h.c","libobs/build/libobs.graphics+.h.c","libobs/build/libobs.graphics-image-max-size+.h.c","libobs/build/libobs.media+.h.c","libobs/build/libobs.media-image-orientation-fields+.h.c","libobs/build/libobs.media-texture-file-data-convert+.h.c","libobs/build/libobs.media-texture-file-data-session+.h.c","libobs/build/libobs.ported-graphics-planar-capability-queries+.h.c","libobs/build/libobs.ported-hotkey-unregister-entry+.h.c","libobs/build/libobs.ported-video-level-queries+.h.c","libobs/build/modules.d/graphics.json","libobs/build/modules.d/media.json","libobs/build/ported-source-sets/graphics-planar-capability-queries.json","libobs/build/ported-source-sets/hotkey-unregister-entry.json","libobs/build/ported-source-sets/video-level-queries.json","libobs/build/source-sets.d/LIBOBS_SOURCES.json","libobs/cmake/rust-exports.d/obs-core-video_level_queries.txt","libobs/cmake/rust-exports.d/obs-graphics-planar_capability_queries.txt","libobs/cmake/rust-exports.d/obs-hotkey-unregister_entry.txt","libobs/cmake/rust-hidden.d/obs-core-video_level_queries.txt","libobs/cmake/rust-hidden.d/obs-hotkey-unregister_entry.txt","libobs/graphics/graphics-device-queries-fields.c.h","libobs/graphics/graphics-ffmpeg.c.h","libobs/graphics/graphics-image-max-size.c.h","libobs/graphics/graphics-planar-capability-queries.c.h","libobs/graphics/graphics-texture-file-data-adapter.c.h","libobs/graphics/graphics-texture-file-data-convert.c.h","libobs/graphics/graphics.c.h","libobs/obs-hotkey-unregister-entry-fields.c.h","libobs/obs-video-level-queries-fields.c.h","rust/README.md","rust/obs-build/tests/native/registration/headless_characterizations_expected.json","rust/obs-build/tests/native/registration/portal_output_expected.json","rust/obs-build/tests/native/registration/rust-static/cases/core-relinked/test_video_level_queries.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_enum.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_press.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_trigger.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_binding_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_getters_characterization.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_load.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_pair_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_unregister_entry.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_portal_shortcuts.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_wayland_hotkeys.json","rust/obs-build/tests/native/registration/rust_static_entries.rs","rust/obs-c-oracle/legacy/graphics-planar-capability-queries.c","rust/obs-c-oracle/oracle.d/graphics-planar-capability-queries.list","rust/obs-c-oracle/oracle.d/hotkey_unregister_entry.list","rust/obs-c-oracle/oracle/device_queries.c","rust/obs-c-oracle/oracle/hotkey_unregister_entry.c","rust/obs-c-oracle/oracle/hotkey_unregister_entry_links.c","rust/obs-c-oracle/oracle/source_deinterlace_links.c","rust/obs-c-oracle/oracle/video_level_queries.c","rust/obs-core/src/ffi/mod.rs","rust/obs-core/src/ffi/video_level_queries.rs","rust/obs-core/src/lib.rs","rust/obs-core/src/video_level_queries.rs","rust/obs-core/tests/obs_core/main.rs","rust/obs-core/tests/obs_core/video_level_queries.rs","rust/obs-core/tests/obs_core/video_level_queries_parity.rs","rust/obs-graphics/src/ffi/mod.rs","rust/obs-graphics/src/ffi/planar_capability_queries.rs","rust/obs-graphics/src/lib.rs","rust/obs-graphics/src/planar_capability_queries.rs","rust/obs-graphics/tests/render/main.rs","rust/obs-graphics/tests/render/planar_capability_queries.rs","rust/obs-graphics/tests/render/planar_capability_queries_parity.rs","rust/obs-hotkey/src/ffi/mod.rs","rust/obs-hotkey/src/ffi/unregister_entry.rs","rust/obs-hotkey/src/lib.rs","rust/obs-hotkey/src/unregister_entry.rs","rust/obs-hotkey/tests/hotkey/main.rs","rust/obs-hotkey/tests/hotkey/unregister_entry.rs","rust/obs-hotkey/tests/hotkey/unregister_entry_parity.rs","test/cmocka/build/test-graph.json","test/cmocka/test_image_max_texture_size.c","test/cmocka/tests.d/test_image_max_texture_size.cmake","test/cmocka/tests.d/video_level_queries_link_support.cmake"],"head":"f0d86d0f152b3e5f553ce3f94132523493e8f1e2","tools":{"orchestrator-python":"3.14.7 (main, Aug 14 2026, 15:35:28) [Clang 22.1.3 ]","schema-dependencies":"3.14.7 (main, Aug 14 2026, 15:35:28) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"18cc6c540ba8517cd11d3a27d79e777bae9b7a97157a036f75937e978b4dbc6f","tree":"a176f618e07f56d4b173df8303b18797915f7e1a"}}
@zackees zackees added the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 19, 2026
@zackees
zackees enabled auto-merge November 19, 2026 11:10
@zackees zackees removed the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 19, 2026
@zackees
zackees added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit e6942ba Nov 19, 2026
42 checks passed
@zackees
zackees deleted the port/5218-planar-capability-queries branch November 19, 2026 12:09
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.

1 participant