NvBufferMemMap can not access NativeBuffer

We used createNvBuffer to create a dma buffer, followed by NvBufferMemMap to create a virtual pointer to the buffer. There are no errors, but when we write to the image buffer the writes are intermittent. We tried filling a square in the center of the image with white (0xFFFFFF), but instead of a solid block, there are flashing horizontal strips inside the box. How can we fix the writes? The code segment follows:

// Acquire a frame.
UniqueObj frame(iFrameConsumer->acquireFrame());
IFrame *iFrame = interface_cast

// Get the IImageNativeBuffer extension interface.
NV::IImageNativeBuffer *iNativeBuffer = interface_castNV::IImageNativeBuffer(iFrame->getImage());
if (!iNativeBuffer)
ORIGINATE_ERROR(“IImageNativeBuffer not supported by Image.”);

m_dmabuf = iNativeBuffer->createNvBuffer(iEglOutputStream->getResolution(),
NvBufferColorFormat_ABGR32,
NvBufferLayout_Pitch);
if (m_dmabuf == -1)
CONSUMER_PRINT(“\tFailed to create NvBuffer\n”);

m_data_plane = 0;
if (NvBufferMemMap(m_dmabuf, m_data_plane, NvBufferMem_Read_Write, &m_data_mem))
printf(“mmap failed : %s\n”, strerror(errno));

hello rhopkins,

you should have format conversion since DMA buffer is block linear.
please access MMAPI through Jetson Download Center, and check below sample.

$TOP/multimedia_api/ll_samples/samples/07_video_convert

or, you may also refer to L4T Accelerated GStreamer User Guide, check the gst-nvivafilter plugin if you need CUDA processing.
thanks