NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
nvrm_gpusched.h File Reference

Go to the source code of this file.

Data Structures

struct  NvRmGpuSchedTsgParamsRec
 
struct  NvRmGpuSchedSessionAttrRec
 

Macros

#define NVRM_GPUSCHED_DEFINE_SESSION_ATTR(x)   NvRmGpuSchedSessionAttr x = { 0 }
 
#define NVRM_GPUSCHED_WAIT_INFINITE   ((uint32_t)-1)
 

Typedefs

typedef uint32_t NvRmGpuSchedTsgId
 
typedef struct NvRmGpuSchedSessionRec NvRmGpuSchedSession
 
typedef struct NvRmGpuSchedTsgRec NvRmGpuSchedTsg
 
typedef struct NvRmGpuSchedTsgSetRec NvRmGpuSchedTsgSet
 
typedef struct NvRmGpuSchedTsgParamsRec NvRmGpuSchedTsgParams
 
typedef struct NvRmGpuSchedSessionAttrRec NvRmGpuSchedSessionAttr
 

Enumerations

enum  NvRmGpuSchedStatus {
  NVRM_GPUSCHED_STATUS_OK = 0,
  NVRM_GPUSCHED_STATUS_BAD_PARAMETER,
  NVRM_GPUSCHED_STATUS_PENDING,
  NVRM_GPUSCHED_STATUS_TIMED_OUT,
  NVRM_GPUSCHED_STATUS_OUT_OF_MEMORY,
  NVRM_GPUSCHED_STATUS_NOT_INITIALIZED,
  NVRM_GPUSCHED_STATUS_NOT_SUPPORTED,
  NVRM_GPUSCHED_STATUS_ERROR,
  NVRM_GPUSCHED_STATUS_NONE_PENDING,
  NVRM_GPUSCHED_STATUS_INSUFFICIENT_BUFFERING,
  NVRM_GPUSCHED_STATUS_INVALID_SIZE,
  NVRM_GPUSCHED_STATUS_INCOMPATIBLE_VERSION
}
 The set of all possible error codes. More...
 
enum  NvRmGpuSchedTsgEvents { NVRM_GPUSCHED_TSG_EVENT_OPEN = (1ULL << 0) }
 Bitfield of TSG events. More...
 
enum  NvRmGpuSchedRunlistInterleave {
  NVRM_GPUSCHED_RUNLIST_INTERLEAVE_LOW = 1,
  NVRM_GPUSCHED_RUNLIST_INTERLEAVE_MEDIUM = 2,
  NVRM_GPUSCHED_RUNLIST_INTERLEAVE_HIGH = 3
}
 

Functions

NvRmGpuSchedStatus NvRmGpuSchedSessionOpen (const NvRmGpuSchedSessionAttr *attr, NvRmGpuSchedSession **phSession)
 Open GPU scheduling control session. More...
 
void NvRmGpuSchedSessionClose (NvRmGpuSchedSession *hSession)
 Close GPU scheduling control session. More...
 
NvRmGpuSchedStatus NvRmGpuSchedWaitTsgEvents (NvRmGpuSchedSession *hSession, NvRmGpuSchedTsgEvents *events, uint32_t timeout)
 Blocking wait on any TSG event. More...
 
NvRmGpuSchedStatus NvRmGpuSchedGetAllActiveTsgs (NvRmGpuSchedTsgSet *hTsgSet)
 Get list of all TSGs. More...
 
NvRmGpuSchedStatus NvRmGpuSchedGetDeltaTsgs (NvRmGpuSchedTsgSet *hTsgSet)
 Get list of recent TSGs. More...
 
NvRmGpuSchedStatus NvRmGpuSchedGetTsgsByPid (NvRmGpuSchedTsgSet *hTsgSet, pid_t pid)
 Get list of TSGs for a given pid. More...
 
NvRmGpuSchedStatus NvRmGpuSchedGetNextTsgId (NvRmGpuSchedTsgSet *hTsgSet, NvRmGpuSchedTsgId *tsgid)
 Get next TSG identifier from a TSG set. More...
 
NvRmGpuSchedStatus NvRmGpuSchedGetTsgHandle (NvRmGpuSchedSession *hSession, NvRmGpuSchedTsgId tsgid, NvRmGpuSchedTsg **phTsg)
 Get a handle to a TSG. More...
 
