[RFC,0/1] Add NVIDIA Tegra VI pipeline handler
mbox series

Message ID 20260724174705.9411-1-magdum.foss@gmail.com
Headers show
Series
  • Add NVIDIA Tegra VI pipeline handler
Related show

Message

Magdum July 24, 2026, 5:47 p.m. UTC
***
I have written a new libcamera pipeline handler for NVIDIA Tegra-based
Jetson boards (Nano, TX2, Xavier NX, AGX Xavier, AGX Orin). Before
submitting it upstream I need real-hardware test reports.

If you have a Jetson board with a CSI camera attached and a mainline
kernel, **your help would be greatly appreciated**.

---

## What this patch does

Adds support for the Tegra VI (Video Input) camera pipeline to libcamera,
covering:

- Jetson Nano / TX2 / Xavier (tegra-vi driver)
- Jetson AGX Orin / Orin NX / Orin Nano (tegra234-vi driver)

The pipeline routes raw Bayer frames from the sensor through the CSI
bridge into VI capture buffers, then uses libcamera's SoftwareISP to
debayer and apply AGC/AWB/CCM so the application receives a usable RGB
or YUV frame.

---

## Prerequisites

### Hardware
- Any Jetson board (Nano / TX2 / Xavier NX / AGX Xavier / AGX Orin)
- A CSI camera module with an upstream kernel sensor driver

