Last edited one week ago

STM32MP2 V4L2 camera overview

Applicable for   STM32MP23x lines  STM32MP25x lines


This article gives information about the Linux® V4L2 camera framework.

1. Framework purpose[edit | edit source]

The V4L2 Linux® kernel framework[1] allows the control of both an external camera sensor, and the camera interface. This allows the capture of raw frames in various pixel formats or encoded stream data such as JPEG.

This could be typically used, with the help of other Linux multimedia frameworks and applications, to take a snapshot, to make a preview, to make a video recording or even remotely stream images from the camera sensor.

2. System overview[edit | edit source]

CAMERAOverview MP25.png

2.1. Component description[edit | edit source]

  • media-ctl (user space)

A V4L2 utility relying on media controller Linux kernel interface[2] aiming to configure and link each sub devices composing the camera subsystem to configure it.

  • Application (user space)

Any application relying on V4L2 Linux kernel interface[3] or libv4l abstraction layer. GStreamer framework provides such application.

  • V4L2 utilities (user space)

A set of tools to test, configure, and use the whole camera subsystem, including the external camera sensor and the camera interface. v4l2-ctl is one of the most useful utilities.

  • V4L2 libraries (libv4l) (user space)

A set of libraries on top of the V4L2 Linux kernel interface[3] which abstract the kernel interface to simplify, keep compatibility, or add some hooks between V4L-based applications and the V4L2 kernel interface.

  • V4L2 core (kernel space)

This layer represents the standard Linux kernel V4L2 framework.

  • stm32-dcmipp (kernel space)

This V4L2 DCMIPP Linux device driver handles the DCMIPP hardware block.

  • Camera sensor X driver (kernel space)

This V4L2 Linux device driver handles the camera sensor X external peripheral, some GPIOs lines, and potentially power supplies to power-up/down the camera sensor. The communication with the camera sensor is done through the I2C bus.

  • DCMIPP (Hardware)

The DCMIPP hardware block.

  • Camera sensor X (Hardware)

The camera sensor external peripheral.

2.2. APIs description[edit | edit source]

The V4L2 userland API is documented in the Linux media subsystem documentation[3].

The V4L2 kernel framework internal API is documented in the V4L2 kernel support section of the Linux kernel documentation[4].

The media controller API is documented in the Linux media subsystem documentation[2].

3. Configuration[edit | edit source]

3.1. Kernel configuration[edit | edit source]

The STM32 DCMIPP camera interface and the camera sensor are enabled by default in STMicroelectronics deliveries.

Nevertheless, this is not the case when using the upstream kernel version. In this case, the DCMIPP V4L2 driver can be enabled using the Linux kernel menuconfig tool:

  Device Drivers --->
    <M> Multimedia support --->
      Media drivers --->
         [*] Media platform devices  ---> 
            <M> STM32 Digital Camera Memory Interface Pixel Processor (DCMIPP) support

The external camera sensor connected to the camera interface must also be enabled. Here is an example with the IMX335 SONY camera sensor located on the MB1854 camera daughter board[5] connected to the CN4 CSI camera connector[6] of the STM32MP257F-EV1 Evaluation board More info green.png:

  Device Drivers --->
    <M> Multimedia support --->
      Media ancillary drivers --->
        [*] Camera sensor devices  --->
          <M> Sony IMX335 sensor support

3.2. Device tree configuration[edit | edit source]

Refer to the DCMIPP device tree configuration article for a complete view of DCMIPP and sensor configuration thanks to Linux kernel device tree mechanism.

4. How to use the framework[edit | edit source]

The use cases described here are enabled using media-ctl, v4l2-ctl, gst-launch, or gst-play command line utilities.


4.1. List the video devices and their capabilities[edit | edit source]

List all the available video devices using --list-devices option:

v4l2-ctl --list-devices
stm32_dcmipp (platform:48030000.dcmipp):
        /dev/video0
        /dev/video1
        /dev/video2
        /dev/video3
        /dev/video4
        /dev/media0

st,stm32mp25-vdec-dec (platform:480d0000.vdec):
        /dev/video5
        /dev/media1

st,stm32mp25-venc-enc (platform:480e0000.venc):
        /dev/video6
        /dev/media2

If several devices are available, use the -d option after any v4l2-ctl commands to target a specific device. If the -d option is not specified, /dev/video0 is targeted by default.

To have information on a specific device, use the -D option:

v4l2-ctl -d /dev/video1 -D
Driver Info:
        Driver name      : dcmipp
        Card type        : stm32_dcmipp
        Bus info         : platform:48030000.dcmipp
        Driver version   : 6.6.48
        Capabilities     : 0xa4200001
                Video Capture
                I/O MC
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x24200001
                Video Capture
                I/O MC
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : dcmipp
        Model            : DCMIPP MDEV
        Serial           : 
        Bus info         : platform:48030000.dcmipp
        Media version    : 6.6.48
        Hardware revision: 0x00000030 (48)
        Driver version   : 6.6.48
Interface Info:
        ID               : 0x03000017
        Type             : V4L Video
Entity Info:
        ID               : 0x00000015 (21)
        Name             : dcmipp_main_capture
        Function         : V4L2 I/O
        Pad 0x01000016   : 0: Sink
          Link 0x02000036: from remote pad 0x1000014 of entity 'dcmipp_main_postproc' (Video Pixel Formatter): Data, Enabled, Immutable

4.2. Get the topology of the camera subsystem[edit | edit source]

Print the topology of the camera subsystem using the -p media-ctl option:

media-ctl -d platform:48030000.dcmipp -p
Media controller API version 6.6.48

Media device information
------------------------
driver          dcmipp
model           DCMIPP MDEV
serial          
bus info        platform:48030000.dcmipp
hw revision     0x30
driver version  6.6.48

Device topology
- entity 1: dcmipp_input (4 pads, 5 links, 0 routes)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [stream:0 fmt:SRGGB12_1X12/2592x1940 field:none colorspace:raw]
                <- "dcmipp_tpg":0 []
                <- "48020000.csi":1 [ENABLED]
        pad1: Source
                [stream:0 fmt:SRGGB12_1X12/2592x1940 field:none colorspace:raw]
                -> "dcmipp_dump_postproc":0 []
        pad2: Source
                [stream:0 fmt:SRGGB12_1X12/2592x1940 field:none colorspace:raw]
                -> "dcmipp_main_isp":0 [ENABLED]
        pad3: Source
                [stream:0 fmt:SRGGB12_1X12/2592x1940 field:none colorspace:raw]
                -> "dcmipp_aux_postproc":0 []

- entity 6: dcmipp_dump_postproc (2 pads, 2 links, 0 routes)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
                [stream:0 fmt:RGB565_2X8_LE/640x480 field:none colorspace:rec709
                 compose.bounds:(0,0)/640x480
                 compose:(0,0)/640x480]
                <- "dcmipp_input":1 []
        pad1: Source
                [stream:0 fmt:RGB565_2X8_LE/640x480 field:none colorspace:rec709
                 crop.bounds:(0,0)/640x480
                 crop:(0,0)/640x480]
                -> "dcmipp_dump_capture":0 [ENABLED,IMMUTABLE]

