コード例 #1
0
ファイル: GPUApi.Usage.cs プロジェクト: ptrsuder/NvAPIWrapper
        /// <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.");
        }
コード例 #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());
            }
        }
コード例 #3
0
ファイル: GPUApi.Usage.cs プロジェクト: ptrsuder/NvAPIWrapper
        /// <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));
            }
        }
コード例 #4
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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.");
        }
コード例 #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.");
        }
コード例 #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.");
        }
コード例 #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)));
            }
        }
コード例 #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);
            }
        }
コード例 #9
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #10
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #11
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #12
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #13
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #14
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #15
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #16
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #17
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #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);
        }
コード例 #19
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #20
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #21
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #22
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #23
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #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);
        }
コード例 #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);
 }
コード例 #26
0
ファイル: GPUApi.cs プロジェクト: attackgithub/NvAPIWrapper
        /// <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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }