From patchwork Tue Apr 7 15:33:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 26447 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 E589DC32BB for ; Tue, 7 Apr 2026 15:34:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5106C62DC0; Tue, 7 Apr 2026 17:34:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ulM6izHm"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EF72362DB2 for ; Tue, 7 Apr 2026 17:34:37 +0200 (CEST) Received: from killaraus.ideasonboard.com (2001-14ba-703d-e500--2a1.rev.dnainternet.fi [IPv6:2001:14ba:703d:e500::2a1]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 593806A6 for ; Tue, 7 Apr 2026 17:33:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1775575990; bh=7RIEwgWtmLm34iS8i5jpipaLiTEQXiL5iqU+gJhTbhk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ulM6izHmsKQ08lW2YAkVwbXqQFazPD9Qu25vv4Ec/VoMbQCZNGKpYTa/l0d2dh0mQ aKW9WfObV27vLFZy4s1KCpF7Jmjqbaj8gRqdSmHLyoVevsFGfn9nq0sEtefC6tPMqM SZuXHFxH7jyKxGcYNTu7X9oP8NvSqBw8pj9ECIqI= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH v2 07/42] libcamera: camera_manager: Move IPAManager creation to start() time Date: Tue, 7 Apr 2026 18:33:52 +0300 Message-ID: <20260407153427.1825999-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260407153427.1825999-1-laurent.pinchart@ideasonboard.com> References: <20260407153427.1825999-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 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" The IPAManager is currently instantiated when constructing the CameraManager constructor, in the CameraManager::Private constructor. This is the only sizeable object constructed with the CameraManager, all other components are constructed when starting the manager. Early construction of the IPAManager isn't wrong per-se, but prevents accessing the CameraManager from the IPAManager constructor (as the former isn't fully constructed). It also results in internal objects constructed in different threads, which isn't an issue at the moment as none of the objects constructed by the IPAManager are thread-bound, but could cause issues later. Finally, it prevents influencing the IPAManager creation with parameters passed to the CameraManager::start() function once we implement this, which would be useful for applications to override configuration parameters related to IPA modules. Move the instantiation of the IPAManager to start time to fix all those issues. Signed-off-by: Laurent Pinchart Reviewed-by: Barnabás Pőcze Reviewed-by: Stefan Klug --- src/libcamera/camera_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index fc6e490bc476..5762c210ffc2 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -41,7 +41,6 @@ LOG_DEFINE_CATEGORY(Camera) CameraManager::Private::Private() : Thread("CameraManager"), initialized_(false) { - ipaManager_ = std::make_unique(configuration()); } int CameraManager::Private::start() @@ -94,6 +93,8 @@ void CameraManager::Private::run() int CameraManager::Private::init() { + ipaManager_ = std::make_unique(configuration()); + enumerator_ = DeviceEnumerator::create(); if (!enumerator_ || enumerator_->enumerate()) return -ENODEV;