How to capture 4 chans video data through one csi interface based ov5693_i2c driver on jetson tx1 board

Hi all:
I want to capture 4 chans pal video from isl79987 to csi_a interface,
and now i try to modify the ov5693 i2c driver at /driver/media/i2c.
And now how to treat isl79987 chip as four video devices, or one device /dev/video0 as ov5693,
Can CI module in tx1 chip can separate these four different video channels through different virtual chan id in csi
protocol or it is just like ov5693 all 4 chan data merged in one frame then ?

Can you give me some advice?

Thank you

TX1 not support your use case. TX1 per channel(4 lanes) only can support two source. TX1 have 3 channel 12 lanes and the max support 6 camera sensor sources.

Can i use embed mode treat four channels data as one video, disable virtual channel check,
and at the user space, the application program 4 channels are separated out ?

No you can’t. One channel only have two pixel parser logic to support max 2 input source. There’s possibly way is combine the 4 video as one before output to CSI/VI.

Hi, ShaneCCC,
By combining videos, do you mean:
1, form a large video frame that is 4 times the resolution of a single video frame and layout the 4 individual video in that frame?
or 2, simply treat the interleaved 4 video pixels as one single video, let it go through CSI. And at the other end, demux the payload into 4 video frames?
or otherwise?

What I mean is first combining 4 to 1 frame.

We have combine 4 to 1 frame, but there is on data get only black screen,
we use
gst-launch-1.0 -v v4l2src device="/dev/video0" ! “video/x-raw,width=720,height=240, format=(string)I420” ! nvvidconv ! “video/x-raw(memory:NVMM)” ! nvoverlaysink

Is there anything wrong?