- entity 9: dcmipp_dump_capture (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "dcmipp_dump_postproc":1 [ENABLED,IMMUTABLE]

- entity 13: dcmipp_main_isp (4 pads, 5 links, 0 routes)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev2
        pad0: Sink
                [stream:0 fmt:SRGGB12_1X12/2592x1940 field:none colorspace:raw
                 crop.bounds:(0,0)/2592x1940
                 crop:(0,0)/2592x1940
                 compose.bounds:(0,0)/2592x1940
                 compose:(0,0)/2592x1940]
                <- "dcmipp_input":2 [ENABLED]
        pad1: Source
                [stream:0 fmt:RGB888_1X24/2592x1940 field:none colorspace:raw]
                -> "dcmipp_main_postproc":0 [ENABLED,IMMUTABLE]
                -> "dcmipp_aux_postproc":0 []
        pad2: Sink
                [stream:0 fmt:unknown/0x0]
                <- "dcmipp_main_isp_params_output":0 [ENABLED,IMMUTABLE]
        pad3: Source
                [stream:0 fmt:unknown/0x0]
                -> "dcmipp_main_isp_stat_capture":0 [ENABLED,IMMUTABLE]

- entity 18: dcmipp_main_postproc (2 pads, 2 links, 0 routes)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev3
        pad0: Sink
                [stream:0 fmt:RGB888_1X24/2592x1940@1/30 field:none colorspace:raw
                 crop.bounds:(0,0)/2592x1940
                 crop:(0,0)/2592x1940
                 compose.bounds:(0,0)/2592x1940
                 compose:(0,0)/640x480]
                <- "dcmipp_main_isp":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [stream:0 fmt:YUV8_1X24/640x480@1/30 field:none colorspace:rec709]
                -> "dcmipp_main_capture":0 [ENABLED,IMMUTABLE]

- entity 21: dcmipp_main_capture (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video1
        pad0: Sink
                <- "dcmipp_main_postproc":1 [ENABLED,IMMUTABLE]

- entity 25: dcmipp_aux_postproc (2 pads, 3 links, 0 routes)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev4
        pad0: Sink
                [stream:0 fmt:RGB888_1X24/640x480@1/30 field:none colorspace:rec709
                 crop.bounds:(0,0)/640x480
                 crop:(0,0)/640x480
                 compose.bounds:(0,0)/640x480
                 compose:(0,0)/640x480]
                <- "dcmipp_input":3 []
                <- "dcmipp_main_isp":1 []
        pad1: Source
                [stream:0 fmt:RGB888_1X24/640x480@1/30 field:none colorspace:rec709]
                -> "dcmipp_aux_capture":0 [ENABLED,IMMUTABLE]

- entity 28: dcmipp_aux_capture (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video2
        pad0: Sink
                <- "dcmipp_aux_postproc":1 [ENABLED,IMMUTABLE]

- entity 32: dcmipp_main_isp_stat_capture (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video3
        pad0: Sink
                <- "dcmipp_main_isp":3 [ENABLED,IMMUTABLE]

- entity 36: dcmipp_main_isp_params_output (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video4
        pad0: Source
                -> "dcmipp_main_isp":2 [ENABLED,IMMUTABLE]

- entity 40: dcmipp_tpg (1 pad, 1 link, 0 routes)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev5
        pad0: Source
                [stream:0 fmt:RGB565_1X16/640x480 field:none colorspace:rec709]
                -> "dcmipp_input":0 []

- entity 64: 48020000.csi (2 pads, 2 links, 0 routes)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev6
        pad0: Sink
                [stream:0 fmt:SRGGB12_1X12/2592x1940 field:none colorspace:raw]
                <- "imx335 0-001a":0 [ENABLED,IMMUTABLE]
        pad1: Source
                [stream:0 fmt:SRGGB12_1X12/2592x1940 field:none colorspace:raw]
                -> "dcmipp_input":0 [ENABLED]

- entity 69: imx335 0-001a (1 pad, 1 link, 0 routes)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev7
        pad0: Source
                [stream:0 fmt:SRGGB12_1X12/2592x1940 field:none colorspace:raw xfer:none
                 crop.bounds:(12,12)/2592x1944
                 crop:(12,12)/2592x1944]
                -> "48020000.csi":0 [ENABLED,IMMUTABLE]

This gives the current links between camera subdevices and each subdevice current pads configuration, such as, format, resolution, framerate.

This topology can also be displayed in a human readable graphical form thanks to the --print-dot option:

media-ctl -d platform:48030000.dcmipp --print-dot > graph.dot

Retrieve this .dot file into your host PC to convert it to .png:

dot -y -Tpng -Nfontname=Roboto -Nfontsize=10 -Efontname=Roboto -Efontsize=10 graph.dot -LO > graph.png
MediaGraph MP25 IMX335.png

This picture shows the two possible camera interfaces: MIPI CSI-2 or parallel, and the three pipes topology: dump pipe, main pipe, and auxiliary pipe:

  • The dump pipe allows to directly read without any processing the camera sensor data whatever those data are: raw-bayer, RGB, YUV, JPEG, or even image statistic data. The dump pipe output camera sensor specific data can be read from the /dev/video0 capture node.
  • The main pipe is the most featured DCMIPP pipe, including frame skipping, de-Bayering, image correction thanks to DCMIPP ISP, scaling, color conversion, ... The main pipe output pixel data can be read from the /dev/video1 capture node while the image statistic data can be read from the /dev/video3 capture node. Refer to How to use the DCMIPP ISP article to get more details on how to handle image statistic data.
  • The auxiliary pipe can perform limited operations such as scaling and color conversion with some restrictions regarding to main pipe. It can also be dynamically linked to the output of ISP to inherit of image correction. The auxiliary pipe output pixel data can be read from the /dev/video2 capture node.

4.3. Camera subsystem setup[edit | edit source]

To be able to capture frames from a video device node with v4l2-ctl, GStreamer, or any other V4L2 application, the camera subsystem must be first configured. To do so use the media-ctl --set-v4l2 command giving the subdevice name and pad the desired format, resolution, and framerate (30fps is the imx335 default framerate, check Set the camera sensor framerate chapter to change it):

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"

The configuration must be done from source to sink. Below is a configuration allowing to capture RGB565 640x480 frames:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:RGB888_1X24/640x480]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")

The camera sensor is configured in 5 MP raw-bayer 10 bits at 30 fps, which is the only configuration supported by the IMX335 for now. Then DCMIPP is configured to convert to RGB565 and downscale to 640x480. The configuration can be read back displaying the topology of the graph. See #Get the topology of camera subsystem. Then, any application that read frames from V4L2 video device node can be executed:

gst-launch-1.0 v4l2src device=$main_capture_dev ! video/x-raw, format=RGB16, width=640,height=480, framerate=30/1 ! queue ! waylandsink fullscreen=true
Warning white.png Warning
The application must configure V4L2 device node with exactly the same format, resolution, and framerate that the ones being set at camera subsystem setup!
Info white.png Information
At this stage you can observe that the preview image is very dark and greenish, see next chapter to perform image correction.

4.4. Image correction[edit | edit source]

To correct an image coming from a raw-bayer camera sensor using DCMIPP ISP, use the STMicroelectronics DCMIPP ISP example utility command line utility with the -w option while capture is running:


gst-launch-1.0 v4l2src device=$main_capture_dev ! video/x-raw, format=RGB16, width=640,height=480, framerate=30/1 ! queue ! waylandsink fullscreen=true &
sleep 1
/usr/local/demo/bin/dcmipp-isp-ctrl -i0 -g
sleep 1
kill %1

Image correction parameters are kept from a capture to another one, so you do not have to recall the dcmipp-isp-ctrl utility if ambient light conditions have not changed. More details on image correction can be found in the dedicated article How to use the DCMIPP ISP.

4.5. Controlling camera sensor[edit | edit source]

To control a camera sensor its corresponding entity device node must be found in the topology. To do so, the first entity of the graph must be found, that is, the entity having no sink pad:

- entity 69: imx335 0-001a (1 pad, 1 link, 0 routes)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev7
        pad0: Source
                [stream:0 fmt:SRGGB12_1X12/2592x1940 field:none colorspace:raw xfer:none
                 crop.bounds:(12,12)/2592x1944
                 crop:(12,12)/2592x1944]
                -> "48020000.csi":0 [ENABLED,IMMUTABLE]

Here it is /dev/v4l-subdev7.

Alternatively, the media-ctl -e command can be used to get the device node name giving the sensor name:

export sensor_dev=$(media-ctl -d platform:48030000.dcmipp -e "imx335 0-001a") && echo $sensor_dev
/dev/v4l-subdev7

Use then v4l2-ctl with the -L option to get the list of supported controls:

v4l2-ctl -d $sensor_dev -L
User Controls
                       exposure 0x00980911 (int)    : min=1 max=4491 step=1 default=1608 value=1608

Image Source Controls
              vertical_blanking 0x009e0901 (int)    : min=2560 max=133060 step=1 default=2560 value=2560
            horizontal_blanking 0x009e0902 (int)    : min=0 max=1048575 step=1 default=342 value=342 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=0 max=240 step=1 default=0 value=0

Image Processing Controls
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 (594000000 0x2367b880) flags=read-only
                                0: 594000000 (0x2367b880)
                     pixel_rate 0x009f0902 (int64)  : min=396000000 max=396000000 step=1 default=396000000 value=396000000 flags=read-only
Info white.png Information
"value=" field returns the current value of the control


The control value can be changed thanks to the --set-ctrl option, for example:

v4l2-ctl -d $sensor_dev --set-ctrl analogue_gain=10

The control value can be changed dynamically. In the following example, the analog gain is increased while the preview is running:

  • Start the preview in the background.
gst-launch-1.0 v4l2src device=$main_capture_dev ! video/x-raw, format=RGB16, width=640,height=480, framerate=30/1 ! queue ! waylandsink fullscreen=true -e > /dev/null 2>&1 &
  • Then increase the gain every second.
v4l2-ctl -d $sensor_dev --set-ctrl analogue_gain=0;sleep 1;v4l2-ctl -d $sensor_dev --set-ctrl analogue_gain=20;sleep 1;v4l2-ctl -d $sensor_dev --set-ctrl analogue_gain=40;sleep 1;v4l2-ctl -d $sensor_dev --set-ctrl analogue_gain=0;killall gst-launch-1.0

4.6. Set the camera sensor pixel format and resolution[edit | edit source]

The camera sensor only supports a discrete set of formats and resolutions that can be obtained thanks to the v4l2-ctl options --list-subdev-mbus-codes, --list-subdev-framesizes:

v4l2-ctl -d $sensor_dev --list-subdev-mbus-codes

or

v4l2-ctl -d $sensor_dev --list-subdev-mbus-codes <pad number>
ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0,stream=0)
        0x3012: MEDIA_BUS_FMT_SRGGB12_1X12
        0x300f: MEDIA_BUS_FMT_SRGGB10_1X10

The frame size might depend on the frame format, so precise it when asking for frame size:

v4l2-ctl -d $sensor_dev --list-subdev-framesizes pad=0,code=0x300f
ioctl: VIDIOC_SUBDEV_ENUM_FRAME_SIZE (pad=0,stream=0)
        Size Range: 2592x1940 - 2592x1940
        Size Range: 2592x1940 - 2592x1940
        Size Range: 2592x1940 - 2592x1940

Now that the camera sensor capabilities are known, the wanted configuration can be set following instructions described in chapter camera subsystem setup:

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"

4.7. Set the camera sensor framerate[edit | edit source]

RAW Bayer sensors usually don't have an explicit framerate control, vertical blanking control should be used instead to control framerate.

Giving the requested framerate, current capture resolution, pixel rate and horizontal blanking, the vertical blanking value can be obtained thanks to this formula:

vertical blanking = ((framerate denominator * pixel rate / framerate numerator) / (horizontal blanking + width)) - height

Find below a set of commands which configure sensor vertical blanking to get 15fps framerate instead of the 30fps default one:

Click to configure camera subsystem if not already made.
media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:RGB888_1X24/640x480]"
export sensor_dev=$(media-ctl -d platform:48030000.dcmipp -e "imx335 0-001a")
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")

framerate_num=15
framerate_denom=1
width=2592
height=1940
pixel_rate=$(v4l2-ctl -d $sensor_dev --get-ctrl=pixel_rate | awk '{print $NF}')
horizontal_blanking=$(v4l2-ctl -d $sensor_dev --get-ctrl=horizontal_blanking | awk '{print $NF}')
vertical_blanking=$(echo "$pixel_rate $horizontal_blanking $framerate_num $framerate_denom $width $height" | awk '{printf "%d", (((($1*$4)/$3)/($2+$5))-$6)}')
v4l2-ctl -d $sensor_dev --set-ctrl=vertical_blanking=$vertical_blanking

Then preview is made thanks to GStreamer fpsdisplaysink element, which computes the rendering framerate and print it on console for verification purpose, the sync=false option enables the rendering of frames as soon as they are available from v4l2src capture element, ignoring the default GStreamer framerate (30fps):

gst-launch-1.0 v4l2src device=$main_capture_dev ! "video/x-raw, format=RGB16, width=640,height=480" ! queue ! fpsdisplaysink text-overlay=false video-sink='waylandsink fullscreen=true' sync=false -v
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 33, dropped: 0, current: 15.00, average: 15.48
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 41, dropped: 0, current: 15.01, average: 15.38

4.8. Generate a test pattern[edit | edit source]

DCMIPP embeds a test pattern generator which can be used as a replacement of a real camera sensor. This allows to generate some known test patterns through the camera pipeline to any subsystem connected to it such as the display subsystem or the video codecs subsystem. This test pattern generator could also help when investigating camera issues by getting rid of real camera sensor considerations.

Two types of test patterns are available: 8 solid vertical color bars and progressive colored squares, with their grayscale counterparts, an additional horizontal dynamic lifeline can be enabled to check for framerate, frame skipping and frames order, framerate at which frames are generated is controled by vertical blanking (refer to Set the camera sensor framerate):

export tpg_dev=$(media-ctl -d platform:48030000.dcmipp -e "dcmipp_tpg")
v4l2-ctl -d $tpg_dev -L
Image Source Controls

              vertical_blanking 0x009e0901 (int)    : min=16 max=65535 step=1 default=11817 value=11817
            horizontal_blanking 0x009e0902 (int)    : min=81 max=81 step=1 default=81 value=81 flags=read-only

Image Processing Controls

                     pixel_rate 0x009f0902 (int64)  : min=133000000 max=266000000 step=1 default=266000000 value=266000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=7 default=0 value=0 (Color bars)
                                0: Color bars
                                1: Grayscale bars
                                2: Color squares
                                3: Grayscale squares
                                4: Color bars with lifeline
                                5: Grayscale bars with lifeline
                                6: Color squares with lifeline
                                7: Grayscale squares with lifeline


Various pixel formats are selectable, in RGB, YUV, raw-bayer and grayscale worlds, in order to be as close as possible of a real camera sensor:

v4l2-ctl -d $tpg_dev --list-subdev-mbus-codes
ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0,stream=0)
        0x2011: MEDIA_BUS_FMT_YUYV8_1X16
        0x1017: MEDIA_BUS_FMT_RGB565_1X16
        0x100a: MEDIA_BUS_FMT_RGB888_1X24
        0x3001: MEDIA_BUS_FMT_SBGGR8_1X8
        0x3013: MEDIA_BUS_FMT_SGBRG8_1X8
        0x3002: MEDIA_BUS_FMT_SGRBG8_1X8
        0x3014: MEDIA_BUS_FMT_SRGGB8_1X8
        0x3007: MEDIA_BUS_FMT_SBGGR10_1X10
        0x300e: MEDIA_BUS_FMT_SGBRG10_1X10
        0x300a: MEDIA_BUS_FMT_SGRBG10_1X10
        0x300f: MEDIA_BUS_FMT_SRGGB10_1X10
        0x3008: MEDIA_BUS_FMT_SBGGR12_1X12
        0x3010: MEDIA_BUS_FMT_SGBRG12_1X12
        0x3011: MEDIA_BUS_FMT_SGRBG12_1X12
        0x3012: MEDIA_BUS_FMT_SRGGB12_1X12
        0x3019: MEDIA_BUS_FMT_SBGGR14_1X14
        0x301a: MEDIA_BUS_FMT_SGBRG14_1X14
        0x301b: MEDIA_BUS_FMT_SGRBG14_1X14
        0x301c: MEDIA_BUS_FMT_SRGGB14_1X14
        0x2001: MEDIA_BUS_FMT_Y8_1X8
        0x200a: MEDIA_BUS_FMT_Y10_1X10
        0x2013: MEDIA_BUS_FMT_Y12_1X12
        0x202d: MEDIA_BUS_FMT_Y14_1X14

Resolution can be set at pixel precision from 16x16 to 16383x16383:

v4l2-ctl -d $tpg_dev --list-subdev-framesizes pad=0,code=0x100a
ioctl: VIDIOC_SUBDEV_ENUM_FRAME_SIZE (pad=0,stream=0)
        Size Range: 16x16 - 16383x16383

To enable the test pattern generator, the dcmipp_tpg subdevice must be linked to the dcmipp_input instead of the camera sensor subdevice, then dcmipp_tpg is configured in the same way than the real camera sensor, rest of configuration remains unchanged:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"dcmipp_tpg":0->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_tpg':0[fmt:SRGGB10_1X10/1024x600 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/1024x600 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/1024x600 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/1024x600]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:RGB888_1X24/1024x600]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
export tpg_dev=$(media-ctl -d platform:48030000.dcmipp -e "dcmipp_tpg")

As usual, a GStreamer command line can be used to preview frames on display:

gst-launch-1.0 v4l2src device=$main_capture_dev ! "video/x-raw, format=RGB16, width=1024,height=600, framerate=(fraction)30/1" ! queue ! waylandsink fullscreen=true > /dev/null 2>&1 &

Test pattern can be changed on the fly usint v4l2-ctl --set-ctrl test_pattern:

v4l2-ctl -d $tpg_dev --set-ctrl test_pattern=1;sleep 3;v4l2-ctl -d $tpg_dev --set-ctrl test_pattern=2;sleep 3;v4l2-ctl -d $tpg_dev --set-ctrl test_pattern=4;sleep 3;v4l2-ctl -d $tpg_dev --set-ctrl test_pattern=0;killall gst-launch-1.0

4.9. Downscale and crop[edit | edit source]

Three features of DCMIPP can help to reduce resolution: decimation, downsize, and crop.

The main pipe can crop and downscale. To do so postproc subdev must be configured accordingly. The wanted resolution must be set on postproc subdev using the compose property of the sink pad. Here is an example to get 640x480 frames from 2592x1940 input frames coming from a camera sensor:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:RGB888_1X24/640x480]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
gst-launch-1.0 v4l2src device=$main_capture_dev ! video/x-raw, format=RGB16, width=640, height=480, framerate=30/1 ! queue ! autovideosink
Info white.png Information
Note that (top,left) argument of compose property is ignored by driver


