Projekt NVIDIA

Stelle Fragen zur Programmierung mit Autohotkey

Moderator: jNizM

User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Projekt NVIDIA

04 Sep 2014, 05:39

Projekt NVIDIA


Hier ist immer die letzte Version von mir zu finden
Class_NVAPI.ahk


_NvAPI_Common.txt
_NvAPI_IDs.txt
_NvAPI_Status.txt



Nvidia:
- nvapi-r337.zip
- nvapi-r343.zip

OpenHardwareMonitor:
- NVAPI.cs
- NvidiaGPU.cs
- NvidiaGroup.cs

VibranceGUI:
- VibranceGUI Homepage
- GitHub vibranceGUI
- GitHub vibranceDLL

Sonstiges:
- DigitalVibrance.cpp
- Getting NVIDIA GPU Usage in C++
- NvApi vervollständigen (Forum)



Beispiel wie es aussehen könnte:
Image
Last edited by jNizM on 20 Nov 2014, 06:35, edited 3 times in total.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

06 Nov 2014, 04:38

Hallo,

ich habe mich jetzt durch die verschiedenen Quellen gewühlt und dabei viele interessante Erfahrungen gewonnen. Z.B. weiß ich jetzt, dass in den unterschiedlichen Versionen der nvapi.h unterschiedliche Funktionsdefinitionen zu finden sind, und dass Funktionen, die man in den neueren Versionen nicht mehr findet, durchaus noch zu funktionieren scheinen.

Meine Testerei wird leider dadurch eingeschränkt, dass ich für den Anschluss an meinem Notebook, an dem mein Display hängt, den NVIDIA-Treiber nicht aktivieren kann. So laufen einige Funktionen auf den Fehler -6. Aber einige Funktionen laufen klaglos.

Code: Select all

            NvAPI._GPU_GetMemoryInfo                         := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x774AA982, "CDECL")
stimmt leider nicht. 0x774AA982 ist die ID der Funktion GetDisplayDriverMemoryInfo, wie es auch unten im Skript steht. Es sollte also

Code: Select all

            NvAPI._GetDisplayDriverMemoryInfo                := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x774AA982, "CDECL")
sein. Wo hast Du diese lange Liste mit ID's gefunden? Ich konnte so etwas im Netz nicht finden.

Lange Rede, kurzer Sinn, ich habe hier ein paar Funktionen, die zu laufen scheinen. EnumNvidiaDisplayHandle bringt bei mir leider den o.a. Status -6.

Code: Select all

   /*
   ///////////////////////////////////////////////////////////////////////////////
   //
   // FUNCTION NAME: NvAPI_EnumNvidiaDisplayHandle
   //
   //! This function returns the handle of the NVIDIA display specified by the enum
   //!                index (thisEnum). The client should keep enumerating until it
   //!                returns NVAPI_END_ENUMERATION.
   //!
   //!                Note: Display handles can get invalidated on a modeset, so the calling applications need to
   //!                renum the handles after every modeset.
   //!
   //! SUPPORTED OS:  Windows XP and higher
   //!
   //!
   //! \since Release: 80
   //!
   //! \param [in]  thisEnum      The index of the NVIDIA display.
   //! \param [out] pNvDispHandle Pointer to the NVIDIA display handle.
   //!
   //! \retval NVAPI_INVALID_ARGUMENT        Either the handle pointer is NULL or enum index too big
   //! \retval NVAPI_OK                      Return a valid NvDisplayHandle based on the enum index
   //! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA device found in the system
   //! \retval NVAPI_END_ENUMERATION         No more display device to enumerate
   //! \ingroup disphandle
   ///////////////////////////////////////////////////////////////////////////////
   NVAPI_INTERFACE NvAPI_EnumNvidiaDisplayHandle(NvU32 thisEnum, NvDisplayHandle *pNvDispHandle);
   */
   EnumNvidiaDisplayHandle(Index := 0) {
      If (NvStatus := DllCall(NvAPI._EnumNvidiaDisplayHandle, "Int", Index, "IntP", DispHandle, "CDECL")) = 0
         Return DispHandle
      ErrorLevel := NvStatus
      Return False
   }
   
   /*
   ///////////////////////////////////////////////////////////////////////////////
   //
   // FUNCTION NAME: NvAPI_EnumPhysicalGPUs
   //
   //! This function returns an array of physical GPU handles.
   //! Each handle represents a physical GPU present in the system.
   //! That GPU may be part of an SLI configuration, or may not be visible to the OS directly.
   //!
   //! At least one GPU must be present in the system and running an NVIDIA display driver.
   //!
   //! The array nvGPUHandle will be filled with physical GPU handle values. The returned
   //! gpuCount determines how many entries in the array are valid.
   //!
   //! \note In drivers older than 105.00, all physical GPU handles get invalidated on a
   //!       modeset. So the calling applications need to renum the handles after every modeset.\n
   //!       With drivers 105.00 and up, all physical GPU handles are constant.
   //!       Physical GPU handles are constant as long as the GPUs are not physically moved and
   //!       the SBIOS VGA order is unchanged.
   //!
   //!       For TCC GPU handles please use NvAPI_EnumTCCPhysicalGPUs()
   //!
   //! SUPPORTED OS:  Windows XP and higher,  Mac OS X
   //!
   //!
   //! \par Introduced in
   //! \since Release: 80
   //!
   //! \retval NVAPI_INVALID_ARGUMENT         nvGPUHandle or pGpuCount is NULL
   //! \retval NVAPI_OK                       One or more handles were returned
   //! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND  No NVIDIA GPU driving a display was found
   //! \ingroup gpu
   ///////////////////////////////////////////////////////////////////////////////
   NVAPI_INTERFACE NvAPI_EnumPhysicalGPUs(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
   */
   EnumPhysicalGPUs() {
      Static NVAPI_MAX_PHYSICAL_GPUS := 64
      VarSetCapacity(GpuHandles, 4 * NVAPI_MAX_PHYSICAL_GPUS, 0)
      If (NvStatus := DllCall(NvAPI._EnumPhysicalGPUs, "Ptr", &GpuHandles, "UIntP", GpuCount, "CDECL")) = 0 {
         GPUH := []
         Loop, % GpuCount
            GPUH[A_Index] := NumGet(GpuHandles, 4 * (A_Index - 1), "Int")
         Return GPUH
      }
      ErrorLevel := NvStatus
      Return False
   }

   /*
   ///////////////////////////////////////////////////////////////////////////////
	//
	// FUNCTION NAME: NvAPI_GetDisplayDriverMemoryInfo
	//
	//! This function retrieves the display driver memory information for the active display handle. \n
	//! In a multi-GPU scenario, the physical framebuffer information is obtained for the GPU associated with active display handle. \n
	//! In an SLI-mode scenario, the physical framebuffer information is obtained only from the display owner GPU. \n
	//!
	//!
	//! SUPPORTED OS:  Windows XP and higher
	//!
	//!
	//! \since Release: 95
	//!
	//! \param [in]  hNvDisplay   NVIDIA Display selection. It can be #NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
	//! \param [out] pMemoryInfo  The memory footprint available in the driver.
	//!
	//! \retval  NVAPI_INVALID_ARGUMENT             pMemoryInfo is NULL.
	//! \retval  NVAPI_OK                           Call successful.
	//! \retval  NVAPI_NVIDIA_DEVICE_NOT_FOUND      No NVIDIA GPU driving a display was found.
	//! \retval  NVAPI_EXPECTED_DISPLAY_HANDLE      hNvDisplay is not a valid display handle.
	//! \retval  NVAPI_INCOMPATIBLE_STRUCT_VERSION  NV_DISPLAY_DRIVER_MEMORY_INFO structure version mismatch.
	//! \ingroup driverapi
	///////////////////////////////////////////////////////////////////////////////
	NVAPI_INTERFACE NvAPI_GetDisplayDriverMemoryInfo(NvDisplayHandle hNvDisplay, NV_DISPLAY_DRIVER_MEMORY_INFO *pMemoryInfo);
   */
   GetDisplayDriverMemoryInfo(DispHandle := 0) {
      Static SizeOfMemInfoV2 := 24
      VarSetCapacity(MemInfo, SizeOfMemInfoV2, 0)
      NumPut(SizeOfMemInfoV2|0x20000, MemInfo , 0, "UInt")
      If (NvStatus := DllCall(NvAPI._GPU_GetMemoryInfo, "Int", DispHandle, "Ptr", &MemInfo, "CDECL")) = 0 {
         MI := {}
         MI.Dedicated := NumGet(MemInfo, 4, "UInt")
         MI.Available := NumGet(MemInfo, 8, "UInt")
         MI.System := NumGet(MemInfo, 12, "UInt")
         MI.Shared := NumGet(MemInfo, 16, "UInt")
         MI.CurrentAvailable := NumGet(MemInfo, 20, "UInt")
         Return MI
      }
      ErrorLevel := NvStatus
      Return False
   }
   
   /*
   ///////////////////////////////////////////////////////////////////////////////
   //
   // FUNCTION NAME: NvAPI_GPU_GetFullName
   //
   //!  This function retrieves the full GPU name as an ASCII string - for example, "Quadro FX 1400".
   //!
   //! SUPPORTED OS:  Windows XP and higher,  Mac OS X
   //!
   //!
   //! TCC_SUPPORTED
   //!
   //! \since Release: 90
   //!
   //! \return  NVAPI_ERROR or NVAPI_OK
   //! \ingroup gpu
   ///////////////////////////////////////////////////////////////////////////////
   NVAPI_INTERFACE NvAPI_GPU_GetFullName(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName);
   */
   GetGPUName(Index := 1) {
      Static NVAPI_SHORT_STRING_MAX := 64
      PhysGpuHandle := This.EnumPhysicalGPUs()[Index]
      VarSetCapacity(Name, NVAPI_SHORT_STRING_MAX, 0)
      If (NvStatus := DllCall(NvAPI._GPU_GetFullName, "Int", PhysGpuHandle, "Ptr", &Name, "CDECL")) = 0
         Return StrGet(&Name, "CP0")
      ErrorLevel := NvStatus
      Return False
   }

   /*
   ///////////////////////////////////////////////////////////////////////////////
   //
   // FUNCTION NAME: NvAPI_GetInterfaceVersionString
   //
   //! This function returns a string describing the version of the NvAPI library.
   //!               The contents of the string are human readable.  Do not assume a fixed
   //!                format.
   //!
   //!
   //! SUPPORTED OS:  Windows XP and higher,  Mac OS X
   //!
   //!
   //! \since Release: 80
   //!
   //! \param  szDesc User readable string giving NvAPI version information
   //!
   //! \return See \ref nvapistatus for the list of possible return values.
   //! \ingroup nvapifunctions
   ///////////////////////////////////////////////////////////////////////////////
   NVAPI_INTERFACE NvAPI_GetInterfaceVersionString(NvAPI_ShortString szDesc);
   */
   GetInterfaceVersionString() {
      Static NVAPI_SHORT_STRING_MAX := 64
      VarSetCapacity(Desc, NVAPI_SHORT_STRING_MAX, 0)
      If (NvStatus := DllCall(NvAPI._GetInterfaceVersionStringe, "Ptr", &Desc, "CDECL")) = 0
         Return StrGet(&Desc, "CP0")
      ErrorLevel := NvStatus
      Return ""
   }
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Projekt NVIDIA