### Kernel
- **Mainline kernel 6.x** (not NVIDIA's downstream BSP kernel).
  The tegra-video driver must be present and the sensor driver loaded.

  Verify with:
  ```bash
  # Should list a tegra-vi or tegra234-vi media device
  media-ctl -p

  # Should show your sensor as a V4L2 subdevice
  v4l2-ctl --list-devices
  ```

### Software dependencies
```bash
# Ubuntu / Debian
sudo apt install \
    meson ninja-build pkg-config \
    libglib2.0-dev libudev-dev libyaml-dev \
    python3-yaml python3-ply python3-jinja2 \
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
    qtbase5-dev  # optional, needed only for qcam GUI
```

---

## Build instructions

```bash
git clone https://git.libcamera.org/libcamera/libcamera.git
cd libcamera

# Apply the provided tegra patch
git am 0001-pipeline-Add-NVIDIA-Tegra-VI-pipeline-handler.patch

meson setup build \
    -Dpipelines=tegra \
    -Dipas=simple \
    -Ddocumentation=disabled

ninja -C build
```

---

## Test procedure

### 1. Verify the camera is detected

```bash
./build/src/apps/cam/cam --list
```

Expected output (sensor name will vary):
```
Available cameras:
1: /base/soc/cam0_regulator/... (imx219)
```

If no cameras are listed, check `dmesg` for errors from `tegra-csi`,
`tegra-vi`, or the sensor driver.

---

### 2. Basic capture smoke test

```bash
# Capture 30 frames, no output file — just check for errors
./build/src/apps/cam/cam \
    -c 1 \
    -s width=1280,height=720,pixelformat=RGB888 \
    --capture=30
```

Expected: no error messages, final line reports 30 frames completed.

---

### 3. Save frames to disk and inspect

```bash
./build/src/apps/cam/cam \
    -c 1 \
    -s width=1920,height=1080,pixelformat=RGB888 \
    --capture=10 \
    --file=/tmp/frame-#.ppm

# Open a frame (any image viewer works)
eog /tmp/frame-0.ppm
```

Expected: a recognisable, correctly-coloured image of the scene.  It may
be slightly dark or slightly over-exposed in the first few frames while
AGC converges — that is normal.

---

### 4. Live preview (optional, requires Qt)

```bash
./build/src/apps/qcam/qcam
```

Expected: a live preview window showing the camera feed.

---

### 5. Stress / reliability test

```bash
# 20 start/stop cycles — tests cleanup and resource release
for i in $(seq 1 20); do
    ./build/src/apps/cam/cam \
        -c 1 \
        -s width=1280,height=720,pixelformat=RGB888 \
        --capture=5
done

# Check dmesg for warnings or errors after the run
dmesg | grep -i "tegra\|csi\|isp\|cam" | tail -20
```

---

## What to report back

Please reply with the following information:

```
Board:        e.g. Jetson Nano 4GB / AGX Orin 32GB
Kernel:       e.g. 6.8.0 mainline
Camera:       e.g. IMX219 (Raspberry Pi Camera v2)
Driver:       tegra-vi  /  tegra234-vi

Test 1 – cam --list:          PASS / FAIL
Test 2 – 30-frame capture:    PASS / FAIL
Test 3 – PPM image quality:   PASS / FAIL / (describe issues)
Test 4 – Live preview:        PASS / FAIL / SKIP
Test 5 – Stress test:         PASS / FAIL

dmesg errors (if any):
<paste relevant lines>

Additional notes:
<anything unusual you observed>
```

---

## Known limitations

- Only a single output stream is supported per camera.
- Hardware rotation/flip is not supported (Rotate0 only).
- Hardware ISP (ISP7 on Tegra234/Orin) is not yet supported — frames are
  processed by the CPU-based SoftwareISP.  This means image quality and
  CPU load will be lower and higher respectively than a hardware ISP path.
  ISP7 support will be added in a follow-up once the upstream kernel driver
  is available.

---

## Contact

Please send test results to the libcamera mailing list:
**libcamera-devel@lists.libcamera.org**

Or open a discussion on the libcamera GitLab:
**https://gitlab.freedesktop.org/camera/libcamera**

Thank you for your time!
***

Magdum (1):
  pipeline: Add NVIDIA Tegra VI pipeline handler

 include/libcamera/ipa/meson.build        |    1 +
 meson_options.txt                        |    1 +
 src/libcamera/pipeline/tegra/meson.build |    5 +
 src/libcamera/pipeline/tegra/tegra.cpp   | 1102 ++++++++++++++++++++++
 src/libcamera/software_isp/meson.build   |    2 +-
 5 files changed, 1110 insertions(+), 1 deletion(-)
 create mode 100644 src/libcamera/pipeline/tegra/meson.build
 create mode 100644 src/libcamera/pipeline/tegra/tegra.cpp

Comments

Laurent Pinchart July 24, 2026, 9:42 p.m. UTC | #1
Hi Magdum,

On Fri, Jul 24, 2026 at 07:47:00PM +0200, Magdum wrote:
> ***
> I have written a new libcamera pipeline handler for NVIDIA Tegra-based
> Jetson boards (Nano, TX2, Xavier NX, AGX Xavier, AGX Orin). Before
> submitting it upstream I need real-hardware test reports.
> 
> If you have a Jetson board with a CSI camera attached and a mainline
> kernel, **your help would be greatly appreciated**.

I'm curious, how did you develop this without hardware access ? The
diffstat says

5 files changed, 1110 insertions(+), 1 deletion(-)

That's quite a large amount of new code to be reasonably confident it's
ready for testing by other people if you haven't been able to test it at
all.

> ---
> 
> ## What this patch does
> 
> Adds support for the Tegra VI (Video Input) camera pipeline to libcamera,
> covering:
> 
> - Jetson Nano / TX2 / Xavier (tegra-vi driver)
> - Jetson AGX Orin / Orin NX / Orin Nano (tegra234-vi driver)
> 
> The pipeline routes raw Bayer frames from the sensor through the CSI
> bridge into VI capture buffers, then uses libcamera's SoftwareISP to
> debayer and apply AGC/AWB/CCM so the application receives a usable RGB
> or YUV frame.
> 
> ---
> 
> ## Prerequisites
> 
> ### Hardware
> - Any Jetson board (Nano / TX2 / Xavier NX / AGX Xavier / AGX Orin)
> - A CSI camera module with an upstream kernel sensor driver
> 
> ### Kernel
> - **Mainline kernel 6.x** (not NVIDIA's downstream BSP kernel).
>   The tegra-video driver must be present and the sensor driver loaded.
> 
>   Verify with:
>   ```bash
>   # Should list a tegra-vi or tegra234-vi media device
>   media-ctl -p
> 
>   # Should show your sensor as a V4L2 subdevice
>   v4l2-ctl --list-devices
>   ```
> 
> ### Software dependencies
> ```bash
> # Ubuntu / Debian
> sudo apt install \
>     meson ninja-build pkg-config \
>     libglib2.0-dev libudev-dev libyaml-dev \
>     python3-yaml python3-ply python3-jinja2 \
>     libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
>     qtbase5-dev  # optional, needed only for qcam GUI
> ```
> 
> ---
> 
> ## Build instructions
> 
> ```bash
> git clone https://git.libcamera.org/libcamera/libcamera.git
> cd libcamera
> 
> # Apply the provided tegra patch
> git am 0001-pipeline-Add-NVIDIA-Tegra-VI-pipeline-handler.patch
> 
> meson setup build \
>     -Dpipelines=tegra \
>     -Dipas=simple \
>     -Ddocumentation=disabled
> 
> ninja -C build
> ```
> 
> ---
> 
> ## Test procedure
> 
> ### 1. Verify the camera is detected
> 
> ```bash
> ./build/src/apps/cam/cam --list
> ```
> 
> Expected output (sensor name will vary):
> ```
> Available cameras:
> 1: /base/soc/cam0_regulator/... (imx219)
> ```
> 
> If no cameras are listed, check `dmesg` for errors from `tegra-csi`,
> `tegra-vi`, or the sensor driver.
> 
> ---
> 
> ### 2. Basic capture smoke test
> 
> ```bash
> # Capture 30 frames, no output file — just check for errors
> ./build/src/apps/cam/cam \
>     -c 1 \
>     -s width=1280,height=720,pixelformat=RGB888 \
>     --capture=30
> ```
> 
> Expected: no error messages, final line reports 30 frames completed.
> 
> ---
> 
> ### 3. Save frames to disk and inspect
> 
> ```bash
> ./build/src/apps/cam/cam \
>     -c 1 \
>     -s width=1920,height=1080,pixelformat=RGB888 \
>     --capture=10 \
>     --file=/tmp/frame-#.ppm
> 
> # Open a frame (any image viewer works)
> eog /tmp/frame-0.ppm
> ```
> 
> Expected: a recognisable, correctly-coloured image of the scene.  It may
> be slightly dark or slightly over-exposed in the first few frames while
> AGC converges — that is normal.
> 
> ---
> 
> ### 4. Live preview (optional, requires Qt)
> 
> ```bash
> ./build/src/apps/qcam/qcam
> ```
> 
> Expected: a live preview window showing the camera feed.
> 
> ---
> 
> ### 5. Stress / reliability test
> 
> ```bash
> # 20 start/stop cycles — tests cleanup and resource release
> for i in $(seq 1 20); do
>     ./build/src/apps/cam/cam \
>         -c 1 \
>         -s width=1280,height=720,pixelformat=RGB888 \
>         --capture=5
> done
> 
> # Check dmesg for warnings or errors after the run
> dmesg | grep -i "tegra\|csi\|isp\|cam" | tail -20
> ```
> 
> ---
> 
> ## What to report back
> 
> Please reply with the following information:
> 
> ```
> Board:        e.g. Jetson Nano 4GB / AGX Orin 32GB
> Kernel:       e.g. 6.8.0 mainline
> Camera:       e.g. IMX219 (Raspberry Pi Camera v2)
> Driver:       tegra-vi  /  tegra234-vi
> 
> Test 1 – cam --list:          PASS / FAIL
> Test 2 – 30-frame capture:    PASS / FAIL
> Test 3 – PPM image quality:   PASS / FAIL / (describe issues)
> Test 4 – Live preview:        PASS / FAIL / SKIP
> Test 5 – Stress test:         PASS / FAIL
> 
> dmesg errors (if any):
> <paste relevant lines>
> 
> Additional notes:
> <anything unusual you observed>
> ```
> 
> ---
> 
> ## Known limitations
> 
> - Only a single output stream is supported per camera.
> - Hardware rotation/flip is not supported (Rotate0 only).
> - Hardware ISP (ISP7 on Tegra234/Orin) is not yet supported — frames are
>   processed by the CPU-based SoftwareISP.  This means image quality and
>   CPU load will be lower and higher respectively than a hardware ISP path.
>   ISP7 support will be added in a follow-up once the upstream kernel driver
>   is available.
> 
> ---
> 
> ## Contact
> 
> Please send test results to the libcamera mailing list:
> **libcamera-devel@lists.libcamera.org**
> 
> Or open a discussion on the libcamera GitLab:
> **https://gitlab.freedesktop.org/camera/libcamera**
> 
> Thank you for your time!
> ***
> 
> Magdum (1):
>   pipeline: Add NVIDIA Tegra VI pipeline handler
> 
>  include/libcamera/ipa/meson.build        |    1 +
>  meson_options.txt                        |    1 +
>  src/libcamera/pipeline/tegra/meson.build |    5 +
>  src/libcamera/pipeline/tegra/tegra.cpp   | 1102 ++++++++++++++++++++++
>  src/libcamera/software_isp/meson.build   |    2 +-
>  5 files changed, 1110 insertions(+), 1 deletion(-)
>  create mode 100644 src/libcamera/pipeline/tegra/meson.build
>  create mode 100644 src/libcamera/pipeline/tegra/tegra.cpp