Documentation
¶
Overview ¶
Package gpu names graphics adapters across platforms so that capture and encode backends can agree on which device owns a frame.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
Adapter Adapter
// Handle is the ID3D11Device* on Windows. It is 0 on macOS, where
// IOSurfaces move between Metal, VideoToolbox and ScreenCaptureKit on
// their own.
Handle uintptr
}
Device is a GPU device that frames live on, shared by capture, encode, decode and presentation so a frame never leaves its GPU.
type LUID ¶
type LUID uint64
LUID identifies an adapter for the lifetime of a boot on Windows (DXGI adapter LUID). On macOS it is the Metal registry ID.
type PowerGuard ¶
type PowerGuard struct {
Adapter Adapter
Mode PowerMode
Reason error
// Executable is the program name the policy is bound to.
Executable string
// contains filtered or unexported fields
}
PowerGuard holds a GPU power policy until Close. It never fails to acquire: when the policy cannot be applied (no NVIDIA driver, no rights to write driver settings) Mode is PowerUnchanged and Reason holds the cause, and the encoder runs at the driver's default clocks.
func AcquireHighPerf ¶
func AcquireHighPerf(adapter Adapter) *PowerGuard
AcquireHighPerf applies no policy outside Windows: VideoToolbox on Apple silicon keeps its encode latency under a paced load (Phase 0).
func (*PowerGuard) Close ¶
func (g *PowerGuard) Close() error
Close restores what AcquireHighPerf changed. It is safe to call twice.
type PowerMode ¶
type PowerMode uint8
PowerMode is what AcquireHighPerf achieved on an adapter.
const ( // PowerUnchanged: no policy was applied; Reason says why. PowerUnchanged PowerMode = iota // PowerNotNeeded: the vendor's encoder does not drop to an idle clock // under a paced load, so there is nothing to change. PowerNotNeeded // PowerMaxPerformance: the driver keeps the adapter at its highest // performance state while this process runs. PowerMaxPerformance )