Skip to main content

install

Function install 

Source
pub fn install()
Expand description

Install the GET_ATTACHED_IDS/GET_PROBED_IDS GOT filter, at most once and only when a host GPU is hidden from the container. Idempotent and safe to call before every NVENC session open (guarded by a Once).

  1. Escape hatch: if PIXELFLUX_DISABLE_GPU_FILTER is set, log and return without patching (also useful for A/B testing the filter).
  2. Cache the nvidiactl identity: stat /dev/nvidiactl and store its rdev in NVIDIACTL_RDEV so the ioctl hook can later verify an fd’s identity before rewriting. If the stat fails the value stays 0, which makes the hook skip that identity gate.
  3. Patch only when needed: if has_hidden_gpus() reports GPUs hidden from the container, run dl_iterate_phdr over patch_phdr_cb to repoint the ioctl GOT slots in the targeted NVIDIA libraries. Otherwise nothing is patched — the filter is a strict no-op.