log:
ubuntu@tegra-ubuntu:~/v4l2$ ./capture.sh
Setting pipeline to PAUSED …
Inside NvxLiteH264DecoderLowLatencyInitNvxLiteH264DecoderLowLatencyInit set DPB and MjstreamingInside NvxLiteH265DecoderLowLatencyInitNvxLiteH265DecoderLowLatencyInit set DPB and MjstreamingPipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4[ 797.606405] tegra_channel_capture_frame: entry!!!
[ 797.613819] tegra_channel_enable_stream: entry!!!
l2Src:v4l2src0.GstPad:src: caps [ 797.618729] isl79987_s_stream++
= “video[ 797.624467] isl79987_s_stream–
/x-raw,\ format=(string)I420,\ width=(int[ 797.629678] tegra_channel_enable_stream: exit 0 !!!
[ 797.637325] vi2_channel_capture_frame: entry!!!
[ 797.641846] vi2_channel_capture_frame: valid_ports 1!!!
[ 797.647070] vi2_channel_capture_frame: bypass 0!!!
[ 797.651859] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
[ 797.659249] vi2_channel_error_status: entry
[ 797.663691] vi2_channel_error_status: exit
[ 797.668048] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
[ 797.674044] tegra_channel_capture_frame: entry!!!
[ 797.678747] vi2_channel_capture_frame: entry!!!
[ 797.683266] vi2_channel_capture_frame: valid_ports 1!!!
[ 797.688490] vi2_channel_capture_frame: bypass 0!!!
[ 797.693275] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
[ 797.700665] vi2_channel_error_status: entry
[ 797.705113] vi2_channel_error_status: exit
[ 797.709462] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
[ 797.715464] tegra_channel_capture_frame: entry!!!
[ 797.720162] vi2_channel_capture_frame: entry!!!
)720,\ height[ 797.724690] vi2_channel_capture_frame: valid_ports 1!!!
=(int)[ 797.731281] vi2_channel_capture_frame: bypass 0!!!
240,\ pixel-aspect-rati[ 797.736758] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
o=(fraction)1[ 797.746208] vi2_channel_error_status: entry
/1,\ interlace-[ 797.752017] vi2_channel_error_status: exit
mode=(string)progress[ 797.757753] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
ive,\ colorimetry=(st[ 797.765819] tegra_channel_capture_frame: entry!!!
ring)2:[ 797.772576] vi2_channel_capture_frame: entry!!!
4:7:1,\ framerate=(fr[ 797.777791] vi2_channel_capture_frame: valid_ports 1!!!
action)[ 797.781485] nvmap_alloc_handle: PID 1834: gst-launch-1.0: WARNING: All NvMap Allocations must have a tag to identify the subsystem allocating memory.Plase pass the tag to the API call NvRmMemHanldeAllocAttr() or relevant.
30/1”
/GstPipeline:pipeline0/Gs[ 797.805458] vi2_channel_capture_frame: bypass 0!!!
[ 797.812994] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
[ 797.820393] vi2_channel_error_status: entry
[ 797.824845] vi2_channel_error_status: exit
[ 797.829194] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
[ 797.835203] tegra_channel_capture_frame: entry!!!
[ 797.839900] vi2_channel_capture_frame: entry!!!
[ 797.844419] vi2_channel_capture_frame: valid_ports 1!!!
[ 797.849643] vi2_channel_capture_frame: bypass 0!!!
tCapsFil[ 797.854428] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
ter:capsfilter0.GstPad:s[ 797.862508] vi2_channel_error_status: entry
rc: caps = “video/x-raw[ 797.869019] vi2_channel_error_status: exit
,\ format=(string)I42[ 797.875439] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
0,\ wid[ 797.883492] tegra_channel_capture_frame: entry!!!
th=(int)720,\ height[ 797.888884] vi2_channel_capture_frame: entry!!!
=(int)240,\ pixel-as[ 797.895476] vi2_channel_capture_frame: valid_ports 1!!!
pect-rat[ 797.902754] vi2_channel_capture_frame: bypass 0!!!
io=(fraction)1/1,\ i[ 797.908235] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
nterlace-mode=(string[ 797.917685] vi2_channel_error_status: entry
)progressive,\ [ 797.924188] vi2_channel_error_status: exit
colorimetry=(string)2[ 797.929921] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
:4:7:1,\ framerate=(fraction)30/1”
[ 797.938229] tegra_channel_capture_frame: entry!!!
[ 797.946151] vi2_channel_capture_frame: entry!!!
[ 797.950673] vi2_channel_capture_frame: valid_ports 1!!!
[ 797.955897] vi2_channel_capture_frame: bypass 0!!!
[ 797.960685] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
[ 797.968075] vi2_channel_error_status: entry
[ 797.972516] vi2_channel_error_status: exit
[ 797.976874] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
[ 797.982871] tegra_channel_capture_frame: entry!!!
[ 797.987573] vi2_channel_capture_frame: entry!!!
[ 797.992095] vi2_channel_capture_frame: valid_ports 1!!!
[ 797.997317] vi2_channel_capture_frame: bypass 0!!!
/GstPipe[ 798.002100] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
line:pipeline0/Gstnvvcon[ 798.010182] vi2_channel_error_status: entry
v:nvvconv0.GstPad:src: c[ 798.016690] vi2_channel_error_status: exit
aps = “video/x-r[ 798.023098] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
aw(memory:NVMM),\ wid[ 798.030480] tegra_channel_capture_frame: entry!!!
th=(int)720,\ height[ 798.037247] vi2_channel_capture_frame: entry!!!
=(int[ 798.043830] vi2_channel_capture_frame: valid_ports 1!!!
)240,\ pixel-aspect-rat[ 798.049741] vi2_channel_capture_frame: bypass 0!!!
io=(fraction)1/1,\ i[ 798.056596] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
nterlace-mode=(string[ 798.066046] vi2_channel_error_status: entry
)progressive,\ [ 798.072548] vi2_channel_error_status: exit
framerate=(fraction)3[ 798.078283] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
0/1,\ format=(string)I420”
/GstPipe[ 798.086654] tegra_channel_capture_frame: entry!!!
[ 798.094497] vi2_channel_capture_frame: entry!!!
[ 798.099032] vi2_channel_capture_frame: valid_ports 1!!!
line:pip[ 798.104252] vi2_channel_capture_frame: bypass 0!!!
eline0/GstCapsFilter:capsfilter1[ 798.109740] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
.GstPad:[ 798.119904] vi2_channel_error_status: entry
src: caps = “video/x-raw(memory[ 798.125043] vi2_channel_error_status: exit
[ 798.132144] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
:NVMM),\ width=(int[ 798.138151] tegra_channel_capture_frame: entry!!!
)720,\ height=(int)2[ 798.144918] vi2_channel_capture_frame: entry!!!
40,\ pi[ 798.151502] vi2_channel_capture_frame: valid_ports 1!!!
xel-aspect-ratio=(frac[ 798.157410] vi2_channel_capture_frame: bypass 0!!!
tion)1/1,\ int[ 798.164258] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
erlace-mode=(string)p[ 798.173024] vi2_channel_error_status: entry
rogressive,\ framerate[ 798.179535] vi2_channel_error_status: exit
=(fraction)30/1,\ for[ 798.185952] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
mat=(string)I420”
/GstPipeline:pipeline0/GstNvOverlaySink-nvoverlaysink:nvoverlaysink-nvoverlaysink0.GstPad:sink: caps = “video/x-raw(memory:NVMM),\ width=(int)720,\ height=(int)240,\ pixel-aspect-ratio=(fraction)1[ 798.211167] tegra_channel_capture_frame: entry!!!
/1,\ interlace-mode=(string)[ 798.218864] vi2_channel_capture_frame: entry!!!
progress[ 798.226133] vi2_channel_capture_frame: valid_ports 1!!!
ive,\ f[ 798.232035] vi2_channel_capture_frame: bypass 0!!!
ramerate=(fraction)30/1,\ fo[ 798.237561] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
rmat=(string)[ 798.247690] vi2_channel_error_status: entry
I420”
/GstPipel[ 798.253505] vi2_channel_error_status: exit
ine:pipeline0/GstCapsFilter:caps[ 798.259269] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
filter1.GstPad:sink: caps = “vid[ 798.268024] tegra_channel_capture_frame: entry!!!
eo/x-raw(memory:NVMM),\ width[ 798.275486] vi2_channel_capture_frame: entry!!!
=(int[ 798.282744] vi2_channel_capture_frame: valid_ports 1!!!
)720,\ height=(int)240,\ pi[ 798.288698] vi2_channel_capture_frame: bypass 0!!!
xel-aspect-ratio[ 798.296237] vi2_channel_capture_frame: exit,timeout 20 chan->capture_state 1!!!
=(fraction)1/1,\ interlace-m[ 798.305026] vi2_channel_error_status: entry
[ 798.312198] vi2_channel_error_status: exit
ode=(string)p[ 798.316587] tegra_channel_capture_frame: exit,pg_mode 0 err 0!!!
rogressi[ 798.323957] tegra_channel_capture_frame: entry!!!
ve,\ framerate=(fraction)30/[ 798.329376] vi2_channel_capture_frame: entry!!!
1,\ for[ 798.336655] vi2_channel_capture_frame: valid_ports 1!!!
mat=(s[ 798.342560] vi2_channel_capture_frame: bypass 0!!!
tring)I420”