06 Nov 2014, 05:06

Hey just me
Danke für deine Bemühungen bisher

Gefunden hab ich die ID's hier ==> How to get the id (memory address) of dll-function?
Mich würde aber interessieren wie er auf die ID's dann gekommen (bzw analysiert hat) ist weil mein output für die nvapi.lib via dumpbin sieht so aus (output.7z)
Der Output ist von 2013 deswegen haben sich bestimmt auch ein paar Namen geändert.

In der letzten Version (r343) gibt es GetDisplayDriverMemoryInfo nicht mehr, deswegen denke ich, dass das jetzt GPU_GetMemoryInfo und die Adresse die gleiche geblieben ist.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

06 Nov 2014, 05:15

Hallo jNizM,

nach der aktuellen Doku braucht GPU_GetMemoryInfo() ein physisches Handle auf eine GPU, während GetDisplayDriverMemoryInfo() ein Displayhandle erwartet (worin auch immer sich die unterscheiden).

Ich werde mir auch den Link mal anschauen, für 64-Bit taugen die ID's aber anscheinend nicht.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Projekt NVIDIA

06 Nov 2014, 05:20

Denk mal die ID's für 64-Bit unterscheiden sich weil es auch 2 nvapi.lib Dateien gibt

32-Bit: nvapi-r343\x86\nvapi.lib (582 KB)
64-Bit: nvapi-r343\amd64\nvapi64.lib (699 KB)

Hiermit hab ich zumindest ein Output bekommen:

Code: Select all

/*
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_GetMemoryInfo
//
//!   DESCRIPTION: This function retrieves the available driver memory footprint for the specified GPU. 
//!
//! SUPPORTED OS:  Windows XP and higher
//!
//!
//! TCC_SUPPORTED
//!
//! \since Release: 177
//!
//!  \param [in]   hPhysicalGpu  Handle of the physical GPU for which the memory information is to be extracted.
//!  \param [out]  pMemoryInfo   The memory footprint available in the driver. See NV_DISPLAY_DRIVER_MEMORY_INFO.
//!
//!  \retval       NVAPI_INVALID_ARGUMENT             pMemoryInfo is NULL.
//!  \retval       NVAPI_OK                           Call successful.
//!  \retval       NVAPI_NVIDIA_DEVICE_NOT_FOUND      No NVIDIA GPU driving a display was found.
//!  \retval       NVAPI_INCOMPATIBLE_STRUCT_VERSION  NV_DISPLAY_DRIVER_MEMORY_INFO structure version mismatch.
//!
//!  \ingroup  driverapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_GPU_GetMemoryInfo(NvPhysicalGpuHandle hPhysicalGpu, NV_DISPLAY_DRIVER_MEMORY_INFO *pMemoryInfo);
*/