The wanted crop area must be set using the crop property of the postproc subdev sink pad. Here is an example to crop a 640x480 area centered inside the 2592x1940 input frame coming from camera sensor:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[crop:(976,300)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:RGB565_2X8_LE/640x480]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
gst-launch-1.0 v4l2src device=$main_capture_dev ! video/x-raw, format=RGB16, width=640,height=480, framerate=30/1 ! queue ! autovideosink

Downscale and crop can be combined together. Here is an example to get 640x480 frames from 2592x1940 input frames cropped to 1292x970:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[crop:(976,300)/1292x970]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:RGB888_1X24/640x480]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
gst-launch-1.0 v4l2src device=$main_capture_dev ! video/x-raw, format=RGB16, width=640,height=480, framerate=30/1 ! queue ! autovideosink

Refer to the selection chapter of the sub device interface documentation[7] to get more details on how to control scaling and crop.

4.10. Color conversion[edit | edit source]

The main pipe and auxiliary pipe are able to do color conversion.

The main pipe is the most featured pipe with conversions to RGB and YUV, either single-plane (for example YUV422 coplanar), dual-plane (for example YUV420 semiplanar NV12) or triple-plane (for example YUV420 planar I420). To do so, the main capture device and main postproc subdev must be configured accordingly. Here is an example to get YUV420 semiplanar in output of the main pipe:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:YUV8_1X24/640x480]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
gst-launch-1.0 v4l2src device=$main_capture_dev ! video/x-raw, format=NV12, width=640, height=480, framerate=30/1 ! queue ! autovideosink

Here are all the pixel format available on the main pipe capture node:

v4l2-ctl -d $main_capture_dev --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'RGBP' (16-bit RGB 5-6-5)
                Size: Continuous 16x16 - 4096x2160
        [1]: 'YUYV' (YUYV 4:2:2)
                Size: Continuous 16x16 - 4096x2160
        [2]: 'YVYU' (YVYU 4:2:2)
                Size: Continuous 16x16 - 4096x2160
        [3]: 'UYVY' (UYVY 4:2:2)
                Size: Continuous 16x16 - 4096x2160
        [4]: 'VYUY' (VYUY 4:2:2)
                Size: Continuous 16x16 - 4096x2160
        [5]: 'GREY' (8-bit Greyscale)
                Size: Continuous 16x16 - 4096x2160
        [6]: 'RGB3' (24-bit RGB 8-8-8)
                Size: Continuous 16x16 - 4096x2160
        [7]: 'BGR3' (24-bit BGR 8-8-8)
                Size: Continuous 16x16 - 4096x2160
        [8]: 'BA24' (32-bit ARGB 8-8-8-8)
                Size: Continuous 16x16 - 4096x2160
        [9]: 'AR24' (32-bit BGRA 8-8-8-8)
                Size: Continuous 16x16 - 4096x2160
        [10]: 'AB24' (32-bit RGBA 8-8-8-8)
                Size: Continuous 16x16 - 4096x2160
        [11]: 'RA24' (32-bit ABGR 8-8-8-8)
                Size: Continuous 16x16 - 4096x2160
        [12]: 'NV12' (Y/UV 4:2:0)
                Size: Continuous 16x16 - 4096x2160
        [13]: 'NV21' (Y/VU 4:2:0)
                Size: Continuous 16x16 - 4096x2160
        [14]: 'NV16' (Y/UV 4:2:2)
                Size: Continuous 16x16 - 4096x2160
        [15]: 'NV61' (Y/VU 4:2:2)
                Size: Continuous 16x16 - 4096x2160
        [16]: 'YU12' (Planar YUV 4:2:0)
                Size: Continuous 16x16 - 4096x2160
        [17]: 'YV12' (Planar YVU 4:2:0)
                Size: Continuous 16x16 - 4096x2160

Care must be taken on adequation between mbus-code, V4L2 pixel format, and GStreamer pixel format. Find below a list of the most common pixel format:

mbus-code (media-ctl) V4L2 pixel format (v4l-ctl) GStreamer (gst-launch-1.0)
RGB32 32 bits single plane RGB888_1X24 AR24 BGRA
RGB565 16 bits single plane RGB888_1X24 RGBP RGB16
YUV422 16 bits single plane YUV8_1X24 YUYV YUY2
YUV420 semiplanar 12 bits two planes YUV8_1X24 NV12 NV12
YUV420 planar 12 bits three planes YUV8_1X24 YU12 I420

4.11. Grab a frame from a RAW sensor, with ISP demosaicing[edit | edit source]

Capture a VGA RGB565 frame on disk from the RAW sensor:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:RGB888_1X24/640x480]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
v4l2-ctl -d $main_capture_dev --set-fmt-video=width=640,height=480,pixelformat=RGBP --stream-mmap --stream-count=1 --stream-to=grab-640x480-rgb565.raw

To display it, this raw frame must be converted first to JPEG:

gst-launch-1.0 filesrc location= grab-640x480-rgb565.raw blocksize=614400 ! "video/x-raw, format=(string)RGB16, width=(int)640, height=(int)480, framerate=(fraction)30/1" ! videoconvert ! jpegenc ! filesink location=grab-640x480-rgb565.jpeg

Then the weston-image utility can be used to display this JPEG file:

weston-image grab-640x480-rgb565.jpeg

4.12. Fullscreen preview[edit | edit source]

Configure camera subsystem setup to output 640x480 in RGB565 and send frames to wayland display subsystem using GStreamer:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:RGB888_1X24/640x480]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
gst-launch-1.0 v4l2src device=$main_capture_dev ! "video/x-raw, format=RGB16, width=640,height=480, framerate=(fraction)30/1" ! queue ! waylandsink fullscreen=true

