7.17. Raspberry Pi PiSP Camera Front End (rp1-cfe)

7.17.1. The PiSP Camera Front End

The PiSP Camera Front End (CFE) is a module which combines a CSI-2 receiver with a simple ISP, called the Front End (FE).

The CFE has four DMA engines and can write frames from four separate streams received from the CSI-2 to the memory. One of those streams can also be routed directly to the FE, which can do minimal image processing, write two versions (e.g. non-scaled and downscaled versions) of the received frames to memory and provide statistics of the received frames.

The FE registers are documented in the Raspberry Pi Image Signal Processor (ISP) Specification document, and example code for FE can be found in libpisp.

7.17.2. The rp1-cfe driver

The Raspberry Pi PiSP Camera Front End (rp1-cfe) driver is located under drivers/media/platform/raspberrypi/rp1-cfe. It uses the V4L2 API to register a number of video capture and output devices, the V4L2 subdev API to register subdevices for the CSI-2 received and the FE that connects the video devices in a single media graph realized using the Media Controller (MC) API.

The media topology registered by the rp1-cfe driver, in this particular example connected to an imx219 sensor, is the following one:

digraph board {
	rankdir=TB
	n00000001 [label="{{<port0> 0} | csi2\n/dev/v4l-subdev0 | {<port1> 1 | <port2> 2 | <port3> 3 | <port4> 4}}", shape=Mrecord, style=filled, fillcolor=green]
	n00000001:port1 -> n00000011 [style=dashed]
	n00000001:port1 -> n00000007:port0
	n00000001:port2 -> n00000015
	n00000001:port2 -> n00000007:port0 [style=dashed]
	n00000001:port3 -> n00000019 [style=dashed]
	n00000001:port3 -> n00000007:port0 [style=dashed]
	n00000001:port4 -> n0000001d [style=dashed]
	n00000001:port4 -> n00000007:port0 [style=dashed]
	n00000007 [label="{{<port0> 0 | <port1> 1} | pisp-fe\n/dev/v4l-subdev1 | {<port2> 2 | <port3> 3 | <port4> 4}}", shape=Mrecord, style=filled, fillcolor=green]
	n00000007:port2 -> n00000021
	n00000007:port3 -> n00000025 [style=dashed]
	n00000007:port4 -> n00000029
	n0000000d [label="{imx219 6-0010\n/dev/v4l-subdev2 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
	n0000000d:port0 -> n00000001:port0 [style=bold]
	n00000011 [label="rp1-cfe-csi2-ch0\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
	n00000015 [label="rp1-cfe-csi2-ch1\n/dev/video1", shape=box, style=filled, fillcolor=yellow]
	n00000019 [label="rp1-cfe-csi2-ch2\n/dev/video2", shape=box, style=filled, fillcolor=yellow]
	n0000001d [label="rp1-cfe-csi2-ch3\n/dev/video3", shape=box, style=filled, fillcolor=yellow]
	n00000021 [label="rp1-cfe-fe-image0\n/dev/video4", shape=box, style=filled, fillcolor=yellow]
	n00000025 [label="rp1-cfe-fe-image1\n/dev/video5", shape=box, style=filled, fillcolor=yellow]
	n00000029 [label="rp1-cfe-fe-stats\n/dev/video6", shape=box, style=filled, fillcolor=yellow]
	n0000002d [label="rp1-cfe-fe-config\n/dev/video7", shape=box, style=filled, fillcolor=yellow]
	n0000002d -> n00000007:port1
}

The media graph contains the following video device nodes:

  • rp1-cfe-csi2-ch0: capture device for the first CSI-2 stream

  • rp1-cfe-csi2-ch1: capture device for the second CSI-2 stream

  • rp1-cfe-csi2-ch2: capture device for the third CSI-2 stream

  • rp1-cfe-csi2-ch3: capture device for the fourth CSI-2 stream

  • rp1-cfe-fe-image0: capture device for the first FE output

  • rp1-cfe-fe-image1: capture device for the second FE output

  • rp1-cfe-fe-stats: capture device for the FE statistics

  • rp1-cfe-fe-config: output device for FE configuration

7.17.2.1. rp1-cfe-csi2-chX

The rp1-cfe-csi2-chX capture devices are normal V4L2 capture devices which can be used to capture video frames or metadata received from the CSI-2.

7.17.2.2. rp1-cfe-fe-image0, rp1-cfe-fe-image1

The rp1-cfe-fe-image0 and rp1-cfe-fe-image1 capture devices are used to write the processed frames to memory.

7.17.2.3. rp1-cfe-fe-stats

The format of the FE statistics buffer is defined by pisp_statistics C structure and the meaning of each parameter is described in the PiSP specification document.

7.17.2.4. rp1-cfe-fe-config

The format of the FE configuration buffer is defined by pisp_fe_config C structure and the meaning of each parameter is described in the PiSP specification document.