GetMemoryInfo()
{
	static NV_DISPLAY_DRIVER_MEMORY_INFO := 24
	VarSetCapacity(pMemoryInfo, 24)
	NumPut(NV_DISPLAY_DRIVER_MEMORY_INFO|0x20000, pMemoryInfo, 0, "Int")
	if (status := DllCall(NvAPI._GPU_GetMemoryInfo, "Int", 0, "Ptr", &pMemoryInfo, "CDECL"))
		return "NvAPI Status: GetMemoryInfo()`n" status
	return NumGet(pMemoryInfo, 4, "UInt")
}
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

06 Nov 2014, 07:15

Ja, das klappt, aber nur, weil 0 das DEFAULT_DISPLAY_HANDLE ist. Wenn Du, wie im Funktionskopf beschrieben, ein gültiges hPhysicalGpu Handle übergibst, gibt es einen Fehlerstatus.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Projekt NVIDIA

06 Nov 2014, 08:31

Ich fass mal soweit zusammen:

Class_NVIDIA.ahk
Image
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

07 Nov 2014, 02:54

Mann, ich hasse das. Da verteilt NVIDIA eine DLL, die eigentlich keine ist, weil sie fast keine Funktionen exportiert und mit Hilfe der LIB Datei statisch gelinkt werden soll. Und dann gibt es auch noch zwei Versionen des API, ein unvollständiges für's gemeine Volk und dann noch ein wahrscheinlich vollständigeres für Entwickler, die sich den Mund verbieten lassen müssen, damit sie es bekommen. So findet man mal hier mal da die in der öffentlich verfügbaren Dokumentation beschriebenen Funktionen in einer nvapi.h, oder auch nicht. Und die im Netz verfügbaren bzw. von jNizM gefundenen ID-Sammlungen sind alle nicht besonders aktuell, so dass man nicht sicher sein kann, ob sie überhaupt zu den aktuellen DLL-Versionen passen. Zusammen mit der nicht wirklich aktiven NVIDIA-Grafik in meinem System führt das zu einer wachsenden Demotivation.

Ich habe mich trotzdem an der (nicht dokumentierten) Funktion GPU_GetUsages() versucht, bekomme hier aber bestenfalls den vielsagenden Status -1 // Generic error. Schau doch mal, ob Du ein besseres/anderes Ergebnis bekommst:

Code: Select all

   /*
   ///////////////////////////////////////////////////////////////////////////////
   */
   GPU_GetUsages(PhysGpuHandle := 0) {
      Static MAX_USAGES_PER_GPU := 33
      Static SizeOfUsages := 4 + (MAX_USAGES_PER_GPU * 4)
      If (PhysGpuHandle = 0)
         PhysGpuHandle := This.EnumPhysicalGPUs().1
      VarSetCapacity(Usages, SizeOfUsages, 0)
      NumPut(SizeOfUsages|0x10000, Usages, 0, "UInt")
      If (NvStatus := DllCall(NvAPI._GPU_GetUsages, "Int", PhysGpuHandle, "Ptr", &Usages, "CDECL")) = 0
         Return NumGet(Usages, 0, "UInt")
      ErrorLevel := NvStatus
      Return False
   }
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Projekt NVIDIA

07 Nov 2014, 09:07

Ja das hast du leider recht :/
Der Output von GPU_GetUsages ist bei mir immer: 65672
Was auch immer das bedeutet

Ich hab gesehen das GPU_GetUsages schon länger nicht mehr offiziell drin ist
Im Forum hab ich gelesen stattdessen:
NvAPI._GPU_GetDynamicPstatesInfoEx := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x60DED2ED, "CDECL")

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_GPU_GetDynamicPstatesInfoEx
//
//! DESCRIPTION:   This API retrieves the NV_GPU_DYNAMIC_PSTATES_INFO_EX structure for the specified physical GPU.
//!                Each domain's info is indexed in the array.  For example: 
//!                - pDynamicPstatesInfo->utilization[NVAPI_GPU_UTILIZATION_DOMAIN_GPU] holds the info for the GPU domain. \p
//!                There are currently 4 domains for which GPU utilization and dynamic P-State thresholds can be retrieved:
//!                   graphic engine (GPU), frame buffer (FB), video engine (VID), and bus interface (BUS).
//!
//! SUPPORTED OS:  Windows XP and higher,  Mac OS X
//!
//!
//! \since Release: 185
//! 
//! \retval ::NVAPI_OK 
//! \retval ::NVAPI_ERROR 
//! \retval ::NVAPI_INVALID_ARGUMENT  pDynamicPstatesInfo is NULL
//! \retval ::NVAPI_HANDLE_INVALIDATED 
//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE 
//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the INFO struct is not supported
//!
//! \ingroup gpupstate
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_GPU_GetDynamicPstatesInfoEx(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_DYNAMIC_PSTATES_INFO_EX *pDynamicPstatesInfoEx);


//! Used in NvAPI_GPU_GetDynamicPstatesInfoEx().
typedef struct
{
    NvU32       version;        //!< Structure version
    NvU32       flags;          //!< bit 0 indicates if the dynamic Pstate is enabled or not
    struct
    {
        NvU32   bIsPresent:1;   //!< Set if this utilization domain is present on this GPU
        NvU32   percentage;     //!< Percentage of time where the domain is considered busy in the last 1 second interval
    } utilization[NVAPI_MAX_GPU_UTILIZATIONS];
} NV_GPU_DYNAMIC_PSTATES_INFO_EX;

//! \ingroup gpupstate
//! Macro for constructing the version field of NV_GPU_DYNAMIC_PSTATES_INFO_EX
#define NV_GPU_DYNAMIC_PSTATES_INFO_EX_VER MAKE_NVAPI_VERSION(NV_GPU_DYNAMIC_PSTATES_INFO_EX,1)


#define NVAPI_MAX_GPU_UTILIZATIONS 8
Hast du eigtl schon ne Idee wie er auf die ID's gekommen ist, bzw wie er sich die analysiert hat?
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

07 Nov 2014, 11:15

jNizM wrote:Hast du eigtl schon ne Idee wie er auf die ID's gekommen ist, bzw wie er sich die analysiert hat?
Ja, seit ziemlich genau 5 Minuten (zumindest für 32-Bit):

Man muss die Datei nvapi.lib mit der dumpbin.exe disassemblieren (so man das darf):

Code: Select all

dumpbin.exe /DISASM /OUT:Pfad_einer\Ausgabedatei Pfad_zur\nvapi.lib
In der Ausgabedatei finden sich dann Abschnitte mit Namen wie:

Code: Select all

_NvAPI_GPU_GetMemoryInfo:
und ja, das sind die Funktionsnamen.

Im folgenden Codeabschnitt findet sich dann nach meinen Stichproben immer folgende Befehlskombination:

Code: Select all

 00001164: 68 68 B3 F9 07     push        7F9B368h
 00001169: FF 15 00 00 00 00  call        dword ptr [?g_nvapi_lpNvAPI_gpuQueryInterface@@3P6APAXK@ZA]
Und was da gepushed wird, sieht für viele Funktionen recht bekannt aus.
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

08 Nov 2014, 06:20

