Tegra VI platform understanding

Hello,

We are developing a 4-lane CSI-2 video card as follows:

a) Platform : TX2
b) Card Architecture: VGA Video Decoder followed by a FPGA converting VGA to CSI-2. Hence, the output of FPGA is connected to TX2 CSI-2 lanes
c) Driver Architecture : The driver has been built for VGA video Decoder which has I2C bus. The FPGA working is fixed and requires no software programming hence no driver built for it. The FPGA has been tested through simulation and is working fine.

Our VGA video decoder driver is configured as follows :

  1. Media Bus format : MEDIA_BUS_FMT_RGB888_1X24
  2. Pixel Format : RGB888
    Note : We probed at Video Decoder output using oscilloscope and are getting desired video frame signals & data.

d) We have configured VI Tegra platform for RGB888 as our input at CSI-2 from FPGA is RGB888. Hence, we have modified default configuration as follows :

File location: sources/kernel/nvidia/drivers/media/platform/tegra/camera/vi/core.c

static const struct tegra_video_format tegra_default_format[] = {
	{
		TEGRA_VF_RGB888,
		24,
		MEDIA_BUS_FMT_RGB888_1X24,
		{4, 1},
		TEGRA_IMAGE_FORMAT_T_A8R8G8B8,
		TEGRA_IMAGE_DT_RGB888,
		V4L2_PIX_FMT_RGB24,
		"BGRA-8-8-8-8",
	},
};

e) Video Node : It is created and its capabilities are as follows :

>sds@sds-desktop:~$ v4l2-ctl -d /dev/video0 --all
Driver Info (not using libv4l2):
	Driver name   : tegra-video
	Card type     : vi-output, adv7604 30-0020
	Bus info      : platform:15700000.vi:0
	Driver version: 4.9.140
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (HDMI 0: no signal)
DV timings:
	Active width: 1600
	Active height: 1200
	Total width: 2160
	Total height: 1250
	Frame format: progressive
	Polarities: +vsync +hsync
	Pixelclock: 162000000 Hz (60.00 frames per second)
	Horizontal frontporch: 64
	Horizontal sync: 192
	Horizontal backporch: 304
	Vertical frontporch: 1
	Vertical sync: 3
	Vertical backporch: 46
	Standards: DMT
	Flags: 
DV timings capabilities:
	Minimum Width: 0
	Maximum Width: 1920
	Minimum Height: 0
	Maximum Height: 1200
	Minimum PClock: 25000000
	Maximum PClock: 225000000
	Standards: CTA-861, DMT, CVT, GTF
	Capabilities: Progressive, Reduced Blanking, Custom Formats
Format Video Capture:
	Width/Height      : 1600/1200
	Pixel Format      : 'RGB3'
	Field             : Any
	Bytes per Line    : 6400
	Size Image        : 7680000
	Colorspace        : Default
	Transfer Function : Default (maps to Rec. 709)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 

f) VGA video decoder driver is based on V4L2 and we are taking data from CSI-2 using Gstreamer plug-in “v4l2src”. We have . checked supported formats using v4l2-ctl command as follows :

>sds@sds-desktop:~$ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'AR24'
	Name        : 32-bit BGRA 8-8-8-8
	Index       : 1
	Type        : Video Capture
	Pixel Format: 'UYVY'
	Name        : UYVY 4:2:2
	Index       : 2
	Type        : Video Capture
	Pixel Format: 'VYUY'
	Name        : VYUY 4:2:2
	Index       : 3
	Type        : Video Capture
	Pixel Format: 'YUYV'
	Name        : YUYV 4:2:2
	Index       : 4
	Type        : Video Capture
	Pixel Format: 'YVYU'
	Name        : YVYU 4:2:2
	Index       : 5
	Type        : Video Capture
	Pixel Format: 'NV16'
	Name        : Y/CbCr 4:2:
	Index       : 6
	Type        : Video Capture
	Pixel Format: 'YUYV'
	Name        : YUYV 4:2:2
	Index       : 7
	Type        : Video Capture
	Pixel Format: 'YVYU'
	Name        : YVYU 4:2:2

Gstreamer pipeline log is as follow:

>sds@sds-desktop:~$ gst-launch-1.0 v4l2src device="/dev/video0" ! videoconvert ! xvimagesink -ev
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Device '/dev/video0' has no supported format
Additional debug info:
gstv4l2object.c(3760): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Call to S_FMT failed for YVYU @ 3840x2160: Invalid argument
EOS on shutdown enabled -- waiting for EOS after Error
Waiting for EOS...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)

As you can see in the above log that we are getting pixel format error, but as per our system we have configured everything correctly. Please have a look at my logs and steps we are following and let us know what we are missing. As you can in log of sds@sds-desktop:~$ v4l2-ctl --list-formats-ext , We are not able to see resolution and frame rate supported.

Please help us to resolve this issue and let me know if my system understanding to customize tegra platform parameters is wrong somewhere.

Here is my device tree binding detail for your reference:

sds@sds-desktop:~$ media-ctl -pd /dev/media0
Media controller API version 0.1.0

Media device information
------------------------
driver          tegra-vi4
model           NVIDIA Tegra Video Input Device
serial          
bus info        
hw revision     0x3
driver version  0.0.0

Device topology
- entity 1: 150c0000.nvcsi--2 (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
		<- "adv7604 30-0020":6 [ENABLED]
	pad1: Source
		-> "vi-output, adv7604 30-0020":0 [ENABLED]

- entity 4: adv7604 30-0020 (7 pads, 1 link)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
	pad0: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad1: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad2: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad3: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad4: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad5: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad6: Source
		[fmt:RGB888_1X24/1600x1200 field:none colorspace:srgb
		 crop.bounds:(0,0)/1600x1200
		 crop:(0,0)/1600x1200]
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
		[dv.query:no-link]
		[dv.current:BT.656/1120 1600x1200p60 (2160x1250) stds:DMT flags:]
		-> "150c0000.nvcsi--2":0 [ENABLED]

- entity 12: vi-output, adv7604 30-0020 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video0
	pad0: Sink
		<- "150c0000.nvcsi--2":1 [ENABLED]

- entity 24: 150c0000.nvcsi--1 (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev2
	pad0: Sink
		<- "adv7604 32-0020":6 [ENABLED]
	pad1: Source
		-> "vi-output, adv7604 32-0020":0 [ENABLED]

- entity 27: adv7604 32-0020 (7 pads, 1 link)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev3
	pad0: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad1: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad2: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad3: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad4: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad5: Sink
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
	pad6: Source
		[fmt:RGB888_1X24/1600x1200 field:none colorspace:srgb
		 crop.bounds:(0,0)/1600x1200
		 crop:(0,0)/1600x1200]
		[dv.caps:BT.656/1120 min:0x0@25000000 max:1920x1200@225000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
		[dv.query:no-link]
		[dv.current:BT.656/1120 1600x1200p60 (2160x1250) stds:DMT flags:]
		-> "150c0000.nvcsi--1":0 [ENABLED]

- entity 35: vi-output, adv7604 32-0020 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video1
	pad0: Sink
		<- "150c0000.nvcsi--1":1 [ENABLED]

Thanks and Regards,
Vikas Dwivedi

Using v4l2-ctl to verify the sensor driver first.
And check the trace log if v4l2-ctl capture failed.