From patchwork Mon Mar 10 17:02:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22941 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 4054EC32F1 for ; Mon, 10 Mar 2025 17:02:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6F9FE687FA; Mon, 10 Mar 2025 18:02:53 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GYqzU1B5"; 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 BABB461802 for ; Mon, 10 Mar 2025 18:02:51 +0100 (CET) Received: from pb-laptop.local (185.221.143.221.nat.pool.zt.hu [185.221.143.221]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 917A2227 for ; Mon, 10 Mar 2025 18:01:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1741626075; bh=HQmFKMr6+1hQaARim4X82xuR+YHI6UwoE+VY4B43qik=; h=From:To:Subject:Date:From; b=GYqzU1B5LIvhe+3iqKWwPPPtHJ8x+CR6DICfkIa/UJ9lJIfGSfwdhl5e32xKVtRSh hiED625w5uDr3wMzQa+eZa19wKf+xk1xF2BjmemifIkjHuEuf+BCWFw8uIjy7QGuEy QAyjoyFA6F2hJ9JGbRd9HFLxED/r1g/+kvg5fOFA= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1] libcamera: camera: Ensure correct id maps are always set Date: Mon, 10 Mar 2025 18:02:46 +0100 Message-ID: <20250310170246.185147-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.48.1 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" `Camera::Private::properties_` is a default constructed `ControlList`, therefore it does not have an associated `ControlIdMap`. `controlInfo_` is in a similar situation. Extend the `Camera::Private` constructor to initialize the control id map of both properly. Multiple pipeline handlers copy the sensor's property list and set that as camera properties, and since the `CameraSensor{Legacy,Raw}` classes set the proper id map, the camera properties will have it too. However, some pipelines, e.g. `uvcvideo` or `virtual`, do not do so, and thus there will be no id map set. To fix this, extend the `Camera::Private` constructor to set `properties::properties`. As for `controlInfo_`, all pipeline handlers overwrite it during camera initialization (and thus it will have the correct id map), but still initialize the id map so that it is set at all times. Signed-off-by: Barnabás Pőcze Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/libcamera/camera.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 56c585199..c180a5fdd 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -587,7 +588,8 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF * \param[in] pipe The pipeline handler responsible for the camera device */ Camera::Private::Private(PipelineHandler *pipe) - : requestSequence_(0), pipe_(pipe->shared_from_this()), + : controlInfo_({}, controls::controls), properties_(properties::properties), + requestSequence_(0), pipe_(pipe->shared_from_this()), disconnected_(false), state_(CameraAvailable) { }