So, hier folgt eine ID-Liste, die ich aus Version R343 erstellt habe:

Code: Select all

_NvAPI_CreateDisplayFromUnAttachedDisplay                   0x63F9799E
_NvAPI_D3D11_AliasMSAATexture2DAsNonMSAA                    0xF1C54FC9
_NvAPI_D3D11_BeginUAVOverlap                                0x65B93CA8
_NvAPI_D3D11_CreateDevice                                   0x6A16D3A0
_NvAPI_D3D11_CreateDeviceAndSwapChain                       0xBB939EE5
_NvAPI_D3D11_CreateRasterizerState                          0xDB8D28AF
_NvAPI_D3D11_EndUAVOverlap                                  0x2216A357
_NvAPI_D3D11_IsNvShaderExtnOpCodeSupported                  0x5F68DA40
_NvAPI_D3D11_RSSetViewports                                 0xB5DB2762
_NvAPI_D3D11_SetDepthBoundsTest                             0x7AAF7A04
_NvAPI_D3D11_SetNvShaderExtnSlot                            0x8E90BB9F
_NvAPI_D3D1x_CreateSwapChain                                0x1BC21B66
_NvAPI_D3D1x_DisableShaderDiskCache                         0xD0CBCA7D
_NvAPI_D3D9_AliasSurfaceAsTexture                           0xE5CEAE41
_NvAPI_D3D9_ClearRT                                         0x332D3942
_NvAPI_D3D9_CreateSwapChain                                 0x1A131E09
_NvAPI_D3D9_GetSurfaceHandle                                0x0F2DD3F2
_NvAPI_D3D9_RegisterResource                                0xA064BDFC
_NvAPI_D3D9_StretchRectEx                                   0x22DE03AA
_NvAPI_D3D9_UnregisterResource                              0xBB2B17AA
_NvAPI_D3D9_VideoSetStereoInfo                              0xB852F4DB
_NvAPI_D3D_BeginResourceRendering                           0x91123D6A
_NvAPI_D3D_EndResourceRendering                             0x37E7191C
_NvAPI_D3D_GetCurrentSLIState                               0x4B708B54
_NvAPI_D3D_GetObjectHandleForResource                       0xFCEAC864
_NvAPI_D3D_SetFPSIndicatorState                             0xA776E8DB
_NvAPI_D3D_SetResourceHint                                  0x6C0ED98C
_NvAPI_DisableHWCursor                                      0xAB163097
_NvAPI_Disp_ColorControl                                    0x92F9D80D
_NvAPI_DISP_DeleteCustomDisplay                             0x552E5B9B
_NvAPI_DISP_EnumCustomDisplay                               0xA2072D59
_NvAPI_DISP_GetAssociatedUnAttachedNvidiaDisplayHandle      0xA70503B2
_NvAPI_DISP_GetDisplayConfig                                0x11ABCCF8
_NvAPI_DISP_GetDisplayIdByDisplayName                       0xAE457190
_NvAPI_DISP_GetGDIPrimaryDisplayId                          0x1E9D8A31
_NvAPI_DISP_GetMonitorCapabilities                          0x3B05C7E1
_NvAPI_DISP_GetMonitorColorCapabilities                     0x6AE4CFB5
_NvAPI_DISP_GetTiming                                       0x175167E9
_NvAPI_Disp_InfoFrameControl                                0x6067AF3F
_NvAPI_DISP_RevertCustomDisplayTrial                        0xCBBD40F0
_NvAPI_DISP_SaveCustomDisplay                               0x49882876
_NvAPI_DISP_SetDisplayConfig                                0x5D8CF8DE
_NvAPI_DISP_TryCustomDisplay                                0x1F7DB630
_NvAPI_DRS_CreateApplication                                0x4347A9DE
_NvAPI_DRS_CreateProfile                                    0xCC176068
_NvAPI_DRS_CreateSession                                    0x0694D52E
_NvAPI_DRS_DeleteApplication                                0x2C694BC6
_NvAPI_DRS_DeleteApplicationEx                              0xC5EA85A1
_NvAPI_DRS_DeleteProfile                                    0x17093206
_NvAPI_DRS_DeleteProfileSetting                             0xE4A26362
_NvAPI_DRS_DestroySession                                   0xDAD9CFF8
_NvAPI_DRS_EnumApplications                                 0x7FA2173A
_NvAPI_DRS_EnumAvailableSettingIds                          0xF020614A
_NvAPI_DRS_EnumAvailableSettingValues                       0x2EC39F90
_NvAPI_DRS_EnumProfiles                                     0xBC371EE0
_NvAPI_DRS_EnumSettings                                     0xAE3039DA
_NvAPI_DRS_FindApplicationByName                            0xEEE566B2
_NvAPI_DRS_FindProfileByName                                0x7E4A9A0B
_NvAPI_DRS_GetApplicationInfo                               0xED1F8C69
_NvAPI_DRS_GetBaseProfile                                   0xDA8466A0
_NvAPI_DRS_GetCurrentGlobalProfile                          0x617BFF9F
_NvAPI_DRS_GetNumProfiles                                   0x1DAE4FBC
_NvAPI_DRS_GetProfileInfo                                   0x61CD6FD6
_NvAPI_DRS_GetSetting                                       0x73BF8338
_NvAPI_DRS_GetSettingIdFromName                             0xCB7309CD
_NvAPI_DRS_GetSettingNameFromId                             0xD61CBE6E
_NvAPI_DRS_LoadSettings                                     0x375DBD6B
_NvAPI_DRS_LoadSettingsFromFile                             0xD3EDE889
_NvAPI_DRS_RestoreAllDefaults                               0x5927B094
_NvAPI_DRS_RestoreProfileDefault                            0xFA5F6134
_NvAPI_DRS_RestoreProfileDefaultSetting                     0x53F0381E
_NvAPI_DRS_SaveSettings                                     0xFCBC7E14
_NvAPI_DRS_SaveSettingsToFile                               0x2BE25DF8
_NvAPI_DRS_SetCurrentGlobalProfile                          0x1C89C5DF
_NvAPI_DRS_SetProfileInfo                                   0x16ABD3A9
_NvAPI_DRS_SetSetting                                       0x577DD202
_NvAPI_EnableCurrentMosaicTopology                          0x74073CC9
_NvAPI_EnableHWCursor                                       0x2863148D
_NvAPI_EnumLogicalGPUs                                      0x48B3EA59
_NvAPI_EnumNvidiaDisplayHandle                              0x9ABDD40D
_NvAPI_EnumNvidiaUnAttachedDisplayHandle                    0x20DE9260
_NvAPI_EnumPhysicalGPUs                                     0xE5AC921F
_NvAPI_EnumTCCPhysicalGPUs                                  0xD9930B07
_NvAPI_GetAssociatedDisplayOutputId                         0xD995937E
_NvAPI_GetAssociatedNvidiaDisplayHandle                     0x35C29134
_NvAPI_GetAssociatedNvidiaDisplayName                       0x22A78B05
_NvAPI_GetCurrentMosaicTopology                             0xF60852BD
_NvAPI_GetDisplayDriverVersion                              0xF951A4D1
_NvAPI_GetDisplayPortInfo                                   0xC64FF367
_NvAPI_GetErrorMessage                                      0x6C2D048C
_NvAPI_GetHDMISupportInfo                                   0x6AE16EC3
_NvAPI_GetInterfaceVersionString                            0x01053FA5
_NvAPI_GetLogicalGPUFromDisplay                             0xEE1370CF
_NvAPI_GetLogicalGPUFromPhysicalGPU                         0xADD604D1
_NvAPI_GetPhysicalGPUFromUnAttachedDisplay                  0x5018ED61
_NvAPI_GetPhysicalGPUsFromDisplay                           0x34EF9506
_NvAPI_GetPhysicalGPUsFromLogicalGPU                        0xAEA3FA32
_NvAPI_GetSupportedMosaicTopologies                         0x410B5C25
_NvAPI_GetSupportedViews                                    0x66FB7FC0
_NvAPI_GetUnAttachedAssociatedDisplayName                   0x4888D790
_NvAPI_GetVBlankCounter                                     0x67B5DB55
_NvAPI_GetView                                              0xD6B99D89
_NvAPI_GetViewEx                                            0xDBBC0AF4
_NvAPI_GPU_GetActiveOutputs                                 0xE3E89B6F
_NvAPI_GPU_GetAGPAperture                                   0x6E042794
_NvAPI_GPU_GetAllClockFrequencies                           0xDCB616C3
_NvAPI_GPU_GetAllDisplayIds                                 0x785210A2
_NvAPI_GPU_GetAllOutputs                                    0x7D554F8E
_NvAPI_GPU_GetBoardInfo                                     0x22D54523
_NvAPI_GPU_GetBusId                                         0x1BE0B8E5
_NvAPI_GPU_GetBusSlotId                                     0x2A0A350F
_NvAPI_GPU_GetBusType                                       0x1BB18724
_NvAPI_GPU_GetConnectedDisplayIds                           0x0078DBA2
_NvAPI_GPU_GetConnectedOutputs                              0x1730BFC9
_NvAPI_GPU_GetConnectedOutputsWithLidState                  0xCF8CAF39
_NvAPI_GPU_GetConnectedSLIOutputs                           0x0680DE09
_NvAPI_GPU_GetConnectedSLIOutputsWithLidState               0x96043CC7
_NvAPI_GPU_GetCurrentAGPRate                                0xC74925A0
_NvAPI_GPU_GetCurrentPCIEDownstreamWidth                    0xD048C3B1
_NvAPI_GPU_GetCurrentPstate                                 0x927DA4F6
_NvAPI_GPU_GetDynamicPstatesInfoEx                          0x60DED2ED
_NvAPI_GPU_GetECCConfigurationInfo                          0x77A796F3
_NvAPI_GPU_GetECCErrorInfo                                  0xC71F85A6
_NvAPI_GPU_GetECCStatusInfo                                 0xCA1DDAF3
_NvAPI_GPU_GetEDID                                          0x37D32E69
_NvAPI_GPU_GetFullName                                      0xCEEE8E9F
_NvAPI_GPU_GetGpuCoreCount                                  0xC7026A87
_NvAPI_GPU_GetGPUType                                       0xC33BAEB1
_NvAPI_GPU_GetHDCPSupportStatus                             0xF089EEF5
_NvAPI_GPU_GetIllumination                                  0x9A1B9365
_NvAPI_GPU_GetIRQ                                           0xE4715417
_NvAPI_GPU_GetMemoryInfo                                    0x07F9B368
_NvAPI_GPU_GetOutputType                                    0x40A505E4
_NvAPI_GPU_GetPCIIdentifiers                                0x2DDFB66E
_NvAPI_GPU_GetPerfDecreaseInfo                              0x7F7F4600
_NvAPI_GPU_GetPhysicalFrameBufferSize                       0x46FBEB03
_NvAPI_GPU_GetPstates20                                     0x6FF81213
_NvAPI_GPU_GetPstatesInfoEx                                 0x843C0256
_NvAPI_GPU_GetScanoutConfiguration                          0x6A9F5B63
_NvAPI_GPU_GetScanoutConfigurationEx                        0xE2E1E6F0
_NvAPI_GPU_GetScanoutIntensityState                         0xE81CE836
_NvAPI_GPU_GetScanoutWarpingState                           0x6F5435AF
_NvAPI_GPU_GetSystemType                                    0xBAAABFCC
_NvAPI_GPU_GetTachReading                                   0x5F608315
_NvAPI_GPU_GetThermalSettings                               0xE3640A56
_NvAPI_GPU_GetVbiosOEMRevision                              0x2D43FB31
_NvAPI_GPU_GetVbiosRevision                                 0xACC3DA0A
_NvAPI_GPU_GetVbiosVersionString                            0xA561FD7D
_NvAPI_GPU_GetVirtualFrameBufferSize                        0x5A04B644
_NvAPI_GPU_QueryIlluminationSupport                         0xA629DA31
_NvAPI_GPU_ResetECCErrorInfo                                0xC02EEC20
_NvAPI_GPU_SetECCConfiguration                              0x1CF639D9
_NvAPI_GPU_SetEDID                                          0xE83D6456
_NvAPI_GPU_SetIllumination                                  0x0254A187
_NvAPI_GPU_SetScanoutIntensity                              0xA57457A4
_NvAPI_GPU_SetScanoutWarping                                0xB34BAB4F
_NvAPI_GPU_ValidateOutputCombination                        0x34C9C2D4
_NvAPI_GPU_WorkstationFeatureQuery                          0x004537DF
_NvAPI_GPU_WorkstationFeatureSetup                          0x6C1F3FE4
_NvAPI_GSync_AdjustSyncDelay                                0x2D11FF51
_NvAPI_GSync_EnumSyncDevices                                0xD9639601
_NvAPI_GSync_GetControlParameters                           0x16DE1C6A
_NvAPI_GSync_GetStatusParameters                            0x70D404EC
_NvAPI_GSync_GetSyncStatus                                  0xF1F5B434
_NvAPI_GSync_GetTopology                                    0x4562BC38
_NvAPI_GSync_QueryCapabilities                              0x44A3F1D1
_NvAPI_GSync_SetControlParameters                           0x8BBFF88B
_NvAPI_GSync_SetSyncStateSettings                           0x60ACDFDD
_NvAPI_I2CRead                                              0x2FDE12C5
_NvAPI_I2CWrite                                             0xE812EB07
_NvAPI_Initialize                                           0x0150E828
_NvAPI_Mosaic_EnableCurrentTopo                             0x5F1AA66C
_NvAPI_Mosaic_EnumDisplayGrids                              0xDF2887AF
_NvAPI_Mosaic_EnumDisplayModes                              0x78DB97D7
_NvAPI_Mosaic_GetCurrentTopo                                0xEC32944E
_NvAPI_Mosaic_GetDisplayViewportsByResolution               0xDC6DC8D3
_NvAPI_Mosaic_GetOverlapLimits                              0x989685F0
_NvAPI_Mosaic_GetSupportedTopoInfo                          0xFDB63C81
_NvAPI_Mosaic_GetTopoGroup                                  0xCB89381D
_NvAPI_Mosaic_SetCurrentTopo                                0x9B542831
_NvAPI_Mosaic_SetDisplayGrids                               0x4D959A89
_NvAPI_Mosaic_ValidateDisplayGrids                          0xCF43903D
_NvAPI_OGL_ExpertModeDefaultsGet                            0xAE921F12
_NvAPI_OGL_ExpertModeDefaultsSet                            0xB47A657E
_NvAPI_OGL_ExpertModeGet                                    0x22ED9516
_NvAPI_OGL_ExpertModeSet                                    0x3805EF7A
_NvAPI_SetCurrentMosaicTopology                             0xD54B8989
_NvAPI_SetDisplayPort                                       0xFA13E65A
_NvAPI_SetRefreshRateOverride                               0x3092AC32
_NvAPI_SetView                                              0x0957D7B6
_NvAPI_SetViewEx                                            0x06B89E68
_NvAPI_Stereo_Activate                                      0xF6A1AD68
_NvAPI_Stereo_CaptureJpegImage                              0x932CB140
_NvAPI_Stereo_CapturePngImage                               0x8B7E99B5
_NvAPI_Stereo_CreateConfigurationProfileRegistryKey         0xBE7692EC
_NvAPI_Stereo_CreateHandleFromIUnknown                      0xAC7E37F4
_NvAPI_Stereo_Deactivate                                    0x2D68DE96
_NvAPI_Stereo_Debug_WasLastDrawStereoized                   0xED4416C5
_NvAPI_Stereo_DecreaseConvergence                           0x4C87E317
_NvAPI_Stereo_DecreaseSeparation                            0xDA044458
_NvAPI_Stereo_DeleteConfigurationProfileRegistryKey         0xF117B834
_NvAPI_Stereo_DeleteConfigurationProfileValue               0x49BCEECF
_NvAPI_Stereo_DestroyHandle                                 0x3A153134
_NvAPI_Stereo_Disable                                       0x2EC50C2B
_NvAPI_Stereo_Enable                                        0x239C4545
_NvAPI_Stereo_GetConvergence                                0x4AB00934
_NvAPI_Stereo_GetDefaultProfile                             0x624E21C2
_NvAPI_Stereo_GetEyeSeparation                              0xCE653127
_NvAPI_Stereo_GetFrustumAdjustMode                          0xE6839B43
_NvAPI_Stereo_GetSeparation                                 0x451F2134
_NvAPI_Stereo_GetStereoSupport                              0x296C434D
_NvAPI_Stereo_GetSurfaceCreationMode                        0x36F1C736
_NvAPI_Stereo_IncreaseConvergence                           0xA17DAABE
_NvAPI_Stereo_IncreaseSeparation                            0xC9A8ECEC
_NvAPI_Stereo_InitActivation                                0xC7177702
_NvAPI_Stereo_IsActivated                                   0x1FB0BC30
_NvAPI_Stereo_IsEnabled                                     0x348FF8E1
_NvAPI_Stereo_IsWindowedModeSupported                       0x40C8ED5E
_NvAPI_Stereo_ReverseStereoBlitControl                      0x3CD58F89
_NvAPI_Stereo_SetActiveEye                                  0x96EEA9F8
_NvAPI_Stereo_SetConfigurationProfileValue                  0x24409F48
_NvAPI_Stereo_SetConvergence                                0x3DD6B54B
_NvAPI_Stereo_SetDefaultProfile                             0x44F0ECD1
_NvAPI_Stereo_SetDriverMode                                 0x5E8F0BEC
_NvAPI_Stereo_SetFrustumAdjustMode                          0x7BE27FA2
_NvAPI_Stereo_SetNotificationMessage                        0x6B9B409E
_NvAPI_Stereo_SetSeparation                                 0x5C069FA3
_NvAPI_Stereo_SetSurfaceCreationMode                        0xF5DCFCBA
_NvAPI_Stereo_Trigger_Activation                            0x0D6C6CD2
_NvAPI_SYS_GetChipSetInfo                                   0x53DABBCA
_NvAPI_SYS_GetDisplayIdFromGpuAndOutputId                   0x08F2BAB4
_NvAPI_SYS_GetDriverAndBranchVersion                        0x2926AAAD
_NvAPI_SYS_GetGpuAndOutputIdFromDisplayId                   0x112BA1A5
_NvAPI_SYS_GetLidAndDockInfo                                0xCDA14D8A
_NvAPI_SYS_GetPhysicalGpuFromDisplayId                      0x9EA74659
_NvAPI_Unload                                               0xD22BDD7E
_NvAPI_VIO_Close                                            0xD01BD237
_NvAPI_VIO_EnumDataFormats                                  0x221FA8E8
_NvAPI_VIO_EnumDevices                                      0xFD7C5557
_NvAPI_VIO_EnumSignalFormats                                0xEAD72FE4
_NvAPI_VIO_GetCapabilities                                  0x1DC91303
_NvAPI_VIO_GetConfig                                        0xD34A789B
_NvAPI_VIO_GetCSC                                           0x7B0D72A3
_NvAPI_VIO_GetGamma                                         0x51D53D06
_NvAPI_VIO_GetPCIInfo                                       0xB981D935
_NvAPI_VIO_GetSyncDelay                                     0x462214A9
_NvAPI_VIO_IsFrameLockModeCompatible                        0x7BF0A94D
_NvAPI_VIO_IsRunning                                        0x96BD040E
_NvAPI_VIO_Open                                             0x44EE4841
_NvAPI_VIO_QueryTopology                                    0x869534E2
_NvAPI_VIO_SetConfig                                        0x0E4EEC07
_NvAPI_VIO_SetCSC                                           0xA1EC8D74
_NvAPI_VIO_SetGamma                                         0x964BF452
_NvAPI_VIO_SetSyncDelay                                     0x2697A8D1
_NvAPI_VIO_Start                                            0xCDE8E1A3
_NvAPI_VIO_Status                                           0x0E6CE4F1
_NvAPI_VIO_Stop                                             0x6BA2A5D6
_NvAPI_VIO_SyncFormatDetect                                 0x118D48A3
Das X64-Problem ist anscheinend auch gelöst. Die getesteten Funktionen funktionieren mit folgenden Änderungen auch unter 64-Bit:

