|
|
NVIDIA DeepStream SDK API Reference
|
9.0 Release
|
Go to the documentation of this file.
21 #ifndef __GST_NVCOMMON_H__
22 #define __GST_NVCOMMON_H__
31 #define CHECK_DEFAULT_MEM(memType1, memType2) ((memType1 == NVBUF_MEM_DEFAULT && memType2 == NVBUF_MEM_CUDA_DEVICE) || \
32 (memType1 == NVBUF_MEM_CUDA_DEVICE && memType2 == NVBUF_MEM_DEFAULT))
34 #define GET_DEFAULT_MEM_TYPE(mem_type) {mem_type=NVBUF_MEM_CUDA_DEVICE;}
38 #define CHECK_DEFAULT_MEM(memType1, memType2) ((memType1 == NVBUF_MEM_DEFAULT && memType2 == NVBUF_MEM_SURFACE_ARRAY) || \
39 (memType1 == NVBUF_MEM_SURFACE_ARRAY && memType2 == NVBUF_MEM_DEFAULT))
42 #define GET_DEFAULT_MEM_TYPE(mem_type) {int is_nvgpu = 0; NvBufSurfaceDeviceInfo dev_info{}; \
43 if (NvBufSurfaceGetDeviceInfo(&dev_info) == 0) { \
44 if (dev_info.driverType == NVBUF_DRIVER_TYPE_NVGPU) { \
48 if(is_nvgpu) mem_type=NVBUF_MEM_SURFACE_ARRAY;\
49 else mem_type=NVBUF_MEM_CUDA_DEVICE;}
51 #define GET_DEFAULT_MEM_TYPE(mem_type) {int is_nvgpu = 0; NvBufSurfaceDeviceInfo dev_info = {0}; \
52 if (NvBufSurfaceGetDeviceInfo(&dev_info) == 0) { \
53 if (dev_info.driverType == NVBUF_DRIVER_TYPE_NVGPU) { \
57 if(is_nvgpu) mem_type=NVBUF_MEM_SURFACE_ARRAY;\
58 else mem_type=NVBUF_MEM_CUDA_DEVICE;}
62 #define CHECK_NVDS_MEMORY_AND_GPUID(object, surface) \
65 if (((surface->memType == NVBUF_MEM_DEFAULT || surface->memType == NVBUF_MEM_CUDA_DEVICE) && \
66 ((int)surface->gpuId != (int)object->gpu_id)) || \
67 (((int)surface->gpuId == (int)object->gpu_id) && (surface->memType == NVBUF_MEM_SYSTEM))) { \
68 GST_ELEMENT_ERROR (object, RESOURCE, FAILED, \
69 ("Memory Compatibility Error:Input surface gpu-id doesnt match with configured gpu-id for element," \
70 " please allocate input using unified memory, or use same gpu-ids OR,"\
71 " if same gpu-ids are used ensure appropriate Cuda memories are used"),\
72 ("surface-gpu-id=%d,%s-gpu-id=%d",surface->gpuId,GST_ELEMENT_NAME(object),\
81 #define GST_TYPE_NVBUF_MEMORY_TYPE (gst_nvbuf_memory_get_type ())
84 #define GST_TYPE_COMPUTE_HW (gst_compute_hw_get_type ())
87 #define GST_TYPE_INTERPOLATION_METHOD (gst_video_interpolation_method_get_type ())
93 #define PROP_NVDS_GPU_ID_INSTALL(gobject_class) \
95 g_object_class_install_property (gobject_class, PROP_GPU_DEVICE_ID, \
96 g_param_spec_uint ("gpu-id", "Set GPU Device ID for operation", \
97 "Set GPU Device ID for operation", \
99 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | \
100 GST_PARAM_MUTABLE_READY))); \
103 #define PROP_NVBUF_MEMORY_TYPE_INSTALL(gobject_class) \
105 g_object_class_install_property (gobject_class, PROP_NVBUF_MEMORY_TYPE, \
106 g_param_spec_enum ("nvbuf-memory-type", "Type of NvBufSurface memory allocated", \
107 "Type of NvBufSurface Memory to be allocated for output buffers", \
108 GST_TYPE_NVBUF_MEMORY_TYPE, \
110 (GParamFlags)(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | \
111 GST_PARAM_MUTABLE_READY))); \
114 #define PROP_COMPUTE_HW_INSTALL(gobject_class) \
116 g_object_class_install_property (gobject_class, PROP_COMPUTE_HW, \
117 g_param_spec_enum ("compute-hw", "compute-hw", \
118 "Compute Scaling HW", \
119 GST_TYPE_COMPUTE_HW, NvBufSurfTransformCompute_Default, \
120 (GParamFlags)(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | \
121 GST_PARAM_CONTROLLABLE | G_PARAM_CONSTRUCT))); \
124 #define PROP_INTERPOLATION_METHOD_INSTALL(gobject_class) \
126 g_object_class_install_property (gobject_class, PROP_INTERPOLATION_METHOD, \
127 g_param_spec_enum ("interpolation-method", "Interpolation-method", \
128 "Set interpolation methods", \
129 GST_TYPE_INTERPOLATION_METHOD, NvBufSurfTransformInter_Default, \
130 (GParamFlags)(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | \
131 GST_PARAM_CONTROLLABLE | G_PARAM_CONSTRUCT))); \
const char * gst_nvbuf_memory_get_name(int mem_type)
GType gst_nvbuf_memory_get_type(void)
GType gst_compute_hw_get_type(void)
GType gst_video_interpolation_method_get_type(void)
int gst_nvbuf_memory_get_value(const char *mem_type_string)