Class DxgiUtil
java.lang.Object
oshi.driver.common.windows.gpu.DxgiUtil
Shared utility methods for DXGI adapter matching and related parsing. Contains no native code.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildLuidPrefix(DxgiAdapterInfo adapter) Builds the PDH LUID instance prefix for the given DXGI adapter.static StringbuildPciBusId(String locationInfo) Builds a PCI bus ID string in"0000:BB:DD.F"format from a Windows registryLocationInformationstring.static DxgiAdapterInfofindMatch(List<DxgiAdapterInfo> adapters, int vendorId, int deviceId, String adapterName) Finds the best-matching DXGI adapter for a given vendor ID, device ID, and adapter name.static StringnormalizeName(String name) Normalizes an adapter name for fuzzy matching: lower-case, strips(R)/(TM), collapses whitespace.static intparsePciBusNumber(String locationInfo) Parses the PCI bus number from a Windows registryLocationInformationstring of the form"PCI bus N, device N, function N".static intparsePciDevice(String locationInfo) Parses the PCI device number from a Windows registryLocationInformationstring.static intparsePciFunction(String locationInfo) Parses the PCI function number from a Windows registryLocationInformationstring.static longregistryValueToVram(Object value) Converts a registry value (REG_QWORD as Long, REG_DWORD as Integer, or REG_BINARY as byte[]) to a VRAM size in bytes.
-
Method Details
-
findMatch
public static DxgiAdapterInfo findMatch(List<DxgiAdapterInfo> adapters, int vendorId, int deviceId, String adapterName) Finds the best-matching DXGI adapter for a given vendor ID, device ID, and adapter name.Matching priority:
- Vendor ID + Device ID (exact, both non-zero)
- Normalized name match (case-insensitive, ignoring
(R),(TM), extra spaces)
- Parameters:
adapters- list of adaptersvendorId- PCI vendor ID parsed from the registry key (0 if unknown)deviceId- PCI device ID parsed from the registry key (0 if unknown)adapterName- adapter name from the registryDriverDescvalue- Returns:
- best-matching adapter, or
null
-
registryValueToVram
Converts a registry value (REG_QWORD as Long, REG_DWORD as Integer, or REG_BINARY as byte[]) to a VRAM size in bytes. REG_BINARY is interpreted as little-endian.- Parameters:
value- the registry value object- Returns:
- the VRAM size in bytes, or 0 if the value type is unrecognised
-
normalizeName
-
buildLuidPrefix
Builds the PDH LUID instance prefix for the given DXGI adapter. The prefix has the formluid_0xHHHHHHHH_0xLLLLLLLL_phys_0.- Parameters:
adapter- the DXGI adapter info containing the LUID- Returns:
- PDH LUID instance prefix string, or empty string if the LUID is zero
-
parsePciBusNumber
Parses the PCI bus number from a Windows registryLocationInformationstring of the form"PCI bus N, device N, function N".- Parameters:
locationInfo- the LocationInformation registry value- Returns:
- PCI bus number, or -1 if not parseable
-
parsePciDevice
Parses the PCI device number from a Windows registryLocationInformationstring.- Parameters:
locationInfo- the LocationInformation registry value- Returns:
- PCI device number, or -1 if not parseable
-
parsePciFunction
Parses the PCI function number from a Windows registryLocationInformationstring.- Parameters:
locationInfo- the LocationInformation registry value- Returns:
- PCI function number, or -1 if not parseable
-
buildPciBusId
-