NvRmGpuSchedStatus NvRmGpuSchedGetTsgParams (NvRmGpuSchedTsg *hTsg, NvRmGpuSchedTsgParams *params)
 Get current GPU scheduling parameters for a TSG. More...
 
NvRmGpuSchedStatus NvRmGpuSchedSetTsgInterleave (NvRmGpuSchedTsg *hTsg, NvRmGpuSchedRunlistInterleave interleave)
 Set runlist interleave for a TSG. More...
 
NvRmGpuSchedStatus NvRmGpuSchedSetTsgTimeslice (NvRmGpuSchedTsg *hTsg, uint32_t timeslice)
 Set timeslice for a TSG. More...
 
NvRmGpuSchedStatus NvRmGpuSchedReleaseTsgHandle (NvRmGpuSchedTsg *hTsg)
 Release TSG handle. More...
 
NvRmGpuSchedStatus NvRmGpuSchedLockControl (NvRmGpuSchedSession *hSession)
 Lock GPU scheduling control, to prevent other application to change their own scheduling parameters using the per-TSG API. More...
 
NvRmGpuSchedStatus NvRmGpuSchedUnlockControl (NvRmGpuSchedSession *hSession)
 Unlock GPU scheduling control, to allow other application to change their own scheduling parameters using the per-TSG API. More...
 
NvRmGpuSchedStatus NvRmGpuSchedAllocateTsgSet (NvRmGpuSchedSession *hSession, NvRmGpuSchedTsgSet **phSet)
 Allocate a TSG set. More...
 
void NvRmGpuSchedFreeTsgSet (NvRmGpuSchedTsgSet *hSet)
 Free TSG set. More...
 

Macro Definition Documentation

◆ NVRM_GPUSCHED_DEFINE_SESSION_ATTR

#define NVRM_GPUSCHED_DEFINE_SESSION_ATTR (   x)    NvRmGpuSchedSessionAttr x = { 0 }

Definition at line 84 of file nvrm_gpusched.h.

◆ NVRM_GPUSCHED_WAIT_INFINITE

#define NVRM_GPUSCHED_WAIT_INFINITE   ((uint32_t)-1)

Definition at line 87 of file nvrm_gpusched.h.

Typedef Documentation

◆ NvRmGpuSchedSession

typedef struct NvRmGpuSchedSessionRec NvRmGpuSchedSession

Definition at line 23 of file nvrm_gpusched.h.

◆ NvRmGpuSchedSessionAttr

◆ NvRmGpuSchedTsg

typedef struct NvRmGpuSchedTsgRec NvRmGpuSchedTsg

Definition at line 24 of file nvrm_gpusched.h.

◆ NvRmGpuSchedTsgId

typedef uint32_t NvRmGpuSchedTsgId

Definition at line 22 of file nvrm_gpusched.h.

◆ NvRmGpuSchedTsgParams

◆ NvRmGpuSchedTsgSet

typedef struct NvRmGpuSchedTsgSetRec NvRmGpuSchedTsgSet

Definition at line 25 of file nvrm_gpusched.h.

Enumeration Type Documentation

◆ NvRmGpuSchedRunlistInterleave

Enumerator
NVRM_GPUSCHED_RUNLIST_INTERLEAVE_LOW 
NVRM_GPUSCHED_RUNLIST_INTERLEAVE_MEDIUM 
NVRM_GPUSCHED_RUNLIST_INTERLEAVE_HIGH 

Definition at line 66 of file nvrm_gpusched.h.

◆ NvRmGpuSchedStatus

The set of all possible error codes.

Enumerator
NVRM_GPUSCHED_STATUS_OK 

The operation completed successfully; no error.

NVRM_GPUSCHED_STATUS_BAD_PARAMETER 

Bad parameter was passed.

NVRM_GPUSCHED_STATUS_PENDING 

Operation has not finished yet.

NVRM_GPUSCHED_STATUS_TIMED_OUT 

Operation timed out.

NVRM_GPUSCHED_STATUS_OUT_OF_MEMORY 

Out of memory.

NVRM_GPUSCHED_STATUS_NOT_INITIALIZED 

Not initialized.

NVRM_GPUSCHED_STATUS_NOT_SUPPORTED 

Not supported.

