Hello, I am trying to send an NvBufSurface across processes using the recommended approach I found online, which was NvBufSurfaceImport.
Running Jetpack 5.1.4
Source:
I am able to send the MapParams over a socket and the file descriptor using SCM_RIGHTs, and use NvBufSurfaceImport to re-construct the image.
I was able to fill the image up with a known pattern and check in the child/receiver process that the values were correct, meaning that the memory mapping seemed to have worked.
However whenever I try and pass the imported NvBufSurface as the src to NvBufSurfaceTransform, I get a segfault on a memset somewhere. I’m not sure what’s wrong, because I’ve mapped the memory and iterated through it and it seems correct.
GDB Output:
(gdb) break NvBufSurfTransform
warning: could not convert 'NvBufSurfTransform' from the host encoding (ANSI_X3.4-1968) to UTF-32.
This normally should not happen, please file a bug report.
Breakpoint 1 at 0xffff3826237c
(gdb) c
Continuing.
Breakpoint 1, 0x0000ffff3826237c in NvBufSurfTransform () from /usr/lib/libnvbufsurftransform.so.1.0.0
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
__GI___memset_generic () at ../sysdeps/aarch64/memset.S:86
86 ../sysdeps/aarch64/memset.S: No such file or directory.
(gdb) bt
#0 __GI___memset_generic () at ../sysdeps/aarch64/memset.S:86
#1 0x0000ffff698650bc in ?? () from /usr/lib/libnvvic.so
#2 0x0000ffff6986cb28 in ?? () from /usr/lib/libnvvic.so
#3 0x0000ffff69862228 in NvVicCompose () from /usr/lib/libnvvic.so
#4 0x0000ffff7cb51730 in NvBufSurfTransformAsync () from /usr/lib/libnvbufsurftransform.so.1.0.0
#5 0x0000aaaaaaaa320c in main () at
test.cpp:515
Pseudocode:
Provider:
Allocate Surface
Map Surface
Fill with Known Data
Get Params from Surface
Get dmabuf FD from Surface
Send params, FD over socket.
Consumer:
RX Params and FD
params.fd = FD (file descriptor transfered using SCM_RIGHTs)
NvBufSurfaceImport(output_buf, params)
map output buf
check output buf for data
transform output-buf to new nvbufsurface to show that operations on this new imported buffer work (color conversion, crop. etc…)
Actual Code that replicates the issue:
test.cpp.txt (12.0 KB)
Really would appreciate any feedback. Thank you!
Output with DBGNVBUFSURFTRANSFORM=1:
CHILD: Calling NvBufSurfTransform
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:2559: NvBufSurfTransformAsync=> Using default session created
PARENT: Child process completed with status 11
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:1899: libnvbufsurf_transform_deinit=> Deinit lib
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:1890: NvBufSurfTransformSessionDestroy=> Session destroyed 0xaaab197acfa0
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:985: taskTrim=> Exiting Clean up thread