refactor(host/W6.1): extract GPU vendor/adapter detection into the pf-gpu leaf crate

Fourth de-coupling for the host crate carve (plan §W6.1 leaf). gpu.rs (inventory,
selection preference, active-session accounting — deps only pf-host-config + pf-paths, no
subsystem refs) moves to a new pf-gpu leaf so pf-encode/pf-capture/pf-vdisplay can consult
the selected GPU without an orchestrator edge. ~50 crate::gpu:: sites repoint to pf_gpu::;
the ~30 pub(crate) items become pub (crate API). assign_ids gets a macOS-only
allow(dead_code) (used only by the Linux/Windows enumerate arms).

Verified: Linux (home-worker-5) clippy -p pf-gpu -p punktfunk-host --all-targets
-D warnings + pf-gpu tests (12 pass); Windows (192.168.1.158) clippy --features
nvenc,amf-qsv --all-targets green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-17 09:00:53 +02:00
parent 3495d189e1
commit 6ea036766a
12 changed files with 126 additions and 83 deletions
@@ -16,11 +16,11 @@ use windows::Win32::Foundation::LUID;
/// Pick the render GPU LUID the pipeline is created on: the IDD-push capturer's shared-texture
/// ring, the IddCx SET_RENDER_ADAPTER pin, and (via the captured frame's device) NVENC/AMF/QSV all
/// follow this one decision — see [`crate::gpu::selected_gpu`] for the precedence. A configured
/// follow this one decision — see [`pf_gpu::selected_gpu`] for the precedence. A configured
/// preference that doesn't match a present GPU falls back to auto selection (with a warning)
/// rather than returning `None`, so a stale preference never stops the host from streaming.
pub(crate) fn resolve_render_adapter_luid() -> Option<LUID> {
match crate::gpu::selected_gpu() {
match pf_gpu::selected_gpu() {
Some(sel) => {
tracing::info!(
adapter = sel.info.name,
@@ -28,7 +28,7 @@ pub(crate) fn resolve_render_adapter_luid() -> Option<LUID> {
source = sel.source.tag(),
"render adapter selected"
);
if sel.source == crate::gpu::PickSource::PreferenceMissing {
if sel.source == pf_gpu::PickSource::PreferenceMissing {
tracing::warn!(
"the preferred GPU is not present — auto-selected the adapter above \
(fix or clear the preference in the web console)"