+++++++++++++++++++++++++++++++++++

ubuntu@tegra-ubuntu:~$ v4l2-ctl --all
Driver Info (not using libv4l2):
Driver name : tegra-video
Card type : vi-output-0, isl79987_mipi 1-00
Bus info : platform:vi:0
Driver version: 3.10.96
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera 0: ok)
Format Video Capture:
Width/Height : 724/240
Pixel Format : ‘UYVY’
Field : None
Bytes per Line : 1472
Size Image : 353280
Colorspace : SMPTE 170M
Transfer Function : Default
YCbCr/HSV Encoding: Default
Quantization : Default
Flags :

Camera Controls

                 hdr_enable (intmenu): min=0 max=1 default=0 value=0
                bypass_mode (intmenu): min=0 max=1 default=0 value=0
                       gain (int)    : min=0 max=128 step=1 default=0 value=0 flags=slider

v4l2-compliance -d /dev/video0
v4l2-compliance SHA : a710e1bb7c6803a9347d3899b9129d887221985f

Driver Info:
Driver name : tegra-video
Card type : vi-output-0, isl79987_mipi 1-00
Bus info : platform:vi:0
Driver version: 3.10.96
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

Control ioctls:
	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
	test VIDIOC_QUERYCTRL: OK
	test VIDIOC_G/S_CTRL: OK
	test VIDIOC_G/S/TRY_EXT_CTRLS: OK
	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
	test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
	Standard Controls: 1 Private Controls: 3

