NvBuffer2Raw vs NvBufferMemMap

In the DeepStream plugin sample, there are 2 NvBuffers

The first came from a GstBuffer using ExtractFdFromNvBuffer.

The other is created using NvBufferCreateEx

NvBufferMemMap works only for the one created using NvBufferCreateEx.

For the one that came from the GstBuffer using ExtractFdFromNvBuffer, NvBufferMemMap returns OK
but the memory content is wrong - I even tried NvBufferMemSyncForCpu. Only thing that
worked is NvBuffer2Raw.

Is there any part of the documentation that can explain this?

Hi frederickk,

Your step should be correct.
But have you check your pipeline, is plugin outputting nvmmbuffer(Memory:nvmm)?
Meanwhile, do you know the color format your pipeline is outputting?

Thanks
wayne zhu

The memory that I get from ExtractFdFromNvBuffer, after I do
NvEGLImageFromFd is “CU_EGL_FRAME_TYPE_ARRAY”.
I can’t seem to do NPP operations directly on it,

How do I copy the contents of this memory (CU_EGL_FRAME_TYPE_ARRAY)
into memory that is allocated using cudaMalloc?
Will cudaMemcpy3D work on this sort of memory?

Please refer to Handle_EGLImage() in tegra_multimedia_api\samples\common\algorithm\cuda\NvCudaProc.cpp
You can get data pointer eglFrame.frame.pPitch[0] in calling

cuGraphicsEGLRegisterImage(&pResource, image,
                CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
cuGraphicsResourceGetMappedEglFrame(&eglFrame, pResource, 0, 0);