From patchwork Tue Jan 15 14:07:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 227 Return-Path: Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0843E60C78 for ; Tue, 15 Jan 2019 15:07:47 +0100 (CET) Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 4CAD120000D; Tue, 15 Jan 2019 14:07:46 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 15 Jan 2019 15:07:45 +0100 Message-Id: <20190115140749.8297-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/4] libcamera: IPU3: Add pipeline handler X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2019 14:07:47 -0000 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