Camera preview demo application, started by clicking on the camera icon menu, is a good example of script-based command lines that combines camera subsystem configuration using media-ctl, preview using GStreamer, and automatic image correction using isp utility in the background. You can manually start this demo script using the command line:

/usr/local/demo/application/camera/bin/launch_camera_preview_mp25.sh

The camera subsystem configuration part is done inside script "launch_camera_control_mp25.sh":

cat /usr/local/demo/application/camera/bin/launch_camera_control_mp25.sh
[...]
    #Use main pipe for debayering, scaling and color conversion
    echo "Mediacontroller graph:"
    cmd "  media-ctl -d $DCMIPP_MEDIA -l \"'dcmipp_input':1->'dcmipp_dump_postproc':0[0]\""
    cmd "  media-ctl -d $DCMIPP_MEDIA -l \"'dcmipp_input':2->'dcmipp_main_isp':0[1]\""
    cmd "  media-ctl -d $DCMIPP_MEDIA --set-v4l2 \"'$sensor_subdev':0[fmt:$sensorbuscode/${SENSORWIDTH}x${SENSORHEIGHT}]\""
    if [ "$bridge_subdev" != "" ]; then
        cmd "  media-ctl -d $DCMIPP_MEDIA --set-v4l2 \"'$bridge_subdev':1[fmt:$sensorbuscode/${SENSORWIDTH}x${SENSORHEIGHT}]\""
    fi
    cmd "  media-ctl -d $DCMIPP_MEDIA --set-v4l2 \"'dcmipp_input':2[fmt:$sensorbuscode/${SENSORWIDTH}x${SENSORHEIGHT}]\""
    cmd "  media-ctl -d $DCMIPP_MEDIA --set-v4l2 \"'dcmipp_main_isp':1[fmt:RGB888_1X24/${SENSORWIDTH}x${SENSORHEIGHT} field:none]\""
    cmd "  media-ctl -d $DCMIPP_MEDIA --set-v4l2 \"'dcmipp_main_postproc':0[compose:(0,0)/${width}x${height}]\""
[...]

4.13. Take a picture[edit | edit source]

The IMX335 camera sensor does not support JPEG frame format natively, but you can use the hardware JPEG video encoder to encode a raw camera sensor frame to JPEG.

Capture a 5 MP YUV422 raw frame:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:YUYV8_2X8/2592x1940]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
v4l2-ctl -d $main_capture_dev --set-fmt-video=width=2592,height=1940,pixelformat=YUYV --stream-mmap --stream-count=1 --stream-skip=3 --stream-to=grab-2592x1940-yuyv.raw

Convert to JPEG using the hardware JPEG video encoder:

gst-launch-1.0 filesrc location= grab-2592x1940-yuyv.raw blocksize=10077696 ! "video/x-raw, format=YUY2, width=2592, height=1940, framerate=30/1, colorimetry=2:0:0:0" ! v4l2jpegenc ! filesink location=pic-5Mp.jpeg

Then display it:

weston-image pic-5Mp.jpeg

You can check the picture resolution using gst-typefind:

gst-typefind-1.0 pic-5Mp.jpeg
pic-5Mp.jpeg - image/jpeg, width=(int)2592, height=(int)1944, sof-marker=(int)0

4.14. Pictures streaming over network[edit | edit source]

Refer to the How to stream RAW camera over network article to get some examples on how to stream camera content over network.

4.15. Preview in YUV422[edit | edit source]

Capture VGA YUV422 frames and display them using GStreamer :

<
media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':2->'dcmipp_main_isp':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:YUYV8_2X8/640x480]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
gst-launch-1.0 v4l2src device=$main_capture_dev ! "video/x-raw, format=YUY2, width=640,height=480, framerate=(fraction)30/1" ! queue ! autovideosink

4.16. Grab a raw-bayer frame[edit | edit source]

To dump the raw-bayer frame output by camera sensor, the DCMIPP dump pipe can be used:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l "'dcmipp_input':1->'dcmipp_dump_postproc':0[1]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':1[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_dump_postproc':1[fmt:SRGGB10_1X10/2592x1940]"
export dump_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_dump_capture")
v4l2-ctl -d $dump_capture_dev --set-fmt-video=width=2592,height=1940,pixelformat=RG10 --stream-mmap --stream-count=1 --stream-to=grab-2592x1940-rggb10.raw

To display it, this raw-bayer frame must first be converted to JPEG:

gst-launch-1.0 filesrc location= grab-2592x1940-rggb10.raw blocksize=5028480 ! "video/x-bayer, format=(string)rggb, width=(int)2592, height=(int)1940, framerate=(fraction)30/1" ! bayer2rgb ! videoconvert ! jpegenc ! filesink location=grab-2592x1940-rggb10.jpeg

Then the weston-image utility can be used to display this JPEG file:

weston-image grab-2592x1940-rggb10.jpeg

4.17. Video record with preview[edit | edit source]

Configure camera subsystem setup to output 1080p YUV frames on main pipe to feed video encoder and VGA RGB565 frames on auxilliary pipe for preview on display:


media-ctl -r
media-ctl -d platform:48030000.dcmipp -l '"48020000.csi":1->"dcmipp_input":0[1]'
media-ctl -d platform:48030000.dcmipp -l '"dcmipp_input":2->"dcmipp_main_isp":0[1]'
media-ctl -d platform:48030000.dcmipp -l '"dcmipp_main_isp":1->"dcmipp_aux_postproc":0[1]'
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'48020000.csi':1[fmt:SRGGB10_1X10/2592x1940]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_input':2[fmt:SRGGB10_1X10/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/2592x1940 field:none]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/1920x1080]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_main_postproc':1[fmt:YUV8_1X24/1920x1080]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_aux_postproc':0[compose:(0,0)/640x480]"
media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_aux_postproc':1[fmt:RGB888_1X24/640x480]"
export main_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_main_capture")
export aux_capture_dev=$(media-ctl -d "platform:48030000.dcmipp" -e "dcmipp_aux_capture")

Start two GStreamer pipelines, one for 10s video recording on local file and another one for preview on display:


gst-launch-1.0 v4l2src device=$main_capture_dev ! video/x-raw, format=NV12, width=1920, height=1080, framerate=30/1 ! encodebin profile="video/x-vp8" ! matroskamux ! filesink location=v_vp8_hd_30fps.webm -e &
sleep 1
gst-launch-1.0 v4l2src device=$aux_capture_dev ! video/x-raw, format=RGB16, width=640, height=480, framerate=30/1 ! autovideosink > /dev/null 2>&1 &
sleep 10
killall gst-launch-1.0

Replay recorded content using gst-play utility:

gst-play-1.0 v_vp8_hd_30fps.webm --videosink="waylandsink fullscreen=true"


5. How to trace and debug[edit | edit source]

5.1. How to monitor[edit | edit source]

5.1.1. Check of device tree configuration[edit | edit source]

Here are some commands to verify that DCMIPP is enabled, check which camera sensor is used and log other details about device tree configuration:

cd ~ # go to $HOME directory
echo "#!/bin/bash" > dtdumpentry.sh;echo "hexdump -e '\"=\"'  -e '20/1 \"%c\"\"\t\"' -e '20/1 \"%02x\"\"\n\"' \$1" >> dtdumpentry.sh;chmod +x dtdumpentry.sh
echo "#!/bin/bash" > dtdump.sh;echo "find  \$1* -type f -print0 -exec ./dtdumpentry.sh {} \;" >> dtdump.sh;chmod +x dtdump.sh
cd ~ # go to $HOME directory
rm ~/devicetree.txt
echo "[devicetree]" >> ~/devicetree.txt
echo "|-[dcmipp]" >> devicetree.txt
./dtdump.sh /proc/device-tree/soc@0/bus@42080000/dcmipp@48030000 | sed 's/\/proc\/device-tree\/soc@0\/bus@42080000\//| |-/' >> devicetree.txt
echo "|" >> devicetree.txt
echo "|-[camera:" | tr -d "\n" >> devicetree.txt
cat /proc/device-tree/soc@0/bus@42080000/i2c@40130000/imx335@1a/compatible >> devicetree.txt
echo "]" >> devicetree.txt
./dtdump.sh /proc/device-tree/soc@0/bus@42080000/i2c@40130000/imx335@1a -type f -print0 -exec ./dtdump.sh {} \; | sed 's/\/proc\/device-tree\/soc@0\/bus@42080000\//| |-/' >> devicetree.txt
cat ~/devicetree.txt # or cat -t ~/devicetree.txt
[devicetree]
|-[dcmipp]
| |-dcmipp@48030000/power-domains=
                                  	0000000c                                
| |-dcmipp@48030000/clock-names=kclkmclk	6b636c6b006d636c6b00                    
| |-dcmipp@48030000/port/endpoint/remote-endpoint=T	00000054                                
| |-dcmipp@48030000/port/endpoint/bus-type=	00000004                                
| |-dcmipp@48030000/port/endpoint/phandle=S	00000053                                
| |-dcmipp@48030000/port/endpoint/name=endpoint	656e64706f696e7400                      
| |-dcmipp@48030000/port/name=port	706f727400                              
| |-dcmipp@48030000/resets=P	0000001600000050                        
| |-dcmipp@48030000/interrupts=�	00000000000000c600000004                
| |-dcmipp@48030000/clocks=�"	00000016000000d00000001600000122        
| |-dcmipp@48030000/compatible=st,stm32mp25-dcmipp	73742c73746d33326d7032352d64636d69707000
| |-dcmipp@48030000/status=okay	6f6b617900                              
| |-dcmipp@48030000/reg=H	4803000000001000                        
| |-dcmipp@48030000/phandle=)	00000129                                
| |-dcmipp@48030000/access-controllers=	0000001b00000057                        
| |-dcmipp@48030000/name=dcmipp	64636d69707000                          
|
|-[camera:sony,imx335]
| |-i2c@40130000/imx335@1a/avdd-supply=1	00000031                                
| |-i2c@40130000/imx335@1a/port/endpoint/data-lanes=	0000000100000002                        
| |-i2c@40130000/imx335@1a/port/endpoint/clock-lanes=	00000000                                
| |-i2c@40130000/imx335@1a/port/endpoint/remote-endpoint=5	00000035                                
| |-i2c@40130000/imx335@1a/port/endpoint/phandle=R	00000052                                
| |-i2c@40130000/imx335@1a/port/endpoint/link-frequencies=#g��	000000002367b880                        
| |-i2c@40130000/imx335@1a/port/endpoint/name=endpoint	656e64706f696e7400                      
| |-i2c@40130000/imx335@1a/port/name=port	706f727400                              
| |-i2c@40130000/imx335@1a/dvdd-supply=3	00000033                                
| |-i2c@40130000/imx335@1a/clocks=0	00000030                                
| |-i2c@40130000/imx335@1a/powerdown-gpios=4	000000340000000000000000                
| |-i2c@40130000/imx335@1a/reset-gpios=4	000000340000000700000000                
| |-i2c@40130000/imx335@1a/compatible=sony,imx335	736f6e792c696d7833333500                
| |-i2c@40130000/imx335@1a/status=okay	6f6b617900                              
| |-i2c@40130000/imx335@1a/ovdd-supply=2	00000032                                
| |-i2c@40130000/imx335@1a/reg=�	0000001a                                
| |-i2c@40130000/imx335@1a/phandle=�	000000dd                                
| |-i2c@40130000/imx335@1a/name=imx335	696d7833333500    

