NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release
nvrm_host1x.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2024 NVIDIA Corporation. All rights reserved.
3  *
4  * NVIDIA Corporation and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA Corporation is strictly prohibited.
9  */
10 
11 #ifndef INCLUDED_nvrm_host1x_H
12 #define INCLUDED_nvrm_host1x_H
13 
14 #include "nvrm_memmgr.h"
15 #include "nvrm_module.h"
16 #include "nvrm_init.h"
18 
19 struct NvRmSyncRec;
20 struct NvRmHost1xChannel;
21 
22 #if defined(__cplusplus)
23 extern "C" {
24 #endif
25 
29 typedef struct NvRmChannelRec *NvRmChannelHandle;
30 
35 typedef struct NvRmContextRec *NvRmContextHandle;
36 
40 typedef enum {
44 } NvRmClockId;
45 
49 typedef struct NvRmTimevalRec
50 {
51  NvU64 sec;
52  NvU64 nsec;
54 } NvRmTimeval;
55 
60 typedef struct NvRmEngineStatusRec {
61  // Timestamp reflecting when the status was written. If the engine
62  // supports reading the time from global timestamp engine, the
63  // timestamp uses GTE. Otherwise this is nanoseconds since Jan. 1,
64  // 1970.
65  NvU64 timestamp;
66 
67  // Additional status information of the engine state
68  NvU32 info32;
69  NvU16 info16;
70 
71  // Engine status. 0 if there are no errors, otherwise an engine
72  // specific error code.
73  NvU16 status;
75 
79 #define NVRM_MUTEX_INVALID ((NvU32)-1)
80 
99  NvRmDeviceHandle hDevice,
100  NvRmChannelHandle * phChannel,
101  const char *node );
102 
124  NvRmDeviceHandle hDevice,
125  NvRmChannelHandle * phChannel,
126  NvU32 NumModules,
127  const NvRmModuleID * pModuleIDs );
128 
137  void NvRmChannelClose(
138  NvRmChannelHandle hChannel );
139 
150  NvRmChannelHandle phChannel,
151  NvU64 errLimit,
152  NvU32 errOffset,
153  NvU32 errMemHandle);
154 
163 void NvRmChannelSyncPointFree(NvRmDeviceHandle hDevice, NvU32 SyncPointID);
164 
180  NvRmChannelHandle hChannel,
181  NvRmModuleID Module,
182  NvU32 Index,
183  NvU32 * pSyncPointID );
184 
199  NvRmChannelHandle hChannel,
200  const char *name,
201  NvU32 SyncPointIndex,
202  NvU32 *pSyncPointID );
203 
212  NvRmChannelHandle hChannel,
213  NvU32 SyncPointIndex,
214  NvU32 pSyncPointID );
215 
227  NvRmDeviceHandle hDevice,
228  NvU32 SyncPointID );
229 
240 void NvRmChannelSyncPointIncr(NvRmDeviceHandle hDevice, NvU32 SyncPointID);
241 
255  NvRmDeviceHandle hDevice,
256  NvU32 SyncPointID,
257  NvU32 Threshold,
258  NvOsSemaphoreHandle hSema );
259 
269  NvRmDeviceHandle hDevice,
270  const NvRmFence * Fence,
271  NvU32 Timeout );
272 
283  const char * Name,
284  const NvRmFence * Fences,
285  NvU32 NumFences,
286  NvS32 * Fd );
287 
299  NvS32 Fd,
300  NvRmFence * Fences,
301  NvU32 * NumFences );
302 
317  NvRmDeviceHandle hDevice,
318  NvU32 SyncPointID,
319  NvU32 Threshold,
320  NvOsSemaphoreHandle hSema,
321  NvU32 Timeout );
322 
338  NvRmDeviceHandle hDevice,
339  NvU32 SyncPointID,
340  NvU32 Threshold,
341  NvOsSemaphoreHandle hSema,
342  NvU32 Timeout,
343  NvU32 * Actual );
344 
360  NvRmDeviceHandle hDevice,
361  NvU32 SyncPointID,
362  NvU32 Threshold,
363  NvOsSemaphoreHandle hSema,
364  NvU32 Timeout,
365  NvU32 *Actual,
366  NvRmTimeval *tv);
367 
377  NvRmChannelHandle hChannel,
378  NvRmModuleID Module,
379  NvU32 * Rate );
380 
390  NvRmChannelHandle hChannel,
391  NvRmModuleID Module,
392  NvU32 Rate );
393 
403  NvRmChannelHandle hChannel,
404  NvRmModuleID Module,
405  NvU32 BW );
406 
416  NvRmChannelHandle hChannel,
417  NvRmModuleID Module,
418  NvU32 PixelRate);
419 
429  NvRmChannelHandle hChannel,
430  NvU32 SubmitTimeout,
431  NvBool DisableDebugDump );
432 
441  NvRmChannelHandle hChannel,
442  NvU32 SubmitTimeout );
443 
462  NvRmDeviceHandle device,
464  NvRmModuleID id,
465  NvU32 num,
466  const NvU32 * offsets,
467  NvU32 * values );
468 
484  NvRmDeviceHandle device,
486  NvRmModuleID id,
487  NvU32 num,
488  const NvU32 * offset,
489  const NvU32 * values );
490 
507  NvRmDeviceHandle device,
509  NvRmModuleID id,
510  NvU32 num,
511  NvU32 offset,
512  NvU32 * values );
513 
532  NvRmDeviceHandle device,
534  NvRmModuleID id,
535  NvU32 num,
536  NvU32 offset,
537  NvU32 * values );
538 
549  NvRmDeviceHandle device,
550  int *fd);
551 
567  NvRmDeviceHandle device,
568  int fd,
569  NvU32 syncpointID,
570  NvU32 threshold);
571 
581  NvRmModuleID moduleId, NvU32 *rate);
582 
592  NvRmModuleID moduleId, NvU32 rate);
593 
603  NvRmModuleID moduleId, NvU32 pixelRate);
604 
614  NvRmModuleID moduleId, NvU32 bandwidth);
615 
619 static NV_INLINE NvBool NvSchedValueIsBetween(const NvU32 a, const NvU32 b,
620  const NvU32 c)
621 {
622  // If we imagine numbers between 0 and (1<<32)-1 placed along a circle,
623  // then a-b is exactly the distance from b to a along the circle moving
624  // clockwise. This test checks that the distance between a and b is
625  // strictly smaller than the distance between a and c.
626  return b-a < c-a;
627 }
628 
629 // Returns NV_TRUE if x >= y (mod 1<<32).
630 static NV_INLINE NvBool NvSchedValueWrappingComparison(const NvU32 x,
631  const NvU32 y)
632 {
633  return NvSchedValueIsBetween(y, x, (1UL<<31UL)+y);
634 }
635 
638 #if defined(__cplusplus)
639 }
640 #endif
641 
642 #endif
NvRmChannelSyncPointWaitexTimeout
NvError NvRmChannelSyncPointWaitexTimeout(NvRmDeviceHandle hDevice, NvU32 SyncPointID, NvU32 Threshold, NvOsSemaphoreHandle hSema, NvU32 Timeout, NvU32 *Actual)
Same as NvRmChannelSyncPointWaitTimeout, but provides a pointer to memory allocated to hold the actua...
nvrm_memmgr.h
NvRmTimevalRec::clockId
NvRmClockId clockId
Definition: nvrm_host1x.h:53
NvRmChannelGetModuleSyncPoint
NvError NvRmChannelGetModuleSyncPoint(NvRmChannelHandle hChannel, NvRmModuleID Module, NvU32 Index, NvU32 *pSyncPointID)
Obtains the index of a dynamically allocated host managed sync point register for a particular <chann...
NvRmTimevalRec::nsec
NvU64 nsec
Definition: nvrm_host1x.h:52
NvRmHostCreateEventPollFd
NvError NvRmHostCreateEventPollFd(NvRmDeviceHandle device, int *fd)
Get poll'able file descriptor (FD) User is responsible for closing the FD.
NvRmChannelBlockRegWr
NvError NvRmChannelBlockRegWr(NvRmDeviceHandle device, NvRmChannelHandle ch, NvRmModuleID id, NvU32 num, NvU32 offset, NvU32 *values)
Write a block of consecutive register values from the given module's channel using using channel hand...
NvRmFenceGetFromFile
NvError NvRmFenceGetFromFile(NvS32 Fd, NvRmFence *Fences, NvU32 *NumFences)
Extracts fences from an Android fence file.
NvError
NvError
The NvError enumeration contains ALL return / error codes.
Definition: nverror.h:43
NvRmChannelSyncPointWaitmexTimeout
NvError NvRmChannelSyncPointWaitmexTimeout(NvRmDeviceHandle hDevice, NvU32 SyncPointID, NvU32 Threshold, NvOsSemaphoreHandle hSema, NvU32 Timeout, NvU32 *Actual, NvRmTimeval *tv)
Same as NvRmChannelSyncPointWaitTimeoutex, but provides information about the exact time of work comp...
NvRmEngineStatusRec
Structure that is filled by either kernel-mode-driver or engine to denote the status.
Definition: nvrm_host1x.h:60
NvRmChannelSyncPointWait
void NvRmChannelSyncPointWait(NvRmDeviceHandle hDevice, NvU32 SyncPointID, NvU32 Threshold, NvOsSemaphoreHandle hSema)
Waits for a sync point to reach the given threshold.
NvRmTimevalRec
A structure for storing an accurate time.
Definition: nvrm_host1x.h:49
NvRmChannelClose
void NvRmChannelClose(NvRmChannelHandle hChannel)
Closes a channel handle from NvRmChannelOpen() or NvRmChannelAlloc().
NvRmEngineStatus
struct NvRmEngineStatusRec NvRmEngineStatus
Structure that is filled by either kernel-mode-driver or engine to denote the status.
NvRmChannelSyncPointRead
NvU32 NvRmChannelSyncPointRead(NvRmDeviceHandle hDevice, NvU32 SyncPointID)
Reads the current value of a particular sync point register.
NvRmClockId_Unknown
@ NvRmClockId_Unknown
Definition: nvrm_host1x.h:41
NvRmEngineStatusRec::info32
NvU32 info32
Definition: nvrm_host1x.h:68
NvRmChannelFreeClientManagedSyncPoint
void NvRmChannelFreeClientManagedSyncPoint(NvRmChannelHandle hChannel, NvU32 SyncPointIndex, NvU32 pSyncPointID)
Frees the dynamically allocated syncpt id.
NvOsSemaphoreHandle
struct NvOsSemaphoreRec * NvOsSemaphoreHandle
Definition: nvos_s3_tegra_safety.h:1245
NvRmChannelGetModuleClockRate
NvError NvRmChannelGetModuleClockRate(NvRmChannelHandle hChannel, NvRmModuleID Module, NvU32 *Rate)
Gets clock rate for the module.
NvRmChannelSetSubmitTimeout
NvError NvRmChannelSetSubmitTimeout(NvRmChannelHandle hChannel, NvU32 SubmitTimeout)
Sets a submit buffer timeout for this stream/context.
NvRmHost1xChannelSetModuleClockRate
NvError NvRmHost1xChannelSetModuleClockRate(NvRmHost1xChannelHandle channel, NvRmModuleID moduleId, NvU32 rate)
Sets module clock rate.
NvRmTimevalRec::sec
NvU64 sec
Definition: nvrm_host1x.h:51
NvRmFenceWait
NvError NvRmFenceWait(NvRmDeviceHandle hDevice, const NvRmFence *Fence, NvU32 Timeout)
Waits for a fence to be triggered.
NvRmClockId_Monotonic
@ NvRmClockId_Monotonic
Definition: nvrm_host1x.h:42
NvSchedValueIsBetween
static NV_INLINE NvBool NvSchedValueIsBetween(const NvU32 a, const NvU32 b, const NvU32 c)
Definition: nvrm_host1x.h:619
NvRmFenceRec
@IgnoreForDoc
Definition: nvrm_host1x_safe_compat.h:54
NvRmChannelRegWr
NvError NvRmChannelRegWr(NvRmDeviceHandle device, NvRmChannelHandle ch, NvRmModuleID id, NvU32 num, const NvU32 *offset, const NvU32 *values)
Write register values to the module's channel using channel handle Can only be used for modules behin...
NvRmChannelSyncPointFree
void NvRmChannelSyncPointFree(NvRmDeviceHandle hDevice, NvU32 SyncPointID)
Do nothing.
NvRmChannelSetSubmitTimeoutEx
NvError NvRmChannelSetSubmitTimeoutEx(NvRmChannelHandle hChannel, NvU32 SubmitTimeout, NvBool DisableDebugDump)
Sets a submit buffer timeout for this stream/context.
NvRmTimeval
struct NvRmTimevalRec NvRmTimeval
A structure for storing an accurate time.
NvRmFencePutToFile
NvError NvRmFencePutToFile(const char *Name, const NvRmFence *Fences, NvU32 NumFences, NvS32 *Fd)
Creates an Android fence file from fences.
NvRmChannelOpenDeviceFile
NvError NvRmChannelOpenDeviceFile(NvRmDeviceHandle hDevice, NvRmChannelHandle *phChannel, const char *node)
Opens a handle to a channel using given channel device node.
NvRmChannelSetModuleClockRate
NvError NvRmChannelSetModuleClockRate(NvRmChannelHandle hChannel, NvRmModuleID Module, NvU32 Rate)
Sets module clock rate.
NvRmHost1xChannelHandle
struct NvRmHost1xChannel * NvRmHost1xChannelHandle
Handle to a Host1x channel.
Definition: nvrm_host1x_safe_compat.h:41
NvRmContextHandle
struct NvRmContextRec * NvRmContextHandle
A type-safe handle for a hardware context, for the engines where such a concept is applicable.
Definition: nvrm_host1x.h:35
NvRmChannelRegRd
NvError NvRmChannelRegRd(NvRmDeviceHandle device, NvRmChannelHandle ch, NvRmModuleID id, NvU32 num, const NvU32 *offsets, NvU32 *values)
Read register values from the given module's channel using channel handle Can only be used for module...
NvRmHost1xChannelSetModuleBandwidth
NvError NvRmHost1xChannelSetModuleBandwidth(NvRmHost1xChannelHandle channel, NvRmModuleID moduleId, NvU32 bandwidth)
Sets module bw rate.
NvRmChannelOpen
NvError NvRmChannelOpen(NvRmDeviceHandle hDevice, NvRmChannelHandle *phChannel, NvU32 NumModules, const NvRmModuleID *pModuleIDs)
Opens a handle to a channel.
NvRmEngineStatusRec::timestamp
NvU64 timestamp
Definition: nvrm_host1x.h:65
NvRmModuleID
NvRmModuleID
Defines SOC hardware controller class identifiers.
Definition: nvrm_module.h:68
NvRmChannelGetClientManagedSyncPoint
NvError NvRmChannelGetClientManagedSyncPoint(NvRmChannelHandle hChannel, const char *name, NvU32 SyncPointIndex, NvU32 *pSyncPointID)
Obtains the index of a dynamically allocated client managed sync point register for a particular modu...
NvRmChannelSyncPointWaitTimeout
NvError NvRmChannelSyncPointWaitTimeout(NvRmDeviceHandle hDevice, NvU32 SyncPointID, NvU32 Threshold, NvOsSemaphoreHandle hSema, NvU32 Timeout)
Same as NvRmChannelSyncPointWait, but provides a semaphore timeout value.
NvRmClockId
NvRmClockId
Clock used to retrieve the timestamp.
Definition: nvrm_host1x.h:40
nvrm_module.h
NVIDIA Driver Development Kit: Resource Manager Module Control APIs
NvRmClockId_PTP
@ NvRmClockId_PTP
Definition: nvrm_host1x.h:43
NvRmChannelSetModulePixelRate
NvError NvRmChannelSetModulePixelRate(NvRmChannelHandle hChannel, NvRmModuleID Module, NvU32 PixelRate)
Set Module pixel rate.
NvRmHostTriggerEventPollFd
NvError NvRmHostTriggerEventPollFd(NvRmDeviceHandle device, int fd, NvU32 syncpointID, NvU32 threshold)
Trigger an event on poll'able FD which is allocated with NvRmHostCreateEventPollFd()
NvRmChannelSyncPointIncr
void NvRmChannelSyncPointIncr(NvRmDeviceHandle hDevice, NvU32 SyncPointID)
Increments (using the CPU) a particular sync point register.
NvRmEngineStatusRec::info16
NvU16 info16
Definition: nvrm_host1x.h:69
NvRmDeviceHandle
struct NvRmDeviceRec * NvRmDeviceHandle
Definition: nvrm_defs.h:19
NvRmChannelSetModuleBandwidth
NvError NvRmChannelSetModuleBandwidth(NvRmChannelHandle hChannel, NvRmModuleID Module, NvU32 BW)
Sets module bw rate.
NvRmEngineStatusRec::status
NvU16 status
Definition: nvrm_host1x.h:73
NvRmChannelHandle
struct NvRmChannelRec * NvRmChannelHandle
A type-safe handle for a channel.
Definition: nvrm_host1x.h:29
NvRmChannelBlockRegRd
NvError NvRmChannelBlockRegRd(NvRmDeviceHandle device, NvRmChannelHandle ch, NvRmModuleID id, NvU32 num, NvU32 offset, NvU32 *values)
Read a block of consecutive register values to the module's channel using channel handle Can only be ...
nvrm_host1x_safe_compat.h
nvrm_init.h
NvRmHost1xChannelSetModulePixelRate
NvError NvRmHost1xChannelSetModulePixelRate(NvRmHost1xChannelHandle channel, NvRmModuleID moduleId, NvU32 pixelRate)
Set Module pixel rate.
NvSchedValueWrappingComparison
static NV_INLINE NvBool NvSchedValueWrappingComparison(const NvU32 x, const NvU32 y)
Definition: nvrm_host1x.h:630
NvRmHost1xChannelGetModuleClockRate
NvError NvRmHost1xChannelGetModuleClockRate(NvRmHost1xChannelHandle channel, NvRmModuleID moduleId, NvU32 *rate)
Gets clock rate for the module.
NvRmChannelSetErrNotifier
NvError NvRmChannelSetErrNotifier(NvRmChannelHandle phChannel, NvU64 errLimit, NvU32 errOffset, NvU32 errMemHandle)
Sets error notifier for a channel.