Code: Select all

Class NvAPI
{
    static hmod
    static DllFile := A_PtrSize = 8 ? "nvapi64.dll" : "nvapi.dll"
    ...
    __New()
    {
        if !NvAPI.hmod
        {
            NvAPI.hmod                                       := DllCall("Kernel32.dll\LoadLibrary", "Str", this.DllFile, "UPtr") ; <<< return type
            NvAPI._EnumLogicalGPUs                           := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x48B3EA59, "CDECL UPtr") ; <<< return type
            NvAPI._EnumNvidiaDisplayHandle                   := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x9ABDD40D, "CDECL UPtr")
            NvAPI._EnumPhysicalGPUs                          := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0xE5AC921F, "CDECL UPtr")
            NvAPI._GetAssociatedNvidiaDisplayHandle          := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x35C29134, "CDECL UPtr")
            NvAPI._GetDisplayDriverMemoryInfo                := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x774AA982, "CDECL UPtr")
            NvAPI._GetDVCInfo                                := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x4085DE45, "CDECL UPtr")
            NvAPI._GetDVCInfoEx                              := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x0E45002D, "CDECL UPtr")
            NvAPI._GetErrorMessage                           := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x6C2D048C, "CDECL UPtr")
            NvAPI._GetInterfaceVersionString                 := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x01053FA5, "CDECL UPtr")
            NvAPI._GPU_GetActiveOutputs                      := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0xE3E89B6F, "CDECL UPtr")
            NvAPI._GPU_GetCoolerSettings                     := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0xDA141340, "CDECL UPtr")
            NvAPI._GPU_GetFullName                           := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0xCEEE8E9F, "CDECL UPtr")
            NvAPI._GPU_GetMemoryInfo                         := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x07F9B368, "CDECL UPtr") ; <<< ergänzt
            NvAPI._GPU_GetTachReading                        := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x5F608315, "CDECL UPtr")
            NvAPI._GPU_GetThermalSettings                    := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0xE3640A56, "CDECL UPtr")
            NvAPI._GPU_GetUsages                             := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x189A1FDF, "CDECL UPtr")
            NvAPI._Initialize                                := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x0150E828, "CDECL UPtr")
            NvAPI._SetDVCLevel                               := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0x172409B4, "CDECL UPtr")
            NvAPI._Unload                                    := DllCall(NvAPI.DllFile "\nvapi_QueryInterface", "UInt", 0xD22BDD7E, "CDECL UPtr")

            If !(NvAPI.NvAPI_Status := DllCall(NvAPI._Initialize, "CDECL") = 0)
                MsgBox % "Initial Error!`n" . NvAPI.NvAPI_Status . "`n" ErrorLevel . " - " . A_LastError
            ; DllCall(NvAPI._EnumNvidiaDisplayHandle, "Int", 0, "Int*", out, "CDECL")
            NvAPI.DefDispHandle := This.EnumNvidiaDisplayHandle()
        }
    }