5.1.2. Camera subsystem configuration debugging[edit | edit source]

Refer to the section #Get the topology of camera subsystem for basics on how to get and set the camera subsystem configuration. Find below some debugging tips to help configuration handling.

5.1.2.1. Subdevice configuration syntax error[edit | edit source]

media-ctl utility returns an error when a configuration syntax mistake is made. Example here with an erroneous entity name:

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_dump_postpr':0[fmt:RGB565_2X8_LE/640x480]"
Unable to setup formats: Invalid argument (22)

To have details on the exact error, add the -v option:

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_dump_postpr':0[fmt:RGB565_2X8_LE/640x480]" -v
no such entity "dcmipp_dump_postpr"
'dcmipp_dump_postpr':0[fmt:RGB565_2X8_LE/640x480]
 ^

Another example with pad number mistake (only pad number 0 or 1 are allowed):

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_dump_postproc':4[fmt:RGB565_2X8_LE/640x480]" -v
No pad '4' on entity "dcmipp_dump_postproc". Maximum pad number is 1
 'dcmipp_dump_postproc':4[fmt:RGB565_2X8_LE/640x480]
 {{highlight|               

5.1.3. Camera subsystem configuration debugging[edit | edit source]

Refer to the section #Get the topology of camera subsystem for basics on how to get and set the camera subsystem configuration. Find below some debugging tips to help configuration handling.

5.1.3.1. Subdevice configuration syntax error[edit | edit source]

media-ctl utility returns an error when a configuration syntax mistake is made. Example here with an erroneous entity name:

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_dump_postpr':0[fmt:RGB565_2X8_LE/640x480]"
Unable to setup formats: Invalid argument (22)

To have details on the exact error, add the -v option:

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_dump_postpr':0[fmt:RGB565_2X8_LE/640x480]" -v
no such entity "dcmipp_dump_postpr"
'dcmipp_dump_postpr':0[fmt:RGB565_2X8_LE/640x480]
 ^

Another example with pad number mistake (only pad number 0 or 1 are allowed):

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_dump_postproc':4[fmt:RGB565_2X8_LE/640x480]" -v
No pad '4' on entity "dcmipp_dump_postproc". Maximum pad number is 1
 'dcmipp_dump_postproc':4[fmt:RGB565_2X8_LE/640x480]
                        ^

Example with format mistake (BA81 is a raw-bayer V4L2 pixel format while subdevice expects V4L2 mbus code such as SBGGR8_1X8):

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_dump_postproc':0[fmt:BA81/640x480]" -v
Invalid pixel code 'BA81'
 'dcmipp_dump_postproc':0[fmt:BA81/640x480]
                         ^
5.1.3.2. Subdevice negotiation[edit | edit source]

Requested configuration may not be fully accepted by the subdevice, in this case, the subdevice configures itself with the part of the configuration it can handle. The media-ctl -v option when setting configuration shows the effective subdevice configuration.

Warning white.png Warning
No error or warning is returned by media-ctl, so take care to read back configuration with --set-v4l2 with -v or --get-v4l2 to check if it is fully accepted. Several negotiation rounds may be needed to find a fully compatible configuration.


Here is an example with resolution negotiation (4000x4000 reduced to 2592x1944):

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'imx335 0-001a':0[fmt:SRGGB10_1X10/4000x4000]" -v
Setting up format SRGGB10_1X10 4000x4000 on pad imx335 0-001a/0/0
Format set: SRGGB10_1X10 1600x1200


Example with format negotiation (AYUV8_1X32 not supported, defaults to RGB565_2X8_LE):

media-ctl -d platform:48030000.dcmipp --set-v4l2 "'dcmipp_dump_postproc':0[fmt:AYUV8_1X32/640x480]" -v
Setting up format  AYUV8_1X32 640x480 on pad dcmipp_dump_postproc/0
Format set: RGB565_2X8_LE 640x480

5.2. How to trace[edit | edit source]

5.2.1. V4L2 userland API tracing[edit | edit source]

Tracing of V4L2 userland API[3] can be enabled using commands (video device number must be adjusted):


echo 0x3 > /sys/devices/platform/soc@0/42080000.bus/48030000.dcmipp/video4linux/video0/dev_debug
echo 0x3 > /sys/devices/platform/soc@0/42080000.bus/48030000.dcmipp/video4linux/video1/dev_debug
echo 0x3 > /sys/devices/platform/soc@0/42080000.bus/48030000.dcmipp/video4linux/video2/dev_debug
echo 0x3 > /sys/devices/platform/soc@0/42080000.bus/48030000.dcmipp/video4linux/video3/dev_debug
echo 0x3 > /sys/devices/platform/soc@0/42080000.bus/48030000.dcmipp/video4linux/video4/dev_debug

Traces are output in the kernel log buffer:

dmesg
[ 6792.553216] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6792.553291] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6792.553314] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6792.553378] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6792.553398] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6792.553423] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6792.553463] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6792.553488] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6792.628964] video3: VIDIOC_STREAMON: type=meta-cap
[ 6794.652333] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6794.652407] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6794.652430] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6794.652492] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6794.652512] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6794.652537] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6794.652578] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6794.652603] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6794.731598] video3: VIDIOC_STREAMON: type=meta-cap
[ 6796.755153] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6796.755228] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6796.755252] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6796.755314] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6796.755335] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6796.755360] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6796.755399] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6796.755424] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6796.829979] video3: VIDIOC_STREAMON: type=meta-cap
[ 6798.853142] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6798.853217] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6798.853241] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6798.853303] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6798.853324] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6798.853348] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6798.853388] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6798.853413] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6798.929892] video3: VIDIOC_STREAMON: type=meta-cap
[ 6800.953179] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6800.953256] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6800.953280] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6800.953339] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6800.953360] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6800.953385] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6800.953422] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6800.953448] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6801.029010] video3: VIDIOC_STREAMON: type=meta-cap
[ 6803.052299] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6803.052379] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6803.052403] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6803.052464] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6803.052484] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6803.052509] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6803.052550] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6803.052575] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6803.129992] video3: VIDIOC_STREAMON: type=meta-cap
[ 6805.153551] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6805.153627] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6805.153650] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6805.153713] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6805.153734] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6805.153759] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6805.153798] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6805.153823] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6805.229465] video3: VIDIOC_STREAMON: type=meta-cap
[ 6807.253213] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6807.253290] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6807.253314] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6807.253374] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6807.253395] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6807.253420] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6807.253462] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6807.253488] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6807.329788] video3: VIDIOC_STREAMON: type=meta-cap
[ 6809.353330] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6809.353418] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6809.353446] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6809.353516] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6809.353540] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6809.353571] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6809.353617] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6809.353649] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6809.429740] video3: VIDIOC_STREAMON: type=meta-cap
[ 6811.452775] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6811.452850] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6811.452875] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6811.452936] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6811.452956] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6811.452981] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6811.453018] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6811.453044] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6811.529944] video3: VIDIOC_STREAMON: type=meta-cap
[ 6813.552902] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6813.552978] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6813.553001] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6813.553063] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6813.553083] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6813.553108] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6813.553149] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6813.553174] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6813.628612] video3: VIDIOC_STREAMON: type=meta-cap
[ 6815.651969] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=65535, name=ISP Stat Location, id/val=0x9f090b/0x0
[ 6815.652045] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6815.652068] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6815.652128] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6815.652149] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=
60
[ 6815.652174] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6815.652214] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=
60
[ 6815.652239] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6815.731233] video3: VIDIOC_STREAMON: type=meta-cap
[ 6816.637563] video2: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_bytecap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85200001, device_caps=0x05200001
[ 6816.637865] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_pixelcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85200001, device_caps=0x05200001
[ 6816.638158] video4: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_pixelcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85200001, device_caps=0x05200001
[ 6816.638525] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6816.920651] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_pixelcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85200001, device_caps=0x05200001
[ 6816.920755] video3: VIDIOC_ENUMINPUT: error -25: index=0, name=, type=0, audioset=0x0, tuner=0, std=0x00000000, status=0x0, capabilities=0x0
[ 6816.920783] video3: VIDIOC_ENUMSTD: error -25: index=0, id=0x0, name=, fps=0/0, framelines=0
[ 6816.920803] video3: VIDIOC_QUERYCTRL: error -25: id=0x80000000, type=0, name=, min/max=0/0, step=0, default=0, flags=0x00000000
[ 6816.920825] video3: VIDIOC_QUERYCTRL: error -25: id=0x980900, type=0, name=, min/max=0/0, step=0, default=0, flags=0x00000000
[ 6816.920846] video3: VIDIOC_QUERYCTRL: error -25: id=0x8000000, type=0, name=, min/max=0/0, step=0, default=0, flags=0x00000000
[ 6816.920873] video3: VIDIOC_G_STD: error -25: std=0x00000000
[ 6816.920891] video3: VIDIOC_G_INPUT: error -25: value=0
[ 6816.929786] video3: VIDIOC_G_INPUT: error -25: value=0
[ 6816.929827] video3: VIDIOC_G_SELECTION: error -25: type=vid-cap, target=2, flags=0x0, wxh=0x0, x,y=0,0
[ 6816.929851] video3: VIDIOC_CROPCAP: error -25: type=0, bounds wxh=0x0, x,y=0,0, defrect wxh=0x0, x,y=0,0, pixelaspect 0/0
[ 6816.933127] video3: VIDIOC_ENUM_FMT: index=0, type=vid-cap, flags=0x0, pixelformat=RGBP little-endian (0x50424752), mbus_code=0x0000, description='16-bit RGB 5-6-5'
[ 6816.933177] video3: VIDIOC_ENUM_FMT: index=1, type=vid-cap, flags=0x0, pixelformat=YUYV little-endian (0x56595559), mbus_code=0x0000, description='YUYV 4:2:2'
[ 6816.933202] video3: VIDIOC_ENUM_FMT: index=2, type=vid-cap, flags=0x0, pixelformat=YVYU little-endian (0x55595659), mbus_code=0x0000, description='YVYU 4:2:2'
[ 6816.933224] video3: VIDIOC_ENUM_FMT: index=3, type=vid-cap, flags=0x0, pixelformat=UYVY little-endian (0x59565955), mbus_code=0x0000, description='UYVY 4:2:2'
[ 6816.933245] video3: VIDIOC_ENUM_FMT: index=4, type=vid-cap, flags=0x0, pixelformat=VYUY little-endian (0x59555956), mbus_code=0x0000, description='VYUY 4:2:2'
[ 6816.933266] video3: VIDIOC_ENUM_FMT: index=5, type=vid-cap, flags=0x0, pixelformat=GREY little-endian (0x59455247), mbus_code=0x0000, description='8-bit Greyscale'
[ 6816.933288] video3: VIDIOC_ENUM_FMT: index=6, type=vid-cap, flags=0x0, pixelformat=RGB3 little-endian (0x33424752), mbus_code=0x0000, description='24-bit RGB 8-8-8'
[ 6816.933310] video3: VIDIOC_ENUM_FMT: index=7, type=vid-cap, flags=0x0, pixelformat=BA24 little-endian (0x34324142), mbus_code=0x0000, description='32-bit ARGB 8-8-8-8'
[ 6816.933332] video3: VIDIOC_ENUM_FMT: index=8, type=vid-cap, flags=0x0, pixelformat=AYUV little-endian (0x56555941), mbus_code=0x0000, description='32-bit AYUV 8-8-8-8'
[ 6816.933355] video3: VIDIOC_ENUM_FMT: index=9, type=vid-cap, flags=0x0, pixelformat=NV12 little-endian (0x3231564e), mbus_code=0x0000, description='Y/UV 4:2:0'
[ 6816.933377] video3: VIDIOC_ENUM_FMT: index=10, type=vid-cap, flags=0x0, pixelformat=NV21 little-endian (0x3132564e), mbus_code=0x0000, description='Y/VU 4:2:0'
[ 6816.933400] video3: VIDIOC_ENUM_FMT: index=11, type=vid-cap, flags=0x0, pixelformat=NV16 little-endian (0x3631564e), mbus_code=0x0000, description='Y/UV 4:2:2'
[ 6816.933423] video3: VIDIOC_ENUM_FMT: index=12, type=vid-cap, flags=0x0, pixelformat=NV61 little-endian (0x3136564e), mbus_code=0x0000, description='Y/VU 4:2:2'
[ 6816.933446] video3: VIDIOC_ENUM_FMT: index=13, type=vid-cap, flags=0x0, pixelformat=YU12 little-endian (0x32315559), mbus_code=0x0000, description='Planar YUV 4:2:0'
[ 6816.933468] video3: VIDIOC_ENUM_FMT: index=14, type=vid-cap, flags=0x0, pixelformat=YV12 little-endian (0x32315659), mbus_code=0x0000, description='Planar YVU 4:2:0'
[ 6816.933489] video3: VIDIOC_ENUM_FMT: error -22: index=15, type=vid-cap, flags=0x0, pixelformat=.... little-endian (0x00000000), mbus_code=0x0000, description=''
[ 6816.933518] video3: VIDIOC_CROPCAP: error -25: type=vid-cap, bounds wxh=0x0, x,y=0,0, defrect wxh=0x0, x,y=0,0, pixelaspect 0/0
[ 6816.933559] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=YUYV little-endian (0x56595559), type=2
[ 6816.933581] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=YUYV little-endian (0x56595559), wxh=16x16, type=0
[ 6816.933696] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=UYVY little-endian (0x59565955), type=2
[ 6816.933719] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=UYVY little-endian (0x59565955), wxh=16x16, type=0
[ 6816.933774] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=NV12 little-endian (0x3231564e), type=2
[ 6816.933795] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=NV12 little-endian (0x3231564e), wxh=16x16, type=0
[ 6816.933848] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=YU12 little-endian (0x32315559), type=2
[ 6816.933869] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=YU12 little-endian (0x32315559), wxh=16x16, type=0
[ 6816.933918] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=YV12 little-endian (0x32315659), type=2
[ 6816.933939] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=YV12 little-endian (0x32315659), wxh=16x16, type=0
[ 6816.934006] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=BA24 little-endian (0x34324142), type=2
[ 6816.934027] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=BA24 little-endian (0x34324142), wxh=16x16, type=0
[ 6816.934077] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=RGB3 little-endian (0x33424752), type=2
[ 6816.934098] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=RGB3 little-endian (0x33424752), wxh=16x16, type=0
[ 6816.934147] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=NV61 little-endian (0x3136564e), type=2
[ 6816.934168] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=NV61 little-endian (0x3136564e), wxh=16x16, type=0
[ 6816.934217] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=NV16 little-endian (0x3631564e), type=2
[ 6816.943391] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=NV16 little-endian (0x3631564e), wxh=16x16, type=0
[ 6816.943582] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=NV21 little-endian (0x3132564e), type=2
[ 6816.943606] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=NV21 little-endian (0x3132564e), wxh=16x16, type=0
[ 6816.943659] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=RGBP little-endian (0x50424752), type=2
[ 6816.943680] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=RGBP little-endian (0x50424752), wxh=16x16, type=0
[ 6816.943753] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=GREY little-endian (0x59455247), type=2
[ 6816.943775] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=GREY little-endian (0x59455247), wxh=16x16, type=0
[ 6816.943826] video3: VIDIOC_ENUM_FRAMESIZES: index=0, pixelformat=YVYU little-endian (0x55595659), type=2
[ 6816.943847] video3: VIDIOC_ENUM_FRAMEINTERVALS: error -25: index=0, pixelformat=YVYU little-endian (0x55595659), wxh=16x16, type=0
[ 6816.944287] video3: VIDIOC_TRY_FMT: type=vid-cap, width=640, height=480, pixelformat=RGBP little-endian (0x50424752), field=none, bytesperline=1280, sizeimage=614400, colorspace=8, flags=0x0, ycbc
r_enc=0, quantization=1, xfer_func=2
[ 6816.950801] video3: VIDIOC_G_SELECTION: error -25: type=vid-cap, target=1, flags=0x0, wxh=0x0, x,y=0,0
[ 6816.950845] video3: VIDIOC_CROPCAP: error -25: type=0, bounds wxh=0x0, x,y=0,0, defrect wxh=0x0, x,y=0,0, pixelaspect 0/0
[ 6816.950929] video3: VIDIOC_S_FMT: type=vid-cap, width=640, height=480, pixelformat=RGBP little-endian (0x50424752), field=none, bytesperline=1280, sizeimage=614400, colorspace=8, flags=0x0, ycbcr_
enc=0, quantization=1, xfer_func=2
[ 6816.950980] video3: VIDIOC_G_PARM: error -25: type=vid-cap, capability=0x0, capturemode=0x0, timeperframe=0/0, extendedmode=0, readbuffers=0
[ 6816.951010] video3: VIDIOC_G_SELECTION: error -25: type=vid-cap, target=257, flags=0x0, wxh=0x0, x,y=0,0
[ 6816.951033] video3: VIDIOC_EXPBUF: error -22: fd=0, type=vid-cap, index=4294967295, plane=4294967295, flags=0x00080002
[ 6816.951055] video3: VIDIOC_G_CTRL: error -25: name=Min Number of Capture Buffers, id=0x980927, value=0
[ 6816.951490] video3: VIDIOC_REQBUFS: count=0, type=vid-cap, memory=mmap
[ 6816.951516] video3: VIDIOC_CREATE_BUFS: index=0, count=0, memory=mmap, capabilities=0x00000015, type=vid-cap, width=640, height=480, pixelformat=RGBP little-endian (0x50424752), field=none, bytesp
erline=1280, sizeimage=614400, colorspace=8, flags=0x0, ycbcr_enc=0, quantization=1, xfer_func=2
[ 6816.951552] video3: VIDIOC_REQBUFS: error -22: count=0, type=vid-cap, memory=userptr
[ 6816.951571] video3: VIDIOC_REQBUFS: count=0, type=vid-cap, memory=dmabuf
[ 6816.951587] video3: VIDIOC_CREATE_BUFS: index=0, count=0, memory=dmabuf, capabilities=0x00000015, type=vid-cap, width=640, height=480, pixelformat=RGBP little-endian (0x50424752), field=none, byte
sperline=1280, sizeimage=614400, colorspace=8, flags=0x0, ycbcr_enc=0, quantization=1, xfer_func=2
[ 6816.951749] video3: VIDIOC_G_INPUT: error -25: value=0
[ 6816.951770] video3: VIDIOC_SUBSCRIBE_EVENT: error -25: type=0x5, id=0x0, flags=0x0
[ 6816.951804] video3: VIDIOC_G_CTRL: error -25: name=Min Number of Capture Buffers, id=0x980927, value=0
[ 6816.955377] video3: VIDIOC_REQBUFS: count=4, type=vid-cap, memory=mmap
[ 6816.955436] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=vid-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x0, length=614400
[ 6816.955462] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6816.955477] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=vid-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x96000, length=614400
[ 6816.955501] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6816.955512] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=2, type=vid-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x12c000, length=614400
[ 6816.955536] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6816.955547] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=3, type=vid-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0x1c2000, length=614400
[ 6816.955571] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6816.955669] video3: VIDIOC_EXPBUF: fd=16, type=vid-cap, index=0, plane=0, flags=0x00080002
[ 6816.955833] video3: VIDIOC_EXPBUF: fd=17, type=vid-cap, index=1, plane=0, flags=0x00080002
[ 6816.955884] video3: VIDIOC_EXPBUF: fd=18, type=vid-cap, index=2, plane=0, flags=0x00080002
[ 6816.955930] video3: VIDIOC_EXPBUF: fd=22, type=vid-cap, index=3, plane=0, flags=0x00080002
[ 6816.956006] video3: VIDIOC_STREAMON: type=vid-cap
[ 6817.188158] video3: VIDIOC_STREAMOFF: type=meta-cap
[ 6817.188442] video3: VIDIOC_S_EXT_CTRLS: which=0x9f0000, count=1, error_idx=0, request_fd=0, name=ISP Stat Location, id/val=0x9f090b/0x1
[ 6817.188523] video3: VIDIOC_QUERYCAP: driver=dcmipp, card=dcmipp_statcap, bus=platform:dcmipp, version=0x0006011c, capabilities=0x85a00000, device_caps=0x05a00000
[ 6817.188553] video3: VIDIOC_G_FMT: type=meta-cap, dataformat=STIS little-endian (0x53495453), buffersize=60
[ 6817.188618] video3: VIDIOC_REQBUFS: count=2, type=meta-cap, memory=mmap
[ 6817.188641] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=0, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00000000, length=60
[ 6817.188672] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
[ 6817.188725] video3: VIDIOC_QUERYBUF: 00:00:00.000000 index=1, type=meta-cap, request_fd=0, flags=0x00002000, field=any, sequence=0, memory=mmap, bytesused=0, offset/userptr=0xffff00001000, length=60
[ 6817.188757] timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000

