{"id":19445,"url":"https://patchwork.libcamera.org/api/patches/19445/?format=json","web_url":"https://patchwork.libcamera.org/patch/19445/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240122121358.3426521-1-paul.elder@ideasonboard.com>","date":"2024-01-22T12:13:58","name":"[v2] libcamera: camera_sensor: Cache pixel rate","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bb1d42bf2d38520ed5014eeb1e1708d2bb5cea3d","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19445/mbox/","series":[{"id":4154,"url":"https://patchwork.libcamera.org/api/series/4154/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4154","date":"2024-01-22T12:13:58","name":"[v2] libcamera: camera_sensor: Cache pixel rate","version":2,"mbox":"https://patchwork.libcamera.org/series/4154/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19445/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19445/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 80460C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Jan 2024 12:14:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9600962944;\n\tMon, 22 Jan 2024 13:14:16 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9AEFC61D30\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Jan 2024 13:14:15 +0100 (CET)","from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp\n\t[175.177.49.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 607A074A;\n\tMon, 22 Jan 2024 13:13:01 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"T/HaL2iK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1705925582;\n\tbh=t5fvTXS2pYa6De0aX3+TnX/c1drxrbyRYTDGlGolUm8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=T/HaL2iKaKlvmarEU26UMZCwEGoAdbnekQS1KVctemMcecNMRu+LS7e1rVS0BKH9E\n\tjAHBVSe4OEAvnMWVrRUkCYs1UCwW6agEEZTknJxBrLyUh5sapL4D+/H5j8jYXUrrDD\n\tyYoDa9AJ1zksLRdnORdeCp/UWaOy9q/zWnRJ1rQg=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v2] libcamera: camera_sensor: Cache pixel rate","Date":"Mon, 22 Jan 2024 21:13:58 +0900","Message-Id":"<20240122121358.3426521-1-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.39.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Cache the pixel rate at set format time instead of fetching it from the\nv4l2 subdev every time it's needed.\n\nIt needs to be cached at set format time as opposed to initialization\ntime as some sensor drives (eg. imx708) change the pixel rate depending\non the mode.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v2:\n- Cache the pixel rate at set format time instead of at initialization\n  time\n---\n include/libcamera/internal/camera_sensor.h | 2 ++\n src/libcamera/camera_sensor.cpp            | 8 +++++++-\n 2 files changed, 9 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 60a8b106d..da3bf12b3 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -105,6 +105,8 @@ private:\n \tstd::string model_;\n \tstd::string id_;\n \n+\tuint64_t pixelRate_;\n+\n \tV4L2Subdevice::Formats formats_;\n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 0ef78d9c8..127610321 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -515,6 +515,9 @@ int CameraSensor::initProperties()\n \t\tproperties_.set(properties::draft::ColorFilterArrangement, cfa);\n \t}\n \n+\tControlList ctrls = subdev_->getControls({ V4L2_CID_PIXEL_RATE });\n+\tpixelRate_ = ctrls.get(V4L2_CID_PIXEL_RATE).get<int64_t>();\n+\n \treturn 0;\n }\n \n@@ -814,6 +817,9 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format, Transform transform)\n \tif (ret)\n \t\treturn ret;\n \n+\tControlList ctrls = subdev_->getControls({ V4L2_CID_PIXEL_RATE });\n+\tpixelRate_ = ctrls.get(V4L2_CID_PIXEL_RATE).get<int64_t>();\n+\n \tupdateControlInfo();\n \treturn 0;\n }\n@@ -1080,7 +1086,7 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const\n \t\treturn -EINVAL;\n \t}\n \n-\tinfo->pixelRate = ctrls.get(V4L2_CID_PIXEL_RATE).get<int64_t>();\n+\tinfo->pixelRate = pixelRate_;\n \n \tconst ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK);\n \tinfo->minLineLength = info->outputSize.width + hblank.min().get<int32_t>();\n","prefixes":["v2"]}