Access CSI data using NVMM DMA buffer

Hi Team,

  1. Does Jetson Xavier/Tegra multimedia API support v4l2src with “video/x-raw (memory:NVMM)” or “video/x-bayer(memory:NVMM)”?
  2. I want to capture the data from a camera sensor, on the Xavier NX board, process the Bayer data in GPU and I want to use a zero-copy mechanism or NVMM DMA buffer.

What is the possible way of doing this using GStreamer or Tegra multimedia APIs?

Thanks,
Ajith.

Hi,
Please check this:
CSI data capture on GPU - #5 by DaneLLL

Once you have RAW data in CUDA buffers, you can create NvBuffer and debayer/convert RAW data into the NvBuffer. It does not support RAW formats in NvBuffer so you would need to do debayering and conversion.

May consider Argus to use hardware ISP engine.

Hi @DaneLLL

Thanks for your response.

I want to capture the raw data and don’t want to debayer/convert raw data. So I should not use the nvarguscamerasrc plugin.

Thanks,
Ajith.

Hi Ajith
If you are using an on board sensor then
Onboard camera is bayer sensor you need some plugin like bayer2rbg element and the format is bayer “bggr”
a possible command should be like below.

gst-launch-1.0 v4l2src device="/dev/video0" ! “video/x-bayer, width=640, height=480, format=(string)rggb” ! bayer2rgb ! videoconvert ! xvimagesink -e

Hi @sarthak.srivastava14apr

Thanks for your reply
I got it.

Thanks,
Ajith.

If you don’t want to debayer, you may use V4L API:

# Install package v4l-utils if not yet done, it provides v4l2-ctl command
sudo apt install v4l-utils

# Check available modes for your camera (assuming first camera on /dev/video0)
v4l2-ctl -d /dev/video0 --list-formats-ext

# Capture 100 frames (you would adapt to your sensor modes) to file
v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=100 --stream-to=test_100frames.RG10

You may have to set framerate, gain and exposure.
That being said, decoding the file may not be obvious. You may have to know how pixels values are stored.

About debayering with gstreamer, this would only work with bayer8 or bayer16. Non byte-aligned sizes are not supported, AFAIK.

1 Like