Data Structures | |
| struct | NvRmGpuLibVersionInfoRec |
| The version information structure returned by NvRmGpuLibGetVersionInfo(). More... | |
| struct | NvRmGpuLibOpenAttrRec |
| Extensible attribute structure for NvRmGpuLibOpen() More... | |
| struct | NvRmGpuLibDeviceListEntryRec |
| Device list entry. More... | |
Macros | |
| #define | NVRM_GPU_DEFINE_LIB_OPEN_ATTR(x) NvRmGpuLibOpenAttr x = { 0U } |
| Definer macro for NvRmGpuLibOpenAttr. More... | |
Typedefs | |
| typedef struct NvRmGpuLibRec | NvRmGpuLib |
| Library handle. More... | |
| typedef struct NvRmGpuLibVersionInfoRec | NvRmGpuLibVersionInfo |
| The version information structure returned by NvRmGpuLibGetVersionInfo(). More... | |
| typedef struct NvRmGpuLibOpenAttrRec | NvRmGpuLibOpenAttr |
| Extensible attribute structure for NvRmGpuLibOpen() More... | |
| typedef struct NvRmGpuLibDeviceListEntryRec | NvRmGpuLibDeviceListEntry |
| Device list entry. More... | |
Enumerations | |
| enum | NvRmGpuLibDeviceState { NvRmGpuLibDeviceState_Attached, NvRmGpuLibDeviceState_InsufficientPrivileges, NvRmGpuLibDeviceState_Unknown } |
| Device attachment state. More... | |
Functions | |
| const NvRmGpuLibVersionInfo * | NvRmGpuLibGetVersionInfo (void) |
| Returns the library version information. More... | |
| NvRmGpuLib * | NvRmGpuLibOpen (const NvRmGpuLibOpenAttr *attr) |
| Opens a new instance of the nvrm_gpu library. More... | |
| NvError | NvRmGpuLibClose (NvRmGpuLib *hLib) |
| Closes the library and releases all resources. More... | |
| const NvRmGpuLibDeviceListEntry * | NvRmGpuLibListDevices (NvRmGpuLib *hLib, size_t *pNumDevices) |
| Returns the list of probed GPUs. More... | |
| #define NVRM_GPU_DEFINE_LIB_OPEN_ATTR | ( | x | ) | NvRmGpuLibOpenAttr x = { 0U } |
Definer macro for NvRmGpuLibOpenAttr.
This macro defines a variable of type NvRmGpuLibOpenAttr with the default values.
Definition at line 367 of file nvrm_gpu.h.
| typedef struct NvRmGpuLibRec NvRmGpuLib |
Library handle.
Definition at line 251 of file nvrm_gpu.h.
| typedef struct NvRmGpuLibDeviceListEntryRec NvRmGpuLibDeviceListEntry |
Device list entry.
| typedef struct NvRmGpuLibOpenAttrRec NvRmGpuLibOpenAttr |
Extensible attribute structure for NvRmGpuLibOpen()
This structure specifies the attributes for opening the nvrm_gpu library. Use NVRM_GPU_DEFINE_LIB_OPEN_ATTR() to define the attribute struct with defaults.
Example:
// define libOpenAttr with default values NVRM_GPU_DEFINE_LIB_OPEN_ATTR(libOpenAttr); // open the library NvRmGpuLib *hLib = NvRmGpuLibOpen(&libOpenAttr);
| typedef struct NvRmGpuLibVersionInfoRec NvRmGpuLibVersionInfo |
The version information structure returned by NvRmGpuLibGetVersionInfo().
Device attachment state.
| Enumerator | |
|---|---|
| NvRmGpuLibDeviceState_Attached | Device is attached and may be opened with NvRmGpuDeviceOpen() |
| NvRmGpuLibDeviceState_InsufficientPrivileges | Device exists, but not enough privileges to access. |
| NvRmGpuLibDeviceState_Unknown | Device state is not known. Prober failed to determine device state. |
Definition at line 484 of file nvrm_gpu.h.
| NvError NvRmGpuLibClose | ( | NvRmGpuLib * | hLib | ) |
Closes the library and releases all resources.
| [in] | hLib | Library handle. May be NULL, in which case this function is a no-op. |
| NvSuccess | The library was closed and all related resources were freed successfully |
| NvError_* | Unspecified error. The error code is returned for diagnostic purposes. The library object is closed regardless but some resources may have failed to close gracefully. |
Usage considerations
| const NvRmGpuLibVersionInfo* NvRmGpuLibGetVersionInfo | ( | void | ) |
Returns the library version information.
Usage considerations
| const NvRmGpuLibDeviceListEntry* NvRmGpuLibListDevices | ( | NvRmGpuLib * | hLib, |
| size_t * | pNumDevices | ||
| ) |
Returns the list of probed GPUs.
Returns the list of probed GPUs. The list is valid until the library handle is closed.
| [in] | hLib | Library handle |
| [out] | pNumDevices | Non-NULL Pointer to receive the number of entries in the list |
Usage considerations
| NvRmGpuLib* NvRmGpuLibOpen | ( | const NvRmGpuLibOpenAttr * | attr | ) |
Opens a new instance of the nvrm_gpu library.
This function creates a new library handle and initializes the library if necessary. After the library is no longer used, the library handle should be closed with NvRmGpuLibClose() to avoid memory leaks.
| [in] | attr | Extensible library open attributes, or NULL for defaults. Currently unused. |
NULL if the library could not be initialized.Example:
// open the library
NvRmGpuLib *hLib = NvRmGpuLibOpen(NULL);
if (hLib != NULL)
{
NvRmGpuDevice *hDevice = NULL;
NvError err;
err = NvRmGpuDeviceOpen(hLib, NVRM_GPU_DEVICE_INDEX_DEFAULT, NULL, &hDevice);
if (err == NvSuccess)
{
// use the device
...
// all done, close the device
NvRmGpuDeviceClose(hDevice);
}
else
{
// deal with the error
}
/// all done, close the library
NvRmGpuLibClose(hLib);
}
else
{
// deal with the error
}
Usage considerations