User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Projekt NVIDIA

13 Nov 2014, 05:55

Hut ab just me =)

NvAPI IDs - Aktuelle (r343) + Alte
_NvAPI_IDs.txt

NvAPI Status
_NvAPI_Status.txt

Class_NVIDIA (ist natürlich noch nicht vollständig und fertig)
Class_NVIDIA.ahk


und GetMemoryInfo() funktioniert auch

Code: Select all

GetMemoryInfo(Index := 1)
{
	static NV_DISPLAY_DRIVER_MEMORY_INFO := 24
	hPhysicalGpu := this.EnumPhysicalGPUs()[Index]
	VarSetCapacity(pMemoryInfo, NV_DISPLAY_DRIVER_MEMORY_INFO, 0), NumPut(NV_DISPLAY_DRIVER_MEMORY_INFO|0x20000, pMemoryInfo, 0, "UInt")
	if !(NvStatus := DllCall(NvAPI._GPU_GetMemoryInfo, "Int", hPhysicalGpu, "Ptr", &pMemoryInfo, "CDECL"))
	{
		MI := {}
		MI.Dedicated        := NumGet(pMemoryInfo,  4, "UInt")
		MI.Available        := NumGet(pMemoryInfo,  8, "UInt")
		MI.System           := NumGet(pMemoryInfo, 12, "UInt")
		MI.Shared           := NumGet(pMemoryInfo, 16, "UInt")
		MI.CurrentAvailable := NumGet(pMemoryInfo, 20, "UInt")
		return MI
	}
	return "*" NvStatus
}

