From patchwork Tue Apr 16 22:08:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1009 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E33BF60004 for ; Wed, 17 Apr 2019 00:08:51 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 66E5BE2 for ; Wed, 17 Apr 2019 00:08:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1555452531; bh=DQGHuQ+npamiHKYL0FIGvEFb2gKvmQhpnrxKgl5QIRg=; h=From:To:Subject:Date:From; b=FRqcKUIGu4ov5fYpJJ7sCtLYDACnoRqFWKoXK5ktzS+ZQ4hMXkOUU8SjnPBHDn7hi vqdbTN2F918fxYnOLySSs9FsDGO/UOQBMn6lRpILZEvV4l4s4WEkxQ4f7PscCoTYBE OfGVYs6I0+haEL9fK4ut9a085q3SFQCLfxWx4Q1w= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Apr 2019 01:08:26 +0300 Message-Id: <20190416220839.1577-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 00/13] Rockchip ISP 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, 16 Apr 2019 22:08:52 -0000 Hello everybody, This patch series implements a pipeline handler for the Rockchip ISP1. The first ten patches, from 01/13 to 10/13, are miscellaneous fixes and improvements, with the most notable change related to comparison operators for geometry classes. Patch 11/13 and 12/13 are were the fun begins, with a new CameraSensor class that factors out code related to the sensor from the IPU3 pipeline handler. Patch 13/13 finally adds the RkISP1 pipeline handler, using the new CameraSensor class. Features are limited, as explained in patch 13/13. Only CSI-2 raw Bayer sensors are supported, and while only one camera can be used at a time, mutual exclusion isn't implemented yet. Compared to v1, patches 08/13 and 09/13 have been added, and minor miscellaneous changes have been performed, all described in the respective patches. The rkisp1 driver prints warnings in the kernel log when the stream is started and stopped, as well as during capture: [ 2527.336629] rkisp1: CIF_ISP_PIC_SIZE_ERROR (0x00000001) [ 2527.344146] rkisp1: CIF_ISP_PIC_SIZE_ERROR (0x00000000) This doesn't seem to prevent proper operation so far, but will need to be fixed. Please note that the kernel driver isn't upstream yet, the version used for this development can be found at git://linuxtv.org/pinchartl/media.git rockchip The branch is based on the latest version of the driver as posted to the linux-media mailing list, plus two additional patches that address the bitrotting, and contains DT integration. The patches have been tested on a Acer Chromebook Tab 10 device, based on the Rockchip RK3399 SoC. The RK399 has two ISP instances, with one CSI-2 receiver each, and it should be possible, at least in theory, to use both ISPs for the same camera, one in live streaming mode and one in memory-to-memory mode. This isn't supported on the kernel side, and thus out of scope for this initial pipeline handler implementation in libcamera. Laurent Pinchart (13): Install the cam and qcam utilities libcamera: log: Mark Loggable::_log() methods as const libcamera: camera: Log requested configuration in configureStreams() libcamera: geometry: Sort classes alphabetically libcamera: geometry: Use Size to store min and max in SizeRange libcamera: geometry: Add comparison operators to geometry classes test: geometry: Add tests for Size class comparison operators libcamera: utils: Add set_overlap() function libcamera: v4l2_subdevice: Close subdevice when destroyed libcamera: v4l2-subdevice: Add method to retrieve the media entity libcamera: camera_sensor: Add a new class to model a camera sensor libcamera: pipeline: ipu3: Use the new CameraSensor class libcamera: pipeline: Add RKISP1 pipeline include/libcamera/geometry.h | 67 ++- src/cam/meson.build | 1 + src/libcamera/camera.cpp | 14 + src/libcamera/camera_sensor.cpp | 258 ++++++++++++ src/libcamera/geometry.cpp | 162 ++++++-- src/libcamera/include/camera_sensor.h | 56 +++ src/libcamera/include/log.h | 5 +- src/libcamera/include/utils.h | 19 + src/libcamera/include/v4l2_subdevice.h | 4 +- src/libcamera/log.cpp | 5 +- src/libcamera/meson.build | 2 + src/libcamera/pipeline/ipu3/ipu3.cpp | 116 ++---- src/libcamera/pipeline/meson.build | 1 + src/libcamera/pipeline/rkisp1/meson.build | 3 + src/libcamera/pipeline/rkisp1/rkisp1.cpp | 431 ++++++++++++++++++++ src/libcamera/utils.cpp | 12 + src/libcamera/v4l2_subdevice.cpp | 27 +- src/qcam/meson.build | 1 + test/geometry.cpp | 116 ++++++ test/meson.build | 1 + test/v4l2_subdevice/list_formats.cpp | 14 +- test/v4l2_subdevice/v4l2_subdevice_test.cpp | 2 +- 22 files changed, 1154 insertions(+), 163 deletions(-) create mode 100644 src/libcamera/camera_sensor.cpp create mode 100644 src/libcamera/include/camera_sensor.h create mode 100644 src/libcamera/pipeline/rkisp1/meson.build create mode 100644 src/libcamera/pipeline/rkisp1/rkisp1.cpp create mode 100644 test/geometry.cpp