5.2.2. V4L2 core framework tracing[edit | edit source]

Tracing of the V4L2 core framework[4] can be enabled using commands:


echo 0x3 > /sys/module/videobuf2_common/parameters/debug
echo 0x3 > /sys/module/videobuf2_v4l2/parameters/debug

Traces are output in the kernel log buffer:

dmesg
[ 1218.626235] videobuf2_common: [cap-7b50f8bf] __setup_offsets: buffer 0, plane 0 offset 0x00000000
[ 1218.642445] videobuf2_common: [cap-7b50f8bf] __setup_offsets: buffer 1, plane 0 offset 0x004d4000
[ 1218.656398] videobuf2_common: [cap-7b50f8bf] __setup_offsets: buffer 2, plane 0 offset 0x009a8000
[ 1218.669843] videobuf2_common: [cap-7b50f8bf] __setup_offsets: buffer 3, plane 0 offset 0x00e7c000
[ 1218.677503] videobuf2_common: [cap-7b50f8bf] __vb2_queue_alloc: allocated 4 buffers, 1 plane(s) each
[ 1218.688361] videobuf2_common: [cap-7b50f8bf] vb2_mmap: buffer 0, plane 0 successfully mapped
[ 1218.696744] videobuf2_common: [cap-7b50f8bf] vb2_mmap: buffer 1, plane 0 successfully mapped
[ 1218.705291] videobuf2_common: [cap-7b50f8bf] vb2_mmap: buffer 2, plane 0 successfully mapped
[ 1218.712487] videobuf2_common: [cap-7b50f8bf] vb2_mmap: buffer 3, plane 0 successfully mapped
[ 1218.722474] videobuf2_common: [cap-7b50f8bf] vb2_core_qbuf: qbuf of buffer 0 succeeded
[ 1218.730528] videobuf2_common: [cap-7b50f8bf] vb2_core_qbuf: qbuf of buffer 1 succeeded
[ 1218.738153] videobuf2_common: [cap-7b50f8bf] vb2_core_qbuf: qbuf of buffer 2 succeeded
[ 1218.746012] videobuf2_common: [cap-7b50f8bf] vb2_core_qbuf: qbuf of buffer 3 succeeded
[ 1218.756237] videobuf2_common: [cap-7b50f8bf] vb2_core_streamon: successful
[ 1218.761969] videobuf2_common: [cap-7b50f8bf] __vb2_wait_for_done_vb: will sleep waiting for buffers
[ 1218.822167] videobuf2_common: [cap-7b50f8bf] vb2_core_dqbuf: returning done buffer
[ 1218.828383] videobuf2_common: [cap-7b50f8bf] vb2_core_dqbuf: dqbuf of buffer 0, state: dequeued
[ 1218.838812] videobuf2_common: [cap-7b50f8bf] vb2_core_qbuf: qbuf of buffer 0 succeeded
[ 1218.846549] videobuf2_common: [cap-7b50f8bf] __vb2_wait_for_done_vb: will sleep waiting for buffers
[ 1218.855624] videobuf2_common: [cap-7b50f8bf] vb2_core_dqbuf: returning done buffer
[ 1218.862118] videobuf2_common: [cap-7b50f8bf] vb2_core_dqbuf: dqbuf of buffer 1, state: dequeued
[ 1218.872406] videobuf2_common: [cap-7b50f8bf] vb2_core_qbuf: qbuf of buffer 1 succeeded
[ 1218.880029] videobuf2_common: [cap-7b50f8bf] __vb2_wait_for_done_vb: will sleep waiting for buffers
[ 1218.889460] videobuf2_common: [cap-7b50f8bf] vb2_core_dqbuf: returning done buffer
[ 1218.896756] videobuf2_common: [cap-7b50f8bf] vb2_core_dqbuf: dqbuf of buffer 2, state: dequeued
[ 1218.905383] videobuf2_common: [cap-7b50f8bf] vb2_core_qbuf: qbuf of buffer 2 succeeded
[ 1218.912309] videobuf2_common: [cap-7b50f8bf] __vb2_wait_for_done_vb: will sleep waiting for buffers
[ 1218.923080] videobuf2_common: [cap-7b50f8bf] vb2_core_dqbuf: returning done buffer
[ 1218.930392] videobuf2_common: [cap-7b50f8bf] vb2_core_dqbuf: dqbuf of buffer 3, state: dequeued
[ 1218.944499] videobuf2_common: [cap-7b50f8bf] vb2_core_qbuf: qbuf of buffer 3 succeeded
[ 1218.952210] videobuf2_common: [cap-7b50f8bf] vb2_core_streamoff: successful
[ 1218.959921] videobuf2_common: [cap-7b50f8bf] vb2_core_streamoff: successful
[ 1218.968800] videobuf2_common: [cap-7b50f8bf] __vb2_buf_mem_free: freed plane 0 of buffer 0
[ 1218.978419] videobuf2_common: [cap-7b50f8bf] __vb2_buf_mem_free: freed plane 0 of buffer 1
[ 1218.988204] videobuf2_common: [cap-7b50f8bf] __vb2_buf_mem_free: freed plane 0 of buffer 2
[ 1218.997501] videobuf2_common: [cap-7b50f8bf] __vb2_buf_mem_free: freed plane 0 of buffer 3