und hier entsteht dann ein GUI-Beispiel:
Class_NVIDIA_GUI (ist natürlich auch noch nicht vollständig und fertig)
Class_NVIDIA_GUI.ahk
Image
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Projekt NVIDIA

19 Nov 2014, 02:33

Was mache ich hier falsch?

Code: Select all

/*
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: NvAPI_SYS_GetDriverAndBranchVersion
//
//!   DESCRIPTION: This API returns display driver version and driver-branch string.
//!
//! SUPPORTED OS:  Windows XP and higher
//!
//! 
//! \param [out]  pDriverVersion         Contains the driver version after successful return.
//! \param [out]  szBuildBranchString    Contains the driver-branch string after successful return.
//!
//! \retval ::NVAPI_INVALID_ARGUMENT: either pDriverVersion is NULL or enum index too big
//! \retval ::NVAPI_OK - completed request
//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized
//! \retval ::NVAPI_ERROR - miscellaneous error occurred
//! 
//! \ingroup driverapi
///////////////////////////////////////////////////////////////////////////////
NVAPI_INTERFACE NvAPI_SYS_GetDriverAndBranchVersion(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString);
*/

SYS_GetDriverAndBranchVersion()
{
    VarSetCapacity(szBuildBranchString, this.NVAPI_SHORT_STRING_MAX, 0)
    if !(NvStatus := DllCall(NvAPI._SYS_GetDriverAndBranchVersion, "UInt", pDriverVersion, "Ptr", &szBuildBranchString, "CDECL"))
    {
        DB := {}
        DB.Version := pDriverVersion
        DB.Branch  := StrGet(&szBuildBranchString, "CP0")
        return DB
    }
    return "*" NvStatus
}
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

19 Nov 2014, 02:33

Hallo jNizM,

ich habe mich mal an der Funktion GPU_GetDynamicPstatesInfoEx() versucht, bekomme aber hier wieder nur den Status -1.Vielleicht hast Du mehr Erfolg.

Wie ich es sehe, signalisiert die Funktion im zweiten Feld der Rückgabestruktur im Bit 0, ob die dynamic pstates überhaupt aktiviert sind. Wenn ja, sollten in den folgenden Feldern die Werte für die vier 'Domänen' folgen, wobei es wieder ein Bit gibt, das eine Aussage über die Existenz dieser Domäne enthält.

