[libcamera-devel,0/4] libcamera: IPU3: Add pipeline handler
mbox series

Message ID 20190115140749.8297-1-jacopo@jmondi.org
Headers show
Series
  • libcamera: IPU3: Add pipeline handler
Related show

Message

Jacopo Mondi Jan. 15, 2019, 2:07 p.m. UTC
Hello,
  this series supersedes the single patch I sent a few days ago:
[PATCH] libcamera: pipeline: Add Intel IPU3 pipeline skeleton
which adds a simple IPU3 pipeline skeleton that did not much more that
matching the media devices reported by the DeviceEnumerator.

This series includes what was sent there, but completes the pipeline handler
with Camera instances creation and link handling on the CIO2 device.

The series starts by making the list-camera test more verbose and make it use
the TestStatus return codes.

The second patch is temporary, as the lifetime management of Camera instances
will be soon reworked, but at the moment to avoid leaks, the pipeline handlers
that create cameras shall be able to delete them too.

The third patch adds a 'function' field to MediaEntities, which
is used to identify sensor entities in patch number four, where a pipeline
handler for the IPU3 device is added. The pipeline handler creates cameras
identifying which sensor are connected to which CSI-2 receiver, and sets
up link between the two.

When the list-cameras test is run on Soraka, it now produces the following
output:

# ./test/list-cameras
[0:03:36.564260693]   DBG pipeline_handler.cpp:119 Registered pipeline handler "PipeHandlerVimc"
[0:03:36.564488901]   DBG pipeline_handler.cpp:119 Registered pipeline handler "PipelineHandlerIPU3"
[0:03:36.565105527]   DBG device_enumerator.cpp:214 New media device "ipu3-imgu" created from /dev/media1
[0:03:36.565689706]   DBG device_enumerator.cpp:214 New media device "ipu3-cio2" created from /dev/media0
[0:03:36.566211596]   DBG device_enumerator.cpp:255 Successful match for media device "ipu3-cio2"
[0:03:36.566232617]   DBG device_enumerator.cpp:255 Successful match for media device "ipu3-imgu"
[0:03:36.566253506]   DBG media_device.cpp:672 ov13858 2-0010[0] -> ipu3-csi2 0[0]: 0
[0:03:36.566259334]   DBG media_device.cpp:672 ov5670 4-0036[0] -> ipu3-csi2 1[0]: 0
[0:03:36.566288654]   DBG media_device.cpp:672 ov13858 2-0010[0] -> ipu3-csi2 0[0]: 1
[0:03:36.566325545]   DBG ipu3.cpp:240 Registered Camera[0] "ov13858" connected to CSI-2 receiver 0
[0:03:36.566345257]   DBG media_device.cpp:672 ov5670 4-0036[0] -> ipu3-csi2 1[0]: 1
[0:03:36.566356247]   DBG ipu3.cpp:240 Registered Camera[1] "ov5670" connected to CSI-2 receiver 1
[0:03:36.566364052]   DBG ipu3.cpp:161 "Intel IPU3" pipeline handler initialized with 2 cameras registered
[0:03:36.566370915]   DBG pipeline_handler.cpp:150 Pipeline handler "PipelineHandlerIPU3" matched
Camera 'ov13858' registered
Camera 'ov5670' registered

Tested locally with Valgrind and VIMC:

==8203== HEAP SUMMARY:
==8203==     in use at exit: 0 bytes in 0 blocks
==8203==   total heap usage: 864 allocs, 864 frees, 419,652 bytes allocated
==8203==
==8203== All heap blocks were freed -- no leaks are possible

On Soraka valgrind fails with:

vex amd64->IR: unhandled instruction bytes: 0xF3 0xF 0x1E 0xFA 0x48 0x83 0xEC 0x8
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=1
==2289== valgrind: Unrecognised instruction at address 0x405e000.
==2289==    at 0x405E000: ??? (in /home/cam/libcamera_deploy/src/libcamera/libcamera.so)
==2289==    by 0x4010679: call_init.part.0 (dl-init.c:58)
==2289==    by 0x40107CA: call_init (dl-init.c:30)
==2289==    by 0x40107CA: _dl_init (dl-init.c:120)
==2289==    by 0x4000C69: ??? (in /lib/x86_64-linux-gnu/ld-2.23.so)

I will investigate further.

Thanks
  j

Jacopo Mondi (4):
  test: list-cameras: Make test output more verbose
  libcamera: Make Camera destructor public
  libcamera: media_object: Add functions to entities
  libcamera: pipeline: Add Intel IPU3 pipeline

 include/libcamera/camera.h              |   2 +-
 src/libcamera/include/media_object.h    |   2 +
 src/libcamera/media_object.cpp          |  18 +-
 src/libcamera/pipeline/ipu3/ipu3.cpp    | 249 ++++++++++++++++++++++++
 src/libcamera/pipeline/ipu3/meson.build |   3 +
 src/libcamera/pipeline/meson.build      |   2 +
 src/libcamera/pipeline/vimc.cpp         |   2 +
 test/list-cameras.cpp                   |  52 ++++-
 8 files changed, 317 insertions(+), 13 deletions(-)
 create mode 100644 src/libcamera/pipeline/ipu3/ipu3.cpp
 create mode 100644 src/libcamera/pipeline/ipu3/meson.build

--
2.20.1