5.2.3. DCMIPP V4L2 kernel driver tracing[edit | edit source]

DCMIPP dynamic debug traces[8] can be enabled using commands:


echo "module stm32_csi +p" > /sys/kernel/debug/dynamic_debug/control
echo "module stm32_dcmipp +p" > /sys/kernel/debug/dynamic_debug/control

Here is an example of a preview:

dmesg
[  665.991413] dcmipp 48030000.dcmipp: dcmipp_input: format update: old:640x480 (0x1008, 3, 0, 0, 0) new:2592x1940 (0x3012, 11, 0, 0, 0)
[  665.991470] dcmipp 48030000.dcmipp: dcmipp_input: format update: old:2592x1940 (0x3012, 11, 0, 0, 0) new:2592x1940 (0x3012, 11, 0, 0, 0)
[  665.991497] dcmipp 48030000.dcmipp: dcmipp_main_isp: source format update: new:2592x1940 (0x100a, 11, 0, 0, 0)
[  665.991510] dcmipp 48030000.dcmipp: dcmipp_main_isp: sink format update: old:640x480 (0x1008, 3, 0, 0, 0) new:2592x1940 (0x3012, 11, 0, 0, 0)
[  665.991533] dcmipp 48030000.dcmipp: s_selection: compose 2592x1940@(0,0)
[  665.991564] dcmipp 48030000.dcmipp: dcmipp_main_postproc: source format update: new:2592x1940 (0x100a, 11, 0, 0, 0)
[  665.991577] dcmipp 48030000.dcmipp: dcmipp_main_postproc: sink format update: old:640x480 (0x100a, 3, 0, 0, 0) new:2592x1940 (0x100a, 11, 0, 0
, 0)
[  665.991601] dcmipp 48030000.dcmipp: dcmipp_main_postproc: src format update: old:2592x1940 (0x100a, 11, 0, 0, 0) new:2592x1940 (0x100a, 11, 0,
 0, 0)
[  665.991621] dcmipp 48030000.dcmipp: s_selection: compose 640x480@(0,0)
[  665.991694] dcmipp 48030000.dcmipp: dcmipp_main_capture: format update: old:640x480 (0x50424752, 3, 0, 0, 0) new:640x480 (0x50424752, 3, 0, 0,
 0)
