using NvAPIWrapper.Native; using NvAPIWrapper.Native.GPU; namespace NvAPIWrapper.GPU { /// /// Contains information about the GPU bus /// public class GPUBusInformation { internal GPUBusInformation(PhysicalGPU physicalGPU) { PhysicalGPU = physicalGPU; } /// /// Gets accelerated graphics port information /// public AGPInformation AGPInformation { get { if (BusType != GPUBusType.AGP) { return null; } return new AGPInformation( GPUApi.GetAGPAperture(PhysicalGPU.Handle), GPUApi.GetCurrentAGPRate(PhysicalGPU.Handle) ); } } /// /// Gets the bus identification /// public int BusId { get => GPUApi.GetBusId(PhysicalGPU.Handle); } /// /// Gets the bus slot identification /// public int BusSlot { get => GPUApi.GetBusSlotId(PhysicalGPU.Handle); } /// /// Gets the the bus type /// public GPUBusType BusType { get => GPUApi.GetBusType(PhysicalGPU.Handle); } /// /// Gets number of PCIe lanes being used for the PCIe interface downstream /// public int CurrentPCIeLanes { get { if (BusType == GPUBusType.PCIExpress) { return GPUApi.GetCurrentPCIEDownStreamWidth(PhysicalGPU.Handle); } return 0; } } /// /// Gets GPU interrupt number /// public int IRQ { get => GPUApi.GetIRQ(PhysicalGPU.Handle); } /// /// Gets the PCI identifiers /// public PCIIdentifiers PCIIdentifiers { get { if (BusType == GPUBusType.FPCI || BusType == GPUBusType.PCI || BusType == GPUBusType.PCIExpress) { GPUApi.GetPCIIdentifiers( PhysicalGPU.Handle, out var deviceId, out var subSystemId, out var revisionId, out var extDeviceId ); return new PCIIdentifiers(deviceId, subSystemId, revisionId, (int) extDeviceId); } return null; } } /// /// Gets the physical GPU that this instance describes /// public PhysicalGPU PhysicalGPU { get; } /// public override string ToString() { return $"[{BusType}] Bus #{BusId}, Slot #{BusSlot}"; } } }