DriveWorks SDK Reference

| 0.6.67 Release

Context.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2016-2017 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // strictly prohibited.
28 //
30 
44 #ifndef DW_CORE_CONTEXT_H__
45 #define DW_CORE_CONTEXT_H__
46 
47 #include <dw/core/Config.h>
48 #include <dw/core/Exports.h>
49 #include <dw/core/Types.h>
50 #include <dw/core/Version.h>
51 #include <dw/core/Status.h>
52 #include <cuda_runtime_api.h>
53 
54 // typdefs for cuda structs
58 
59 // Forward declares from EGL
60 typedef void *EGLDisplay;
61 
62 // Forward declares from NvMedia
63 typedef void NvMediaDevice;
64 typedef void NvMediaIPPManager;
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
77 typedef struct dwContextObject *dwContextHandle_t;
79 typedef struct dwContextObject const *dwConstContextHandle_t;
80 
84 typedef struct dwContextParameters {
85 
86 #ifdef DW_USE_EGL
87  EGLDisplay eglDisplay;
89 #endif
90 
91 #ifdef VIBRANTE
94 #endif
95 
98  const char * dataPath;
99 
101 
118 dwStatus dwGetLastError(const char **errorMsg);
119 
138 dwStatus dwInitialize(dwContextHandle_t *context, dwVersion header_version, const dwContextParameters *params);
139 
150 dwStatus dwReset(dwContextHandle_t context);
151 
165 dwStatus dwRelease(dwContextHandle_t *context);
166 
180 dwStatus dwContext_getCurrentTime(dwTime_t *time, dwContextHandle_t ctx);
181 
204 dwStatus dwContext_isTimePTPSynchronized(dwBool *flag, dwContextHandle_t ctx);
205 
217 dwStatus dwContext_getNvMediaDevice(NvMediaDevice **device, dwContextHandle_t ctx);
218 
230 dwStatus dwContext_setNvMediaDevice(NvMediaDevice *device, dwContextHandle_t ctx);
231 
244 dwStatus dwContext_selectGPUDevice(int32_t deviceNumber, dwContextHandle_t context);
245 
246 #ifdef VIBRANTE
247 
259 dwStatus dwContext_selectGPUDeviceType(dwGPUDeviceType deviceType, dwContextHandle_t context);
260 #endif
261 
272 dwStatus dwContext_getGPUDeviceCurrent(int32_t* deviceNumber, dwContextHandle_t context);
273 
285 dwStatus dwContext_getGPUDeviceType(dwGPUDeviceType* deviceType, int32_t deviceNum, dwContextHandle_t context);
286 
297 dwStatus dwContext_getGPUCount(int32_t* count, dwContextHandle_t context);
298 
312 dwStatus dwContext_getGPUProperties(cudaDeviceProp* properties, int32_t deviceNum,
313  dwContextHandle_t context);
314 
330 dwStatus dwContext_getGPUAttribute(int32_t *value, cudaDeviceAttr attribute, int32_t deviceNum,
331  dwContextHandle_t context);
332 
345 dwStatus dwContext_getCUDAProperties(int32_t* driverVersion, int32_t* apiVersion, dwContextHandle_t context);
346 
347 #ifdef DW_USE_EGL
348 
363 dwStatus dwContext_setEGLDisplay(EGLDisplay display, dwContextHandle_t ctx);
364 #endif
365 
366 #ifdef __cplusplus
367 }
368 #endif
369 
370 #endif // DW_CORE_CONTEXT_H__
DW_API_PUBLIC dwStatus dwContext_getCurrentTime(dwTime_t *time, dwContextHandle_t ctx)
Returns the current timestamp.
DW_API_PUBLIC dwStatus dwContext_selectGPUDeviceType(dwGPUDeviceType deviceType, dwContextHandle_t context)
Selects a GPU device type either integrated or discreet, if available.
DW_API_PUBLIC dwStatus dwInitialize(dwContextHandle_t *context, dwVersion header_version, const dwContextParameters *params)
Creates and initializes an SDK context.
NVIDIA DriveWorks API: Core Types
dwGPUDeviceType
GPU device type defintions.
Definition: Types.h:144
A set of parameters that is passed to the SDK to create the context.
Definition: Context.h:84
enum cudaDeviceAttr cudaDeviceAttr
Definition: Context.h:56
DW_API_PUBLIC dwStatus dwContext_isTimePTPSynchronized(dwBool *flag, dwContextHandle_t ctx)
Check if the used time source inside the context is synchronized over PTP.
DW_API_PUBLIC dwStatus dwContext_getGPUDeviceType(dwGPUDeviceType *deviceType, int32_t deviceNum, dwContextHandle_t context)
Returns the device type of the input GPU number.
uint64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:89
void NvMediaDevice
Definition: Context.h:63
DW_API_PUBLIC dwStatus dwContext_getGPUAttribute(int32_t *value, cudaDeviceAttr attribute, int32_t deviceNum, dwContextHandle_t context)
Returns the value of the selected cuda attribute for the specific cuda device.
NVIDIA DriveWorks API: Core Exports
DW_API_PUBLIC dwStatus dwContext_getCUDAProperties(int32_t *driverVersion, int32_t *apiVersion, dwContextHandle_t context)
Returns Driver and Runtime API version of CUDA on the current machine.
dwStatus
Status definition.
Definition: Status.h:167
DW_API_PUBLIC dwStatus dwContext_getNvMediaDevice(NvMediaDevice **device, dwContextHandle_t ctx)
Gets the NvMediaDevice used within the context.
DW_API_PUBLIC dwStatus dwContext_selectGPUDevice(int32_t deviceNumber, dwContextHandle_t context)
Selects a GPU device, if available.
DW_API_PUBLIC dwStatus dwGetLastError(const char **errorMsg)
Retrieves the last error encountered.
enum cudaTextureAddressMode cudaTextureAddressMode
Definition: Context.h:57
DW_API_PUBLIC dwStatus dwContext_getGPUDeviceCurrent(int32_t *deviceNumber, dwContextHandle_t context)
Returns the currently selected GPU device.
DW_API_PUBLIC dwStatus dwReset(dwContextHandle_t context)
Resets the context.
uint8_t dwBool
Definition: Types.h:79
const char * dataPath
Path where all DriveWorks related data required during runtime are stored.
Definition: Context.h:98
DW_API_PUBLIC dwStatus dwContext_getGPUProperties(cudaDeviceProp *properties, int32_t deviceNum, dwContextHandle_t context)
Returns the properties for the specific cuda device.
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:78
DW_API_PUBLIC dwStatus dwRelease(dwContextHandle_t *context)
Releases the context.
NvMediaDevice * nvmediaDevice
NvMedia device pointer or NULL if SDK should handle NvMedia context.
Definition: Context.h:93
DW_API_PUBLIC dwStatus dwContext_setNvMediaDevice(NvMediaDevice *device, dwContextHandle_t ctx)
Sets NvMediaDevice to be used within the context.
void * EGLDisplay
Definition: Context.h:60
struct dwContextObject const * dwConstContextHandle_t
Definition: Context.h:79
void NvMediaIPPManager
Definition: Context.h:64
DW_API_PUBLIC dwStatus dwContext_getGPUCount(int32_t *count, dwContextHandle_t context)
Get the avilable GPU devices count.
#define DW_API_PUBLIC
Definition: Exports.h:76
NVIDIA DriveWorks API: Core Status Methods
struct cudaDeviceProp cudaDeviceProp
Definition: Context.h:55