Format ioctls:
	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
	fail: v4l2-test-formats.cpp(1162): ret && node->has_frmintervals
	test VIDIOC_G/S_PARM: FAIL
	test VIDIOC_G_FBUF: OK (Not Supported)
	test VIDIOC_G_FMT: OK
	fail: v4l2-test-formats.cpp(666): Video Capture is valid, but no TRY_FMT was implemented
	test VIDIOC_TRY_FMT: FAIL
	warn: v4l2-test-formats.cpp(977): S_FMT cannot handle an invalid pixelformat.
	warn: v4l2-test-formats.cpp(978): This may or may not be a problem. For more information see:
	warn: v4l2-test-formats.cpp(979): http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html
	fail: v4l2-test-formats.cpp(991): S_FMT cannot handle an invalid format
	test VIDIOC_S_FMT: FAIL
	test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
	test Cropping: OK (Not Supported)
	test Composing: OK (Not Supported)
	fail: v4l2-test-formats.cpp(1553): doioctl(node, VIDIOC_S_FMT, &fmt)
	fail: v4l2-test-formats.cpp(1650): doioctl(node, VIDIOC_S_FMT, &fmt)
	test Scaling: FAIL

Codec ioctls:
	test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
	test VIDIOC_G_ENC_INDEX: OK (Not Supported)
	test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
	test VIDIOC_EXPBUF: OK

Test input 0:

Total: 43, Succeeded: 39, Failed: 4, Warnings: 3

Thanks

The vi2 driver shows timeout to capture a frame from video source.Possible the setting is incorrect or the source have problem.

Does below resolution are merge 4 source to 1?

Width/Height : 724/240

Hi Shane:
Thank you for your reply!
The value of Width/Height should be 724/960 actually,
we also set 724/960, same result.
we set 724/240, just want to grab something to see if data in.

Could you give more details about setting is incorrect,
How can we check this, as we are not so familiar with vi/csi/mipi in the chip?
In our board the video decoder chip has its only power, clock(mclk), reset,
all of which supply by cpu for jeston tx1 ov5693,is no needed to supply by cpu.

only i2c is used to config decoder,
we modify the current decode driver based on ov5693 in media/i2c dir,and also device tree modified

Thank you very much!
best regards

I thing beside the resolution I can’t thing any particular things need to modify.
For you case I thing you need to make sure the output data/signal is correct and match the mipi spec. And did you see any vi/csi log from the kernel message?

Hi ShaneCCC:
Thank you for your help, we capture our yuv data.
And we meet some other questions.

  1. As our data format is UYVY NTSC/60,in our application we have to do deInterlace,and convert to RGB color space to
    output. In tx1 can deInterlace and rgb convert completed by hardware support to lower time cost?
    Can VIC module be used to do these job?

best regards

Hi xavierSFan
TX1 vic can do the color format convert but not support the de-interlace.
For can find video convert in the MM API.

http://developer.nvidia.com/embedded/dlc/l4t-documentation-24-2