Ejemplo n.º 1
0
        /// <summary>
        ///     This function retrieves the dynamic performance states information from specific GPU
        /// </summary>
        /// <param name="physicalGPUHandle">Handle of the physical GPU for which the memory information is to be extracted.</param>
        /// <returns>The device utilizations information array.</returns>
        /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found.</exception>
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        public static DynamicPerformanceStatesInfoV1 GetDynamicPerformanceStatesInfoEx(
            PhysicalGPUHandle physicalGPUHandle)
        {
            var getDynamicPerformanceStatesInfoEx =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetDynamicPStatesInfoEx>();

            foreach (var acceptType in getDynamicPerformanceStatesInfoEx.Accepts())
            {
                var instance = acceptType.Instantiate <DynamicPerformanceStatesInfoV1>();

                using (var gpuDynamicPStateInfo = ValueTypeReference.FromValueType(instance, acceptType))
                {
                    var status = getDynamicPerformanceStatesInfoEx(physicalGPUHandle, gpuDynamicPStateInfo);

                    if (status == Status.IncompatibleStructureVersion)
                    {
                        continue;
                    }

                    if (status != Status.Ok)
                    {
                        throw new NVIDIAApiException(status);
                    }

                    return(gpuDynamicPStateInfo.ToValueType <DynamicPerformanceStatesInfoV1>(acceptType));
                }
            }

            throw new NVIDIANotSupportedException("This operation is not supported.");
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     This function returns the EDID data for the specified GPU handle and connection bit mask.
        ///     outputId should have exactly 1 bit set to indicate a single display.
        /// </summary>
        /// <param name="gpuHandle">Physical GPU handle to check outputs</param>
        /// <param name="outputId">Output identification</param>
        /// <param name="offset">EDID offset</param>
        /// <param name="readIdentification">EDID read identification for multi part read, or zero for first run</param>
        /// <returns>Whole or a part of the EDID data</returns>
        /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception>
        /// <exception cref="NVIDIAApiException">
        ///     Status.InvalidArgument: gpuHandle or edid is invalid, outputId has 0 or > 1 bits
        ///     set
        /// </exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found.</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception>
        /// <exception cref="NVIDIAApiException">Status.DataNotFound: The requested display does not contain an EDID.</exception>
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        // ReSharper disable once TooManyArguments
        public static EDIDV3 GetEDID(
            PhysicalGPUHandle gpuHandle,
            OutputId outputId,
            int offset,
            int readIdentification = 0)
        {
            var gpuGetEDID = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetEDID>();

            if (!gpuGetEDID.Accepts().Contains(typeof(EDIDV3)))
            {
                throw new NVIDIANotSupportedException("This operation is not supported.");
            }

            var instance = EDIDV3.CreateWithOffset((uint)readIdentification, (uint)offset);

            using (var edidReference = ValueTypeReference.FromValueType(instance))
            {
                var status = gpuGetEDID(gpuHandle, outputId, edidReference);

                if (status != Status.Ok)
                {
                    throw new NVIDIAApiException(status);
                }

                return(edidReference.ToValueType <EDIDV3>().GetValueOrDefault());
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Queries active applications.
        /// </summary>
        /// <param name="gpuHandle">The physical GPU handle.</param>
        /// <returns>The list of active applications.</returns>
        public static PrivateActiveApplicationV2[] QueryActiveApps(PhysicalGPUHandle gpuHandle)
        {
            var queryActiveApps = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_QueryActiveApps>();

            // ReSharper disable once EventExceptionNotDocumented
            if (!queryActiveApps.Accepts().Contains(typeof(PrivateActiveApplicationV2)))
            {
                throw new NVIDIANotSupportedException("This operation is not supported.");
            }

            uint count     = PrivateActiveApplicationV2.MaximumNumberOfApplications;
            var  instances = typeof(PrivateActiveApplicationV2).Instantiate <PrivateActiveApplicationV2>()
                             .Repeat((int)count);

            using (var applications = ValueTypeArray.FromArray(instances))
            {
                // ReSharper disable once EventExceptionNotDocumented
                var status = queryActiveApps(gpuHandle, applications, ref count);

                if (status != Status.Ok)
                {
                    throw new NVIDIAApiException(status);
                }

                return(applications.ToArray <PrivateActiveApplicationV2>((int)count));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     This function retrieves the available driver memory footprint for the specified GPU.
        ///     If the GPU is in TCC Mode, only dedicatedVideoMemory will be returned.
        /// </summary>
        /// <param name="physicalGPUHandle">Handle of the physical GPU for which the memory information is to be extracted.</param>
        /// <returns>The memory footprint available in the driver.</returns>
        /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found.</exception>
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        public static IDisplayDriverMemoryInfo GetMemoryInfo(PhysicalGPUHandle physicalGPUHandle)
        {
            var getMemoryInfo = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetMemoryInfo>();

            foreach (var acceptType in getMemoryInfo.Accepts())
            {
                var instance = acceptType.Instantiate <IDisplayDriverMemoryInfo>();

                using (var displayDriverMemoryInfo = ValueTypeReference.FromValueType(instance, acceptType))
                {
                    var status = getMemoryInfo(physicalGPUHandle, displayDriverMemoryInfo);

                    if (status == Status.IncompatibleStructureVersion)
                    {
                        continue;
                    }

                    if (status != Status.Ok)
                    {
                        throw new NVIDIAApiException(status);
                    }

                    return(displayDriverMemoryInfo.ToValueType <IDisplayDriverMemoryInfo>(acceptType));
                }
            }

            throw new NVIDIANotSupportedException("This operation is not supported.");
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     This function retrieves the thermal information of all thermal sensors or specific thermal sensor associated with
        ///     the selected GPU. To retrieve info for all sensors, set sensorTarget to ThermalSettingsTarget.All.
        /// </summary>
        /// <param name="physicalGPUHandle">Handle of the physical GPU for which the memory information is to be extracted.</param>
        /// <param name="sensorTarget">Specifies the requested thermal sensor target.</param>
        /// <returns>The device thermal sensors information.</returns>
        /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found.</exception>
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        public static IThermalSettings GetThermalSettings(
            PhysicalGPUHandle physicalGPUHandle,
            ThermalSettingsTarget sensorTarget = ThermalSettingsTarget.All)
        {
            var getThermalSettings = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetThermalSettings>();

            foreach (var acceptType in getThermalSettings.Accepts())
            {
                var instance = acceptType.Instantiate <IThermalSettings>();

                using (var gpuThermalSettings = ValueTypeReference.FromValueType(instance, acceptType))
                {
                    var status = getThermalSettings(physicalGPUHandle, sensorTarget, gpuThermalSettings);

                    if (status == Status.IncompatibleStructureVersion)
                    {
                        continue;
                    }

                    if (status != Status.Ok)
                    {
                        throw new NVIDIAApiException(status);
                    }

                    return(gpuThermalSettings.ToValueType <IThermalSettings>(acceptType));
                }
            }

            throw new NVIDIANotSupportedException("This operation is not supported.");
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     This function returns the EDID data for the specified GPU handle and connection bit mask.
        ///     outputId should have exactly 1 bit set to indicate a single display.
        /// </summary>
        /// <param name="gpuHandle">Physical GPU handle to check outputs</param>
        /// <param name="outputId">Output identification</param>
        /// <returns>Whole or a part of the EDID data</returns>
        /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception>
        /// <exception cref="NVIDIAApiException">
        ///     Status.InvalidArgument: gpuHandle or edid is invalid, outputId has 0 or > 1 bits
        ///     set
        /// </exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found.</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception>
        /// <exception cref="NVIDIAApiException">Status.DataNotFound: The requested display does not contain an EDID.</exception>
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        public static IEDID GetEDID(PhysicalGPUHandle gpuHandle, OutputId outputId)
        {
            var gpuGetEDID = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetEDID>();

            foreach (var acceptType in gpuGetEDID.Accepts())
            {
                using (var edidReference = ValueTypeReference.FromValueType(acceptType.Instantiate <IEDID>(), acceptType)
                       )
                {
                    var status = gpuGetEDID(gpuHandle, outputId, edidReference);

                    if (status == Status.IncompatibleStructureVersion)
                    {
                        continue;
                    }

                    if (status != Status.Ok)
                    {
                        throw new NVIDIAApiException(status);
                    }

                    return(edidReference.ToValueType <IEDID>(acceptType));
                }
            }

            throw new NVIDIANotSupportedException("This operation is not supported.");
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     [PRIVATE]
        ///     Gets the cooler policy table for the passed GPU handle.
        /// </summary>
        /// <param name="gpuHandle">The handle of the GPU to perform the operation on.</param>
        /// <param name="policy">The cooler policy to get the table for.</param>
        /// <param name="index">The cooler index.</param>
        /// <param name="count">Number of policy table entries retrieved.</param>
        /// <returns>The cooler policy table for the GPU.</returns>
        // ReSharper disable once TooManyArguments
        public static PrivateCoolerPolicyTableV1 GetCoolerPolicyTable(
            PhysicalGPUHandle gpuHandle,
            CoolerPolicy policy,
            uint index,
            out uint count)
        {
            var instance = typeof(PrivateCoolerPolicyTableV1).Instantiate <PrivateCoolerPolicyTableV1>();

            instance._Policy = policy;

            using (var policyTableReference = ValueTypeReference.FromValueType(instance))
            {
                var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetCoolerPolicyTable>()(
                    gpuHandle,
                    index,
                    policyTableReference,
                    out count
                    );

                if (status != Status.Ok)
                {
                    throw new NVIDIAApiException(status);
                }

                return(policyTableReference.ToValueType <PrivateCoolerPolicyTableV1>(typeof(PrivateCoolerPolicyTableV1)));
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     [PRIVATE]
        ///     Enables the overclocked performance states
        /// </summary>
        /// <param name="gpuHandle">The handle of the GPU to perform the operation on.</param>
        public static void EnableOverclockedPStates(PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_EnableOverclockedPStates>()(
                gpuHandle
                );

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     [PRIVATE]
        ///     Gets the driver model for the passed GPU handle.
        /// </summary>
        /// <param name="gpuHandle">The handle of the GPU to perform the operation on.</param>
        /// <returns>The driver model of the GPU.</returns>
        public static uint GetDriverModel(PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GetDriverModel>()(gpuHandle, out var count);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(count);
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     [PRIVATE]
        ///     Gets the GPU manufacturing foundry of the passed GPU handle.
        /// </summary>
        /// <param name="gpuHandle">The handle of the GPU to retrieve this information from.</param>
        /// <returns>The GPU manufacturing foundry of the GPU.</returns>
        public static GPUFoundry GetFoundry(PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetFoundry>()(gpuHandle, out var foundry);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(foundry);
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     [PRIVATE]
        ///     Gets the RAM type for the passed GPU handle.
        /// </summary>
        /// <param name="gpuHandle">The handle of the GPU to retrieve this information from.</param>
        /// <returns>The RAM memory type.</returns>
        public static GPUMemoryType GetRAMType(PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetRamType>()(gpuHandle, out var ramType);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(ramType);
        }
Ejemplo n.º 12
0
        /// <summary>
        ///     This function returns the interrupt number associated with this GPU.
        /// </summary>
        /// <param name="gpuHandle">GPU handle to get information about</param>
        /// <returns>Interrupt number associated with this GPU</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: gpuHandle is NULL</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle</exception>
        public static int GetIRQ(PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetIRQ>()(gpuHandle, out var irq);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return((int)irq);
        }
Ejemplo n.º 13
0
        /// <summary>
        ///     [PRIVATE]
        ///     Gets the GPU short name (code name) for the passed GPU handle.
        /// </summary>
        /// <param name="gpuHandle">The handle of the GPU to retrieve this information from.</param>
        /// <returns>The GPU short name.</returns>
        public static string GetShortName(PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetShortName>()(gpuHandle, out var name);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(name.Value);
        }
Ejemplo n.º 14
0
        /// <summary>
        ///     This function returns the number of PCIE lanes being used for the PCIE interface downstream from the GPU.
        /// </summary>
        /// <param name="gpuHandle">Physical GPU handle to get information about</param>
        /// <returns>PCIE lanes being used for the PCIE interface downstream</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: display is not valid</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception>
        public static int GetCurrentPCIEDownStreamWidth(PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetCurrentPCIEDownstreamWidth>()(gpuHandle,
                                                                                                               out var width);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return((int)width);
        }
Ejemplo n.º 15
0
        /// <summary>
        ///     This function returns the current AGP Rate (0 = AGP not present, 1 = 1x, 2 = 2x, etc.).
        /// </summary>
        /// <param name="gpuHandle">Physical GPU handle to get information about</param>
        /// <returns>Current AGP rate</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: display is not valid</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception>
        public static int GetCurrentAGPRate(PhysicalGPUHandle gpuHandle)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetCurrentAGPRate>()(gpuHandle, out var agpRate);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return((int)agpRate);
        }
Ejemplo n.º 16
0
        /// <summary>
        ///     This API Retrieves the Board information (a unique GPU Board Serial Number) stored in the InfoROM.
        /// </summary>
        /// <param name="gpuHandle">Physical GPU Handle</param>
        /// <returns>Board Information</returns>
        /// <exception cref="NVIDIAApiException">Status.Error: Miscellaneous error occurred</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: Handle passed is not a physical GPU handle</exception>
        /// <exception cref="NVIDIAApiException">Status.ApiNotInitialized: NVAPI not initialized</exception>
        public static BoardInfo GetBoardInfo(PhysicalGPUHandle gpuHandle)
        {
            var boardInfo = typeof(BoardInfo).Instantiate <BoardInfo>();
            var status    = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetBoardInfo>()(gpuHandle, ref boardInfo);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(boardInfo);
        }
Ejemplo n.º 17
0
        /// <summary>
        ///     This function returns the virtual size of frame buffer in KB. This includes the physical RAM plus any system RAM
        ///     that has been dedicated for use by the GPU.
        /// </summary>
        /// <param name="gpuHandle">Physical GPU handle to get information about</param>
        /// <returns>Virtual size of frame buffer in KB</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: display is not valid</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception>
        public static int GetVirtualFrameBufferSize(PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetVirtualFrameBufferSize>()(gpuHandle,
                                                                                                           out var bufferSize);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return((int)bufferSize);
        }
Ejemplo n.º 18
0
        /// <summary>
        ///     This function is the same as GetAllOutputs() but returns only the set of GPU output identifiers that are actively
        ///     driving display devices.
        /// </summary>
        /// <param name="gpuHandle">Physical GPU handle to get information about</param>
        /// <returns>Active output identifications as a flag</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: display is not valid</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception>
        public static OutputId GetActiveOutputs(PhysicalGPUHandle gpuHandle)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetActiveOutputs>()(gpuHandle, out var outputMask);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(outputMask);
        }
Ejemplo n.º 19
0
        /// <summary>
        ///     This function returns the revision of the video BIOS associated with this GPU.
        ///     TCC_SUPPORTED
        /// </summary>
        /// <param name="gpuHandle">GPU handle to get information about</param>
        /// <returns>Revision of the video BIOS</returns>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found.</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception>
        public static uint GetVBIOSRevision(PhysicalGPUHandle gpuHandle)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetVbiosRevision>()(gpuHandle, out var revision);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(revision);
        }
Ejemplo n.º 20
0
        /// <summary>
        ///     [PRIVATE]
        ///     Gets the TPC count for the passed GPU handle.
        /// </summary>
        /// <param name="gpuHandle">The handle of the GPU to retrieve this information from.</param>
        /// <returns>The number of TPC units.</returns>
        public static uint GetTotalTPCCount(PhysicalGPUHandle gpuHandle)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetTotalTPCCount>()(gpuHandle, out var tpcCount);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(tpcCount);
        }
Ejemplo n.º 21
0
        /// <summary>
        ///     This function returns the logical GPU handle associated with specified physical GPU handle.
        ///     At least one GPU must be present in the system and running an NVIDIA display driver.
        /// </summary>
        /// <param name="gpuHandle">GPU handle to get information about</param>
        /// <returns>Logical GPU handle associated with specified physical GPU handle</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: gpuHandle is NULL</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        public static LogicalGPUHandle GetLogicalGPUFromPhysicalGPU(PhysicalGPUHandle gpuHandle)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GetLogicalGPUFromPhysicalGPU>()(gpuHandle, out var gpu);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(gpu);
        }
Ejemplo n.º 22
0
        /// <summary>
        ///     [PRIVATE]
        ///     Gets the RAM bus width for the passed GPU handle.
        /// </summary>
        /// <param name="gpuHandle">The handle of the GPU to retrieve this information from.</param>
        /// <returns>The RAM memory bus width.</returns>
        public static uint GetRAMBusWidth(PhysicalGPUHandle gpuHandle)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetRamBusWidth>()(gpuHandle, out var busWidth);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(busWidth);
        }
Ejemplo n.º 23
0
        /// <summary>
        ///     This function retrieves the Quadro status for the GPU (true if Quadro, false if GeForce)
        /// </summary>
        /// <param name="gpuHandle">GPU handle to get information about</param>
        /// <returns>true if Quadro, false if GeForce</returns>
        /// <exception cref="NVIDIAApiException">Status.Error: Miscellaneous error occurred</exception>
        public static bool GetQuadroStatus(PhysicalGPUHandle gpuHandle)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetQuadroStatus>()(gpuHandle, out var isQuadro);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(isQuadro > 0);
        }
Ejemplo n.º 24
0
        /// <summary>
        ///     This function returns the output type. User can either specify both 'physical GPU handle and outputId (exactly 1
        ///     bit set)' or a valid displayId in the outputId parameter.
        /// </summary>
        /// <param name="gpuHandle">GPU handle to get information about</param>
        /// <param name="displayId">Display identification of the divide to get information about</param>
        /// <returns>Type of the output</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: gpuHandle is NULL</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle</exception>
        public static OutputType GetOutputType(PhysicalGPUHandle gpuHandle, uint displayId)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetOutputType>()(gpuHandle, displayId,
                                                                                      out var type);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(type);
        }
Ejemplo n.º 25
0
 /// <summary>
 ///     Creates a new PhysicalGPU
 /// </summary>
 /// <param name="handle">Physical GPU handle</param>
 public PhysicalGPU(PhysicalGPUHandle handle)
 {
     Handle                   = handle;
     UsageInformation         = new GPUUsageInformation(this);
     ThermalInformation       = new GPUThermalInformation(this);
     BusInformation           = new GPUBusInformation(this);
     ArchitectInformation     = new GPUArchitectInformation(this);
     MemoryInformation        = new GPUMemoryInformation(this);
     CoolerInformation        = new GPUCoolerInformation(this);
     ECCMemoryInformation     = new ECCMemoryInformation(this);
     PerformanceControl       = new GPUPerformanceControl(this);
     PowerTopologyInformation = new GPUPowerTopologyInformation(this);
 }
Ejemplo n.º 26
0
        /// <summary>
        ///     This function returns the full video BIOS version string in the form of xx.xx.xx.xx.yy where xx numbers come from
        ///     GetVbiosRevision() and yy comes from GetVbiosOEMRevision().
        /// </summary>
        /// <param name="gpuHandle">Physical GPU handle to get information about</param>
        /// <returns>Full video BIOS version string</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: display is not valid</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception>
        public static string GetVBIOSVersionString(PhysicalGPUHandle gpuHandle)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetVbiosVersionString>()(gpuHandle,
                                                                                              out var version);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(version.Value);
        }
Ejemplo n.º 27
0
        /// <summary>
        ///     This function returns the fan speed tachometer reading for the specified physical GPU.
        /// </summary>
        /// <param name="gpuHandle">Physical GPU handle to get tachometer reading from</param>
        /// <returns>The GPU fan speed in revolutions per minute.</returns>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception>
        public static uint GetTachReading(PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetTachReading>()(
                gpuHandle, out var value
                );

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(value);
        }
Ejemplo n.º 28
0
        /// <summary>
        ///     This API converts a display ID to a Physical GPU handle and output ID.
        /// </summary>
        /// <param name="displayId">Display identification of display to retrieve GPU and outputId for</param>
        /// <param name="gpuHandle">Handle to the physical GPU</param>
        /// <returns>Connected display output identification on the target GPU will only have one bit set.</returns>
        /// <exception cref="NVIDIAApiException">Status.ApiNotInitialized: NVAPI not initialized</exception>
        /// <exception cref="NVIDIAApiException">Status.Error: Miscellaneous error occurred</exception>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: Invalid input parameter</exception>
        /// <exception cref="NVIDIAApiException">
        ///     Status.IdOutOfRange: The DisplayId corresponds to a display which is not within
        ///     the normal outputId range.
        /// </exception>
        public static OutputId GetGPUAndOutputIdFromDisplayId(uint displayId, out PhysicalGPUHandle gpuHandle)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_SYS_GetGpuAndOutputIdFromDisplayId>()(
                displayId,
                out gpuHandle, out var outputId);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(outputId);
        }
Ejemplo n.º 29
0
        /// <summary>
        ///     This API converts a Physical GPU handle and output ID to a display ID.
        /// </summary>
        /// <param name="gpuHandle">Handle to the physical GPU</param>
        /// <param name="outputId">Connected display output identification on the target GPU - must only have one bit set</param>
        /// <returns>Display identification</returns>
        /// <exception cref="NVIDIAApiException">Status.ApiNotInitialized: NVAPI not initialized</exception>
        /// <exception cref="NVIDIAApiException">Status.Error: miscellaneous error occurred</exception>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: Invalid input parameter.</exception>
        public static uint GetDisplayIdFromGPUAndOutputId(PhysicalGPUHandle gpuHandle, OutputId outputId)
        {
            var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_SYS_GetDisplayIdFromGpuAndOutputId>()(
                gpuHandle,
                outputId, out var display);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(display);
        }
Ejemplo n.º 30
0
        /// <summary>
        ///     This function returns the current performance state (P-State).
        /// </summary>
        /// <param name="gpuHandle">GPU handle to get information about</param>
        /// <returns>The current performance state.</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: gpuHandle is NULL</exception>
        public static PerformanceStateId GetCurrentPerformanceState(PhysicalGPUHandle gpuHandle)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetCurrentPState>()(gpuHandle,
                                                                                         out var performanceState);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(performanceState);
        }