From patchwork Wed Aug 11 23:26:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13308 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 10224BD87D for ; Wed, 11 Aug 2021 23:26:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DD0196888C; Thu, 12 Aug 2021 01:26:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JieNgZrz"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E0290687F0 for ; Thu, 12 Aug 2021 01:26:32 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 769E1EE for ; Thu, 12 Aug 2021 01:26:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1628724392; bh=sEzhxEyUvIc6Yb9qsOUGWrTf5z0SU39znpgWKTMZCBM=; h=From:To:Subject:Date:From; b=JieNgZrzXvVBlz6/pebeldxogM3EcK9Qkw+OtuxjC9q10jRYPVgf7ilG9tbvT5+UC x1Kuq4T6f+TLCewO6qVW7DVyCwEPagptWR/VP51e7gQpp6SkM55ricT6PQjFso2zNx ot/dk5UMvYjJlppbiQ4cmUo7DfJospdMdZBRYor0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Thu, 12 Aug 2021 02:26:11 +0300 Message-Id: <20210811232625.17280-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 00/14] libcamera: Replace CameraData with Camera::Private X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello, This patch series reworks the libcamera core and pipeline handlers to drop the CameraData class, replacing it with Camera::Private. The Camera::Private class implements the d-pointer design pattern for the Camera class, and stores internal camera data that shouldn't be visible through the public API. The CameraData class is a container used by pipeline handlers to store per-camera private data. The two classes thus overlap in their purpose. This series cleans up this situation by merging CameraData into Camera::Private. Pipeline handlers then subclass Camera::Private instead of CameraData, and pass the private data directly to the Camera constructor. The first 7 patches from the first RFC version, preparing for this change, have been merged. Compared to v2, this version starts in 01/14 with a new patch that replaces with the Extensible::Private pointer passed to the Extensible constructor with a std::unique_ptr<>, better reflecting the lifetime management of the private data. Patch 04/14 is also new and addresses minor documentation issues. In 02/14, the pointer to the private data is now passed explicitly to the Camera constructor, to allow subclassing Camera::Private in pipeline handlers. After that, changes are fairly straightforward. Patch 03/14 moves the members of the existing CameraData class to Camera::Private. Patches 05/14 to 10/14 update pipeline handlers individually to migrate to Camera::Private. Patch 11/14 then cleans up by dropping the CameraData class, and patch 12/14 updates the pipeline handler guide accordingly. Finally, patches 13/14 and 14/14 are follow-up improvements, both suggested by Jacopo. 13/14 drops the indirection in the implementation of Camera::controls() and Camera::properties(). It looks quite neat in my opinion, and worth the effort. 14/14 introduces helper functions in two pipeline handlers that need cast the PipelineHandler base class to the derived class. It seems to bring a slight simplification, but I don't have a strong preference there. I've tested the ipu3, raspberrypi, simple, uvcvideo and vimc pipeline handlers. If someone could test rkisp1, that would be appreciated. Laurent Pinchart (14): libcamera: base: extensible: Pass private pointer as unique_ptr<> libcamera: camera: Pass Private pointer to Camera constructor libcamera: pipeline_handler: Move CameraData members to Camera::Private libcamera: camera: Fix minor issues in Camera::Private documentation libcamera: pipeline: simple: Migrate to Camera::Private libcamera: pipeline: uvcvideo: Migrate to Camera::Private libcamera: pipeline: vimc: Migrate to Camera::Private libcamera: pipeline: rkisp1: Migrate to Camera::Private libcamera: pipeline: raspberrypi: Migrate to Camera::Private libcamera: pipeline: ipu3: Migrate to Camera::Private libcamera: pipeline_handler: Drop CameraData class Documentation: guides: pipeline-handler: Migrate to Camera::Private libcamera: pipeline_handler: Drop controls() and properties() functions libcamera: pipeline: Cast to derived pipeline handler with helpers Documentation/Doxyfile.in | 1 - Documentation/guides/pipeline-handler.rst | 67 ++++----- include/libcamera/base/class.h | 2 +- include/libcamera/camera.h | 4 +- include/libcamera/internal/camera.h | 12 +- include/libcamera/internal/pipeline_handler.h | 33 +---- src/android/camera_buffer.h | 2 +- src/android/camera_hal_config.cpp | 2 +- src/libcamera/base/class.cpp | 11 +- src/libcamera/camera.cpp | 89 +++++++++-- src/libcamera/camera_manager.cpp | 2 +- src/libcamera/framebuffer.cpp | 3 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 38 ++--- .../pipeline/raspberrypi/raspberrypi.cpp | 24 +-- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 34 +++-- src/libcamera/pipeline/simple/simple.cpp | 31 ++-- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 19 +-- src/libcamera/pipeline/vimc/vimc.cpp | 19 +-- src/libcamera/pipeline_handler.cpp | 138 +----------------- 19 files changed, 235 insertions(+), 296 deletions(-)