[  665.991749] dcmipp 48030000.dcmipp: >> dcmipp_statcap_s_ctrl: ctrl->id = 0x9f090a
[  665.995723] dcmipp 48030000.dcmipp: Setup queue, count=4, size=614400
[  666.000467] dcmipp 48030000.dcmipp: Setup queue, count=4, size=614400
[  666.001523] dcmipp 48030000.dcmipp: buffer[0] phy=0x00000000f2400000 size=614400
[  666.001551] dcmipp 48030000.dcmipp: Queue [0] 0000000009d7285e phy=0x00000000f2400000
[  666.001743] dcmipp 48030000.dcmipp: CLR 0x900 0x00000003
[  666.001754] dcmipp 48030000.dcmipp: WR 0x900 0x00000000
[  666.001762] dcmipp 48030000.dcmipp: SET 0x900 0x00000000
[  666.001771] dcmipp 48030000.dcmipp: WR 0x900 0x00000000
[  666.001778] dcmipp 48030000.dcmipp: WR 0x904 0x00000000
[  666.001786] dcmipp 48030000.dcmipp: WR 0x908 0x87940a20
[  666.001794] dcmipp 48030000.dcmipp: dcmipp_main_postproc: decimation config: hdec: 0x0, vdec: 0x0
[  666.001803] dcmipp 48030000.dcmipp: dcmipp_main_postproc: downsize config: hratio: 0x8199, vratio: 0x8155, hdiv: 0xfc, vdiv: 0xfd
[  666.001813] dcmipp 48030000.dcmipp: CLR 0x90c 0x00000001
[  666.001821] dcmipp 48030000.dcmipp: WR 0x90c 0x00000000
[  666.001829] dcmipp 48030000.dcmipp: CLR 0x910 0x80000000
[  666.001837] dcmipp 48030000.dcmipp: WR 0x910 0x00000000
[  666.001845] dcmipp 48030000.dcmipp: WR 0x914 0x81558199
[  666.001852] dcmipp 48030000.dcmipp: WR 0x918 0x01e00280
[  666.001860] dcmipp 48030000.dcmipp: WR 0x910 0x80fd00fc
[  666.001868] dcmipp 48030000.dcmipp: WR 0x980 0x00000000
[  666.001879] dcmipp 48030000.dcmipp: WR 0x970 0x00000001
[  666.001891] dcmipp 48030000.dcmipp: SET 0x804 0x00040000
[  666.001899] dcmipp 48030000.dcmipp: WR 0x804 0x00040000
[  666.001907] dcmipp 48030000.dcmipp: WR 0x820 0x00008794
[  666.001915] dcmipp 48030000.dcmipp: dcmipp_isp_config_decimation: config decr: 0x0
[  666.001923] dcmipp 48030000.dcmipp: WR 0x830 0x00000000
[  666.001931] dcmipp 48030000.dcmipp: CLR 0x870 0x00000007
[  666.001938] dcmipp 48030000.dcmipp: WR 0x870 0x00000000
[  666.001946] dcmipp 48030000.dcmipp: Input is RawBayer, enable Demosaicing
[  666.001952] dcmipp 48030000.dcmipp: SET 0x870 0x00000001
[  666.001960] dcmipp 48030000.dcmipp: WR 0x870 0x00000001
[  666.001974] dcmipp 48030000.dcmipp: CLR 0x404 0x0003003f
[  666.001982] dcmipp 48030000.dcmipp: WR 0x404 0x00000000
[  666.001991] dcmipp 48030000.dcmipp: SET 0x404 0x0000002c
[  666.001998] dcmipp 48030000.dcmipp: WR 0x404 0x0000002c
[  666.002007] dcmipp 48030000.dcmipp: CLR 0x804 0x0003003f
[  666.002015] dcmipp 48030000.dcmipp: WR 0x804 0x00040000
[  666.002023] dcmipp 48030000.dcmipp: SET 0x804 0x0000002c
[  666.002030] dcmipp 48030000.dcmipp: WR 0x804 0x0004002c
[  666.002039] dcmipp 48030000.dcmipp: Skip disabled pipe 2
[  666.002045] dcmipp 48030000.dcmipp: WR 0x204 0x00000001
[  666.002055] stm32-csi 48020000.csi: Starting the CSI2
[  666.002069] stm32-csi 48020000.csi: Computed Mbps: 1188
[  666.002077] stm32-csi 48020000.csi: PHY settings: (1200 Mbps, 11 HS FRange, 460 OSC Freq)
[  666.005241] stm32-csi 48020000.csi: VC0: enable DT0(0x2c)/DT0FT(0x4)
[  666.044394] dcmipp 48030000.dcmipp: WR 0x9c0 0x00000001
[  666.044419] dcmipp 48030000.dcmipp: SET 0x3f0 0x00860000
[  666.044427] dcmipp 48030000.dcmipp: WR 0x3f0 0x00860000
[  666.044435] dcmipp 48030000.dcmipp: SET 0x804 0x80000000
[  666.044442] dcmipp 48030000.dcmipp: WR 0x804 0x8004002c
[  666.044451] dcmipp 48030000.dcmipp: Start with next [0] 0000000009d7285e phy=0x00000000f2400000
[  666.044463] dcmipp 48030000.dcmipp: WR 0x9c4 0xf2400000
[  666.044471] dcmipp 48030000.dcmipp: WR 0x9cc 0x00000500
[  666.044479] dcmipp 48030000.dcmipp: SET 0x900 0x00000008
[  666.044487] dcmipp 48030000.dcmipp: WR 0x900 0x00000008
[  666.044692] dcmipp 48030000.dcmipp: buffer[1] phy=0x00000000f2500000 size=614400
[  666.044707] dcmipp 48030000.dcmipp: Queue [1] 000000008696e211 phy=0x00000000f2500000
[  666.044778] dcmipp 48030000.dcmipp: buffer[2] phy=0x00000000f2600000 size=614400
[  666.044789] dcmipp 48030000.dcmipp: Queue [2] 000000000e1a8c96 phy=0x00000000f2600000
[  666.044850] dcmipp 48030000.dcmipp: buffer[3] phy=0x00000000f2700000 size=614400
[  666.044863] dcmipp 48030000.dcmipp: Queue [3] 00000000d78f7bd6 phy=0x00000000f2700000
[  666.046990] dcmipp 48030000.dcmipp: >> dcmipp_statcap_s_ctrl: ctrl->id = 0x9f090e
[  666.047017] dcmipp 48030000.dcmipp: >> dcmipp_statcap_s_ctrl: ctrl->id = 0x9f090a
[  666.047031] dcmipp 48030000.dcmipp: CLR 0x85c 0x0fff0fff
[  666.047040] dcmipp 48030000.dcmipp: WR 0x85c 0x00000000
[  666.047048] dcmipp 48030000.dcmipp: SET 0x85c 0x028801e6
[  666.047057] dcmipp 48030000.dcmipp: WR 0x85c 0x028801e6
[  666.047065] dcmipp 48030000.dcmipp: CLR 0x860 0x0fff0fff
[  666.047073] dcmipp 48030000.dcmipp: WR 0x860 0x00000000
[  666.047080] dcmipp 48030000.dcmipp: SET 0x860 0x83cc0510
[  666.047088] dcmipp 48030000.dcmipp: WR 0x860 0x83cc0510
[  666.069186] dcmipp 48030000.dcmipp: RD 0x3f8 0x00040000
[  666.069213] dcmipp 48030000.dcmipp: WR 0x3fc 0x00040000
[  666.069265] dcmipp 48030000.dcmipp: WR 0x9c4 0xf2500000
[  666.069275] dcmipp 48030000.dcmipp: Write [1] 000000008696e211 phy=0x00000000f2500000
[  666.069290] dcmipp 48030000.dcmipp: RD 0x828 0x00000000
[  666.069298] dcmipp 48030000.dcmipp: WR 0x850 0x00000041
[  666.069306] dcmipp 48030000.dcmipp: WR 0x854 0x00000051
[  666.069313] dcmipp 48030000.dcmipp: WR 0x858 0x00000061
[  666.069326] dcmipp 48030000.dcmipp: WR 0x824 0x00000007
[  666.069334] dcmipp 48030000.dcmipp: WR 0x840 0x0c0c0c01
[  666.069342] dcmipp 48030000.dcmipp: WR 0x844 0x18c00001
[  666.069350] dcmipp 48030000.dcmipp: WR 0x848 0x08000e60
[  666.069358] dcmipp 48030000.dcmipp: RD 0x870 0x00000001
[  666.069366] dcmipp 48030000.dcmipp: WR 0x870 0x64420001
[  666.069374] dcmipp 48030000.dcmipp: WR 0x880 0x00000001
[  666.069382] dcmipp 48030000.dcmipp: WR 0x884 0x075b01cd
[  666.069389] dcmipp 48030000.dcmipp: WR 0x888 0x000007da
[  666.069397] dcmipp 48030000.dcmipp: WR 0x88c 0x01b207a5
[  666.069405] dcmipp 48030000.dcmipp: WR 0x890 0x000007a8
[  666.069412] dcmipp 48030000.dcmipp: WR 0x894 0x070c0019
[  666.069420] dcmipp 48030000.dcmipp: WR 0x898 0x000001dc
[  666.069427] dcmipp 48030000.dcmipp: WR 0x8a0 0x00002001
[  666.069435] dcmipp 48030000.dcmipp: WR 0x8a4 0x20202020
[  666.069443] dcmipp 48030000.dcmipp: WR 0x8a8 0x20202020
[  666.098261] dcmipp 48030000.dcmipp: RD 0x3f8 0x00030000
[  666.098292] dcmipp 48030000.dcmipp: WR 0x3fc 0x00020000
[  666.098333] dcmipp 48030000.dcmipp: Done  [0] 0000000009d7285e phy=0x00000000f2400000
[  666.102597] dcmipp 48030000.dcmipp: RD 0x3f8 0x00050000
[  666.102625] dcmipp 48030000.dcmipp: WR 0x3fc 0x00040000
[  666.102673] dcmipp 48030000.dcmipp: WR 0x9c4 0xf2600000
[  666.102683] dcmipp 48030000.dcmipp: Write [2] 000000000e1a8c96 phy=0x00000000f2600000
[  666.102697] dcmipp 48030000.dcmipp: RD 0x828 0x00000000
[  666.131602] dcmipp 48030000.dcmipp: RD 0x3f8 0x00030000
[  666.131635] dcmipp 48030000.dcmipp: WR 0x3fc 0x00020000
[  666.131687] dcmipp 48030000.dcmipp: Done  [1] 000000008696e211 phy=0x00000000f2500000
[  666.135862] dcmipp 48030000.dcmipp: RD 0x3f8 0x00050000
[  666.135896] dcmipp 48030000.dcmipp: WR 0x3fc 0x00040000
[  666.135945] dcmipp 48030000.dcmipp: WR 0x9c4 0xf2700000
[  666.135956] dcmipp 48030000.dcmipp: Write [3] 00000000d78f7bd6 phy=0x00000000f2700000
[  666.135971] dcmipp 48030000.dcmipp: RD 0x828 0x00000002
[  666.135980] dcmipp 48030000.dcmipp: RD 0x864 0x000122e9
[  666.135988] dcmipp 48030000.dcmipp: RD 0x868 0x00011722
[  666.135996] dcmipp 48030000.dcmipp: RD 0x86c 0x000119bc
[  666.164934] dcmipp 48030000.dcmipp: RD 0x3f8 0x00030000
[  666.164966] dcmipp 48030000.dcmipp: WR 0x3fc 0x00020000
[  666.165010] dcmipp 48030000.dcmipp: Done  [2] 000000000e1a8c96 phy=0x00000000f2600000
[  666.169180] dcmipp 48030000.dcmipp: RD 0x3f8 0x00050000
[  666.169198] dcmipp 48030000.dcmipp: WR 0x3fc 0x00040000
[  666.169230] dcmipp 48030000.dcmipp: CLR 0x900 0x00000008
[  666.169239] dcmipp 48030000.dcmipp: WR 0x900 0x00000000

5.3. How to debug[edit | edit source]

5.3.1. Errors[edit | edit source]

Errors are unconditionally traced in the kernel log:

dmesg
[ 1947.932915] dcmipp-bytecap dcmipp-bytecap.3.auto: Stop streaming, errors=1 (overrun=0, limit=0), vsync=2, frame=2, buffers=2, it=4


5.3.2. Memory tracking[edit | edit source]

Frames require large chunks of contiguous memory. They are allocated by V4L2 framework through the DMA back-end. Those allocations can be traced using:


echo "module dma_contiguous +p" > /sys/kernel/debug/dynamic_debug/control
echo "module videobuf2_dma_contig +p" > /sys/kernel/debug/dynamic_debug/control

Here is the trace after a VGA YUV422 capture.

[11311.617688] vb2_dc_mmap: mapped dma addr 0xf1900000 at 0xb3b6a000, size 614400
[11311.617986] vb2_dc_mmap: mapped dma addr 0xf1a00000 at 0xb3ad4000, size 614400
[11311.618071] vb2_dc_mmap: mapped dma addr 0xf1b00000 at 0xb3a3e000, size 614400
[11311.764146] vb2_dc_mmap: mapped dma addr 0xf1c00000 at 0xb307c000, size 614400

Four frames of VGA YUV422 frames: 640x480x2=614400 bytes

6. Source code location[edit | edit source]

6.1. User space[edit | edit source]

6.2. Kernel space[edit | edit source]

7. References[edit | edit source]