Gst-nvivafilter

Platforms:

  • Jetson AGX Xavier
  • Jetpack 4.5
  • Cuda 10.2
  • IMX274 camera

Hi fellow developers,

I am having difficulties at making custom CUDA implementation. I have succesfully run the below pipeline.

gst-launch-1.0 nvarguscamerasrc !   'video/x-raw(memory:NVMM), width=(int)3840, height=(int)2160, \
  format=(string)NV12, framerate=(fraction)60/1' !   nvivafilter cuda-process=true   customer-lib-name="libnvsample_cudaprocess.so" !   'video/x-raw(memory:NVMM), format=(string)NV12' ! nvvidconv ! nvegltransform ! nveglglessink -e

I wanted to implement custom CUDA pre/post operations on Jetson AGX GPU. I downloaded the nvsample_cudaprocess_src.tbz2 from this post.
GStreamer videocuda and nvivafilter plugins source code - #2 by DaneLLL

I have followed the instructions in the
nvsample_cudaprocess_README.txt (8.1 KB)
file and I made following changes in the
Makefile (5.1 KB)
.

# # CUDA code generation flags
# ifneq ($(OS_ARCH),armv7l)
# GENCODE_SM10    := -gencode arch=compute_10,code=sm_10
# endif
# GENCODE_SM30    := -gencode arch=compute_30,code=sm_30
# GENCODE_SM32    := -gencode arch=compute_32,code=sm_32
# GENCODE_SM35    := -gencode arch=compute_35,code=sm_35
# GENCODE_SM50    := -gencode arch=compute_50,code=sm_50
# GENCODE_SMXX    := -gencode arch=compute_50,code=compute_50
# GENCODE_SM53    := -gencode arch=compute_53,code=sm_53
# GENCODE_SM62    := -gencode arch=compute_62,code=sm_62
GENCODE_SM72    := -gencode arch=compute_72,code=sm_72
# GENCODE_SM_PTX  := -gencode arch=compute_72,code=compute_72
# ifeq ($(OS_ARCH),armv7l)
# GENCODE_FLAGS   ?= $(GENCODE_SM32)
# else
#GENCODE_FLAGS   ?= $(GENCODE_SM30) $(GENCODE_SM32) $(GENCODE_SM35) $(GENCODE_SM50) $(GENCODE_SM53) $(GENCODE_SM62) $(GENCODE_SM72) $(GENCODE_SMXX) $(GENCODE_SM_PTX)
# endif

# Only Jetson Nano
#GENCODE_FLAGS ?= $(GENCODE_SM53)

# Only Jetson AGX Xavier
GENCODE_FLAGS ?= $(GENCODE_SM72)

When i $ make , i get the following error.

/usr/local/cuda/bin/nvcc -ccbin g++   --shared  -Xcompiler -fPIC  -Xlinker --dynamic-linker=/lib/ld-linux-aarch64.so.1  -gencode arch=compute_72,code=sm_72 -o libnvsample_cudaprocess.so nvsample_cudaprocess.o -L/usr/lib/aarch64-linux-gnu -lEGL -lGLESv2 -L/usr/lib/aarch64-linux-gnu/tegra -lcuda -lrt
/usr/bin/ld: cannot find -lEGL
/usr/bin/ld: cannot find -lGLESv2
collect2: error: ld returned 1 exit status
Makefile:146: recipe for target 'libnvsample_cudaprocess.so' failed
make: *** [libnvsample_cudaprocess.so] Error 1

Any help will be appreciated.

Thanks
John

Hi,
Does it work if you don’t make change to Makefile? It should work by default and no modification is required.

Hi DaneLLL,

When i run the make with default Makefile, i get the following error

/usr/local/cuda/bin/nvcc -ccbin g++ -I./  --shared  -Xcompiler -fPIC  -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_32,code=sm_32 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_50,code=compute_50 -o nvsample_cudaprocess.o -c nvsample_cudaprocess.cu
nvcc fatal   : Unsupported gpu architecture 'compute_20'
Makefile:132: recipe for target 'nvsample_cudaprocess.o' failed
make: *** [nvsample_cudaprocess.o] Error 1

That’s why i changed the Makefile in the first place. On the other hand, something tells me i’m not using the latest nvsample_cudaprocess_src.tbz2. What do you think i should do?

Thanks
John

Hi,
Looks like you don’t get correct version. Please download the package:
L4T 32.5 Archive | NVIDIA Developer
L4T Driver Package (BSP) Sources

It contains all open source code.

Hi guys
Hope you are feeling well
I wana use nvivafilter and nvsample for a processing application
In the sample you have wrote a funcation named
static void add_metadata(void ** usrptr)

And in the iva_metadata.h file is defined some metadata varible

typedef struct _location_t Location;

struct _location_t
{
int x1, y1;
int x2, y2;
};

typedef struct _bbox_t BBOX;

struct _bbox_t {
unsigned int framecnt;
unsigned int objectcnt;
Location location_list[NUM_LOCATIONS];
};

Right now,i wanna know how i can use the metadata in the gstreamer Main looper
For example ,how can i get the metadata in main gsteramer loop launcher??
May you help me??
Thank you for your time
Appreciate that
Best regards.