NVRM_GPUSCHED_STATUS_ERROR 

A catch-all error, used when no other error code applies.

NVRM_GPUSCHED_STATUS_NONE_PENDING 

No operation is pending.

NVRM_GPUSCHED_STATUS_INSUFFICIENT_BUFFERING 

Insufficient buffering.

NVRM_GPUSCHED_STATUS_INVALID_SIZE 

Invalid size.

NVRM_GPUSCHED_STATUS_INCOMPATIBLE_VERSION 

Incompatible version.

Definition at line 30 of file nvrm_gpusched.h.

◆ NvRmGpuSchedTsgEvents

Bitfield of TSG events.

Enumerator
NVRM_GPUSCHED_TSG_EVENT_OPEN 

At least one TSG has been opened.

Definition at line 60 of file nvrm_gpusched.h.

Function Documentation

◆ NvRmGpuSchedAllocateTsgSet()

NvRmGpuSchedStatus NvRmGpuSchedAllocateTsgSet ( NvRmGpuSchedSession hSession,
NvRmGpuSchedTsgSet **  phSet 
)

Allocate a TSG set.

TSG set contains an internal iterator which is reset every time the set is used with a query functions like NvRmGpuSchedGetAllActiveTsgs, NvRmGpuSchedGetDeltaTsgs or NvRmGpuSchedGetTsgByPids. TSG set is recyclable, i.e. it can be used several times with query functions.

Parameters
session- pointer to session
phSet- address of TSG set handle to be allocated
Returns
NVRM_GPUSCHED_STATUS_OK if TSG set could be allocated.

◆ NvRmGpuSchedFreeTsgSet()

void NvRmGpuSchedFreeTsgSet ( NvRmGpuSchedTsgSet hSet)

Free TSG set.

Parameters
hSet- TSG set handle

◆ NvRmGpuSchedGetAllActiveTsgs()

NvRmGpuSchedStatus NvRmGpuSchedGetAllActiveTsgs ( NvRmGpuSchedTsgSet hTsgSet)

Get list of all TSGs.

Parameters
hTsgSet- handle to TSG set. will contain active TSGs on success.
Returns
NVRM_GPUSCHED_STATUS_OK when all active TSGs could be retrieved.

◆ NvRmGpuSchedGetDeltaTsgs()

NvRmGpuSchedStatus NvRmGpuSchedGetDeltaTsgs ( NvRmGpuSchedTsgSet hTsgSet)

Get list of recent TSGs.

The first time this function is invoked, it returns the complete list of TSGs. Afterwards, it returns the list of TSGs that were opened since last invocation of this function.

Parameters
hTsgSet- handle to TSG set. will contain delta TSGs on success.
Returns
NVRM_GPUSCHED_STATUS_OK when recent TSGs could be retrieved (note that the list can be empty if no TSG was allocated since last invocation of this function)

◆ NvRmGpuSchedGetNextTsgId()

NvRmGpuSchedStatus NvRmGpuSchedGetNextTsgId ( NvRmGpuSchedTsgSet hTsgSet,
NvRmGpuSchedTsgId tsgid 
)

Get next TSG identifier from a TSG set.

TSG set has an internal iterator which is incremented until all TSGs in the set are iterated.

Parameters
hTsgSet- handle to TSG set
tsgid- a TSG identifier
Returns
NVRM_GPUSCHED_STATUS_OK if one TSG could be fetched from the TSG set.
NVRM_GPUSCHED_NONE_PENDING if TSG is empty.

◆ NvRmGpuSchedGetTsgHandle()

NvRmGpuSchedStatus NvRmGpuSchedGetTsgHandle ( NvRmGpuSchedSession hSession,
NvRmGpuSchedTsgId  tsgid,
NvRmGpuSchedTsg **  phTsg 
)

Get a handle to a TSG.

Acquiring the TSG ensures it is not re-allocated while setting scheduling parameters. After setting scheduling parameters, this handle must be released using NvRmGpuSchedReleaseTsgHandle.

Parameters
hSession- session handle
tsgid- a TSG identifier
phTsg- address of TSG handle to be allocated
Returns
NVRM_GPUSCHED_STATUS_OK if TSG could be acquired.

◆ NvRmGpuSchedGetTsgParams()

