From patchwork Fri Jan 19 11:07:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 19416 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 2C9C3C323E for ; Fri, 19 Jan 2024 11:07:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2EFCB62916; Fri, 19 Jan 2024 12:07:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1705662448; bh=J6U1xiXIAETRSLtN183DInuNjCrrVPgsout8sfy853M=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=IwKsBRD44NAbyYbcjNRbK9sxWIFwp75bxPxcH3b4Tx0FRiHYVwdxOZs/0TJE3uCWJ 8DukcPxhp+V934uEMNDmaz0Iv/GgvnGNE+pHajVSiLZ5n27BeiEsiiwhQUJW++qQGz /S9kDQovRKr/YbDWsL0D91pTLfVdvEW3UKS7qJLhbnQN3trci8mYlG3q66SYDRao16 L1X4dwkhvSZLcWqC7m/b808p3yBXd9Y2iO0Ydma+U31JZ7EK3V0rpcS0Z5N7uuAcny AJzCBN1h9ZsXlItXuy8DNVysBJwLfelQ9ig/I6n6/hoP2bO0RR8L8UYIEG+bNj1lCE U6zQsktYj5uGg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D0C461D3C for ; Fri, 19 Jan 2024 12:07:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KPoqecfw"; dkim-atps=neutral Received: from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp [175.177.49.156]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1BC6C512; Fri, 19 Jan 2024 12:06:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1705662375; bh=J6U1xiXIAETRSLtN183DInuNjCrrVPgsout8sfy853M=; h=From:To:Cc:Subject:Date:From; b=KPoqecfwX5G3AuDDk5zXJ7TGsAIfxqQB+YBY0+hQjwaFkySWsrqEo5618ispGByKo Hsp4BiHcCvpPxplyj7zfWNayDeaNs7pj5fTmbfzGmC290PY+tIqRe2v8gJF5xBLlBc Xc6EqvvSCoaC65HDhiCRU3s8O1Xrlp2yoz0xtbuw= To: libcamera-devel@lists.libcamera.org Date: Fri, 19 Jan 2024 20:07:08 +0900 Message-Id: <20240119110708.377399-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: camera_sensor: Cache pixel rate 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: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Cache the pixel rate at initialization time instead of fetching it from the v4l2 subdev every time it's needed. Signed-off-by: Paul Elder --- include/libcamera/internal/camera_sensor.h | 2 ++ src/libcamera/camera_sensor.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 60a8b106d..da3bf12b3 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -105,6 +105,8 @@ private: std::string model_; std::string id_; + uint64_t pixelRate_; + V4L2Subdevice::Formats formats_; std::vector mbusCodes_; std::vector sizes_; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 0ef78d9c8..33fdb4c8e 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -515,6 +515,9 @@ int CameraSensor::initProperties() properties_.set(properties::draft::ColorFilterArrangement, cfa); } + ControlList ctrls = subdev_->getControls({ V4L2_CID_PIXEL_RATE }); + pixelRate_ = ctrls.get(V4L2_CID_PIXEL_RATE).get(); + return 0; } @@ -1080,7 +1083,7 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const return -EINVAL; } - info->pixelRate = ctrls.get(V4L2_CID_PIXEL_RATE).get(); + info->pixelRate = pixelRate_; const ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK); info->minLineLength = info->outputSize.width + hblank.min().get();