Code: Select all

   /*
   ///////////////////////////////////////////////////////////////////////////////
   //
   // FUNCTION NAME: NvAPI_GPU_GetDynamicPstatesInfoEx
   //
   //! DESCRIPTION:   This API retrieves the NV_GPU_DYNAMIC_PSTATES_INFO_EX structure for the specified physical GPU.
   //!                Each domain's info is indexed in the array.  For example:
   //!                - pDynamicPstatesInfo->utilization[NVAPI_GPU_UTILIZATION_DOMAIN_GPU] holds the info for the GPU domain. \p
   //!                There are currently 4 domains for which GPU utilization and dynamic P-State thresholds can be retrieved:
   //!                   graphic engine (GPU), frame buffer (FB), video engine (VID), and bus interface (BUS).
   //!
   //! SUPPORTED OS:  Windows XP and higher,  Mac OS X
   //!
   //!
   //! \since Release: 185
   //!
   //! \retval ::NVAPI_OK
   //! \retval ::NVAPI_ERROR
   //! \retval ::NVAPI_INVALID_ARGUMENT  pDynamicPstatesInfo is NULL
   //! \retval ::NVAPI_HANDLE_INVALIDATED
   //! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE
   //! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the INFO struct is not supported
   //!
   //! \ingroup gpupstate
   ///////////////////////////////////////////////////////////////////////////////
   NVAPI_INTERFACE NvAPI_GPU_GetDynamicPstatesInfoEx(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_DYNAMIC_PSTATES_INFO_EX *pDynamicPstatesInfoEx);

	//! \ingroup gpupstate
   #define NVAPI_MAX_GPU_UTILIZATIONS 8
	//! Used in NV_GPU_DYNAMIC_PSTATES_INFO -> utilization[].
	typedef enum _NV_GPU_UTILIZATION_DOMAIN_ID
	{
		NVAPI_GPU_UTILIZATION_DOMAIN_GPU = 0, //!< Graphics engine domain
		NVAPI_GPU_UTILIZATION_DOMAIN_FB = 1, //!< Frame buffer domain
		NVAPI_GPU_UTILIZATION_DOMAIN_VID = 2, //!< Video engine domain
		NVAPI_GPU_UTILIZATION_DOMAIN_BUS = 3, //!< Bus interface domain
	} NV_GPU_UTILIZATION_DOMAIN_ID;
   //! Used in NvAPI_GPU_GetDynamicPstatesInfoEx().
   typedef struct
   {
       NvU32       version;        //!< Structure version
       NvU32       flags;          //!< bit 0 indicates if the dynamic Pstate is enabled or not
       struct
       {
           NvU32   bIsPresent:1;   //!< Set if this utilization domain is present on this GPU
           NvU32   percentage;     //!< Percentage of time where the domain is considered busy in the last 1 second interval
       } utilization[NVAPI_MAX_GPU_UTILIZATIONS];
   } NV_GPU_DYNAMIC_PSTATES_INFO_EX;
   //! \ingroup gpupstate
   //! Macro for constructing the version field of NV_GPU_DYNAMIC_PSTATES_INFO_EX
   #define NV_GPU_DYNAMIC_PSTATES_INFO_EX_VER MAKE_NVAPI_VERSION(NV_GPU_DYNAMIC_PSTATES_INFO_EX,1)
   */
   GPU_GetDynamicPstatesInfoEx(PhysGpuHandle := 0) {
      Static NVAPI_MAX_GPU_UTILIZATIONS := 8
      Static NVAPI_GPU_UTILIZATION_DOMAIN := ["GPU", "FB", "VID", "BUS"]
      Static SizeOfDynPstInfo := 8 + (8 * NVAPI_MAX_GPU_UTILIZATIONS)
      If (PhysGpuHandle = 0)
         PhysGpuHandle := This.EnumPhysicalGPUs().1
      VarSetCapacity(DynPstInfo, SizeOfDynPstInfo, 0)
      NumPut(SizeOfDynPstInfo | 0x10000, DynPstInfo, 0, "UInt")
      If (NvStatus := DllCall(NvAPI._GPU_GetDynamicPstatesInfoEx, "UInt", PhysGpuHandle, "Ptr", &DynPstInfo, "CDECL")) = 0 {
         Pstates := {}
         Pstates.Enabled := NumGet(DynPstInfo, 4, "UInt") & 1
         OffSet := 8
         For Index, Domain In NVAPI_GPU_UTILIZATION_DOMAIN {
            Pstates[Domain, "IsPresent"]  := NumGet(DynPstInfo, Offset, "UInt") & 1
            Pstates[Domain, "Percentage"] := NumGet(DynPstInfo, Offset + 4, "UInt")
            Offset += 8
         }
         Return Pstates
      }
      ErrorLevel := NvStatus
      Return False
   }
Und nochmal zum Thema GPU_GetUsages(). Hast Du Dir mal die anderen 32 Felder der Rückgabestruktur angeschaut?
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

19 Nov 2014, 02:34

Hallo,

das war fast zeitgleich. Ich schau mir deins mal an.
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

19 Nov 2014, 02:50

Hallo,

NvAPI_SYS_GetDriverAndBranchVersion() funktioniert bei mir ausnahmsweise, allerdings mit folgender Änderung:

if !(NvStatus := DllCall(NvAPI._SYS_GetDriverAndBranchVersion, "UIntP", pDriverVersion, "Ptr", &szBuildBranchString, "CDECL"))

Grund: NvAPI_SYS_GetDriverAndBranchVersion(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString)
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Projekt NVIDIA

19 Nov 2014, 03:08

Was so ein kleines "P" so alles anstellt :D
Danke für den Tip

Mich wunderts nur das bei mir angezeigt wird:
Version: 34475
Branch: r343_00

Und ein anderes Tool was ich zum Überprüfen benutze zeigt:
Version: R344.75
Branch: r343_00-311



GPU_GetDynamicPstatesInfoEx() & GPU_GetUsages() schau ich mir gleich mal an
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

19 Nov 2014, 03:23

Na ja, das R344.75 dürfte einfach nur aufbereitet sein. Es wäre jedenfalls merkwürdig, wenn in einem 32-bittigen UINT Feld solche Zeichen zu finden wären.

Wo das angehängte -311 herkommt, weiß ich auch nicht. Vielleicht nutzt das Tool noch eine weitere/andere Funktion.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Projekt NVIDIA

19 Nov 2014, 03:31

Wie fragst du GPU_GetDynamicPstatesInfoEx() ab? bei mir kommt immer ein leeres Feld

Bei GPU_GetDynamicPstatesInfoEx().Enabled ==> 0

Image
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
just me
Posts: 9449
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Projekt NVIDIA

19 Nov 2014, 03:57

Alles, was ich darüber weiß, kommt aus der 'großen' nvapi.h Datei:

Code: Select all

   typedef struct
   {
       NvU32       version;        //!< Structure version
       NvU32       flags;          //!< bit 0 indicates if the dynamic Pstate is enabled or not
       struct
       {
           NvU32   bIsPresent:1;   //!< Set if this utilization domain is present on this GPU
           NvU32   percentage;     //!< Percentage of time where the domain is considered busy in the last 1 second interval
       } utilization[NVAPI_MAX_GPU_UTILIZATIONS];
   } NV_GPU_DYNAMIC_PSTATES_INFO_EX;
Die Felder des Rückgabeobjekts sind:

Code: Select all

Object.Enabled             <- hier landet der Wert aus 'flags'
Object.GPU.IsPresent       <- hier landet der este Wert aus 'bIsPresent'
Object.GPU.Percentage      <- hier landet der erste Wert aus 'percentage'
Object.FB.IsPrecent        <- hier landet der zweite Wert aus 'bIsPresent'
Object.FB.Percentageq      <- hier landet der zweite Wert ...
...
...
Wenn Du allerdings in Enabled 0 geliefert bekommst, weiß ich nicht, ob der Rest überhaupt aussagekräftig ist. Du könntest dann mal Folgendes versuchen:

Pstates.Enabled := NumGet(DynPstInfo, 4, "UInt") ; & 1 auskommentieren

Return to “Ich brauche Hilfe”

Who is online

Users browsing this forum: No registered users and 23 guests