NvRmGpuSchedStatus NvRmGpuSchedGetTsgParams ( NvRmGpuSchedTsg hTsg,
NvRmGpuSchedTsgParams params 
)

Get current GPU scheduling parameters for a TSG.

Parameters
hTsg- handle to TSG
params- GPU scheduling parameters
Returns
NVRM_GPUSCHED_STATUS_OK if params could be retrieved for this TSG.

◆ NvRmGpuSchedGetTsgsByPid()

NvRmGpuSchedStatus NvRmGpuSchedGetTsgsByPid ( NvRmGpuSchedTsgSet hTsgSet,
pid_t  pid 
)

Get list of TSGs for a given pid.

Parameters
hTsgSet- handle to TSG set. will contain process's TSGs on success.
pid- process identifier
Returns
NVRM_GPUSCHED_STATUS_OK when list of TSG could be retrieved (note that the list can be empty if no TSG was found for this pid)

◆ NvRmGpuSchedLockControl()

NvRmGpuSchedStatus NvRmGpuSchedLockControl ( NvRmGpuSchedSession hSession)

Lock GPU scheduling control, to prevent other application to change their own scheduling parameters using the per-TSG API.

Locking is non sticky: it ends when the session is closed, or when the app manager exits.

Parameters
hSession- session handle
Returns
NVRM_GPUSCHED_STATUS_OK if GPU scheduling control could be locked

◆ NvRmGpuSchedReleaseTsgHandle()

NvRmGpuSchedStatus NvRmGpuSchedReleaseTsgHandle ( NvRmGpuSchedTsg hTsg)

Release TSG handle.

Parameters
hTsg- handle to TSG
Returns
NVRM_GPUSCHED_STATUS_OK if TSG handle could be released

◆ NvRmGpuSchedSessionClose()

void NvRmGpuSchedSessionClose ( NvRmGpuSchedSession hSession)

Close GPU scheduling control session.

Parameters
hSession- session handle

◆ NvRmGpuSchedSessionOpen()

NvRmGpuSchedStatus NvRmGpuSchedSessionOpen ( const NvRmGpuSchedSessionAttr attr,
NvRmGpuSchedSession **  phSession 
)

Open GPU scheduling control session.

Parameters
attr- session attributes
phSession- address of GPU sched session handle to be allocated
Returns
NVRM_GPUSCHED_STATUS_OK Indicates that GPU scheduling session is opened.

◆ NvRmGpuSchedSetTsgInterleave()

NvRmGpuSchedStatus NvRmGpuSchedSetTsgInterleave ( NvRmGpuSchedTsg hTsg,
NvRmGpuSchedRunlistInterleave  interleave 
)

Set runlist interleave for a TSG.

Parameters
hTsg- handle to TSG
interleave- interleave level
Returns
NVRM_GPUSCHED_STATUS_OK if interleave could be set for this TSG.

◆ NvRmGpuSchedSetTsgTimeslice()

NvRmGpuSchedStatus NvRmGpuSchedSetTsgTimeslice ( NvRmGpuSchedTsg hTsg,
uint32_t  timeslice 
)

Set timeslice for a TSG.

Parameters
hTsg- handle to TSG
timeslice- timeslice in usecs.
Returns
NVRM_GPUSCHED_STATUS_OK if timeslice could be set for this TSG.

◆ NvRmGpuSchedUnlockControl()

NvRmGpuSchedStatus NvRmGpuSchedUnlockControl ( NvRmGpuSchedSession hSession)

Unlock GPU scheduling control, to allow other application to change their own scheduling parameters using the per-TSG API.

Parameters
hSession- pointer to session
Returns
NVRM_GPUSCHED_STATUS_OK if GPU scheduling control could be unlocked

◆ NvRmGpuSchedWaitTsgEvents()

NvRmGpuSchedStatus NvRmGpuSchedWaitTsgEvents ( NvRmGpuSchedSession hSession,
NvRmGpuSchedTsgEvents events,
uint32_t  timeout 
)

Blocking wait on any TSG event.

Parameters
session- session handle
events- output bitfield of TSG event that occurred. can be NULL, if caller does not need this information.
timeout- timeout value in milliseconds. NVRM_GPUSCHED_WAIT_INFINITE to wait infinitely.
Returns
NVRM_GPUSCHED_STATUS_OK indicates that we received events. 'events' contains theTSG events that occurred.