[{"id":33423,"web_url":"https://patchwork.libcamera.org/comment/33423/","msgid":"<20250224014133.GE22240@pendragon.ideasonboard.com>","date":"2025-02-24T01:41:33","subject":"Re: [PATCH] pipeline: simple: Create DelayedControls instance once\n\tonly","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Feb 24, 2025 at 03:23:25AM +0200, Laurent Pinchart wrote:\n> The DelayedControls instance for the camera sensor is created in\n> SimplePipelineHandler::configure(). Constant deletion and reconstruction\n> of a new object is unnecessary, as the control delays are an intrinsic\n> property of the sensor and are known at initialization time. Move the\n> DelayedControls creation to the SimpleCameraData class constructor.\n\nThis should be merged on top of Stanislaw's \"[PATCH v4 0/2] libcamera:\nstart frame events changes\" series (or rather on top of v5), or it would\nintroduce a signal duplicated connection bug.\n\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/simple/simple.cpp | 15 +++++++--------\n>  1 file changed, 7 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 6e039bf35fc1..bd3a8a6ec6b7 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -488,6 +488,13 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n>  \tif (!sensor_)\n>  \t\treturn;\n> \n> +\tconst CameraSensorProperties::SensorDelays &delays = sensor_->sensorDelays();\n> +\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n> +\t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n> +\t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n> +\t};\n> +\tdelayedCtrls_ = std::make_unique<DelayedControls>(sensor_->device(), params);\n> +\n>  \tLOG(SimplePipeline, Debug)\n>  \t\t<< \"Found pipeline: \"\n>  \t\t<< utils::join(entities_, \" -> \",\n> @@ -1277,14 +1284,6 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n>  \tif (outputCfgs.empty())\n>  \t\treturn 0;\n> \n> -\tconst CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays();\n> -\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n> -\t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n> -\t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n> -\t};\n> -\tdata->delayedCtrls_ =\n> -\t\tstd::make_unique<DelayedControls>(data->sensor_->device(),\n> -\t\t\t\t\t\t  params);\n>  \tdata->video_->frameStart.connect(data->delayedCtrls_.get(),\n>  \t\t\t\t\t &DelayedControls::applyControls);\n> \n> \n> base-commit: d476f8358be1536d4edd680c6024f784ff022f5d","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 8F338C324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Feb 2025 01:41:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ABED3686C6;\n\tMon, 24 Feb 2025 02:41:52 +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 5692361855\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Feb 2025 02:41:51 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 136FD7EA;\n\tMon, 24 Feb 2025 02:40:25 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"sx+FUtc8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1740361225;\n\tbh=KJHRk7xUqS3tcfje6hXh62KjxmHCRyOxTcEkJt0KF1c=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=sx+FUtc88W7laa4GY6CfcUsjy0hHK2KvbkavP8quF3mrEj0Eym1aSV2JbpnaPatTw\n\tHJFWXIFF6BgcPxNacSKYwLsoFppE0QbxZvZi1jylpM5wn3FRPA2sFTkDz9iwRcyw/l\n\tR+HMhN1gj4mYK3czo8S3gZKv9S81BR2A33/C/U1I=","Date":"Mon, 24 Feb 2025 03:41:33 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>","Subject":"Re: [PATCH] pipeline: simple: Create DelayedControls instance once\n\tonly","Message-ID":"<20250224014133.GE22240@pendragon.ideasonboard.com>","References":"<20250224012325.24246-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20250224012325.24246-1-laurent.pinchart@ideasonboard.com>","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>"}},{"id":33455,"web_url":"https://patchwork.libcamera.org/comment/33455/","msgid":"<85ikozm8hk.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-02-24T19:46:15","subject":"Re: [PATCH] pipeline: simple: Create DelayedControls instance once\n\tonly","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> The DelayedControls instance for the camera sensor is created in\n> SimplePipelineHandler::configure(). Constant deletion and reconstruction\n> of a new object is unnecessary, as the control delays are an intrinsic\n> property of the sensor and are known at initialization time. Move the\n> DelayedControls creation to the SimpleCameraData class constructor.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>  src/libcamera/pipeline/simple/simple.cpp | 15 +++++++--------\n>  1 file changed, 7 insertions(+), 8 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 6e039bf35fc1..bd3a8a6ec6b7 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -488,6 +488,13 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n>  \tif (!sensor_)\n>  \t\treturn;\n>\n> +\tconst CameraSensorProperties::SensorDelays &delays = sensor_->sensorDelays();\n> +\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n> +\t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n> +\t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n> +\t};\n> +\tdelayedCtrls_ = std::make_unique<DelayedControls>(sensor_->device(), params);\n> +\n>  \tLOG(SimplePipeline, Debug)\n>  \t\t<< \"Found pipeline: \"\n>  \t\t<< utils::join(entities_, \" -> \",\n> @@ -1277,14 +1284,6 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n>  \tif (outputCfgs.empty())\n>  \t\treturn 0;\n>\n> -\tconst CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays();\n> -\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n> -\t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n> -\t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n> -\t};\n> -\tdata->delayedCtrls_ =\n> -\t\tstd::make_unique<DelayedControls>(data->sensor_->device(),\n> -\t\t\t\t\t\t  params);\n>  \tdata->video_->frameStart.connect(data->delayedCtrls_.get(),\n>  \t\t\t\t\t &DelayedControls::applyControls);\n>\n>\n> base-commit: d476f8358be1536d4edd680c6024f784ff022f5d\n> --\n> Regards,\n>\n> Laurent Pinchart","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 7B8F0C324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Feb 2025 19:46:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B9081686FF;\n\tMon, 24 Feb 2025 20:46:27 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5FCE0686F6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Feb 2025 20:46:26 +0100 (CET)","from mail-wr1-f70.google.com (mail-wr1-f70.google.com\n\t[209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-100-NgBV4ILOMKijQsL7GU-D6A-1; Mon, 24 Feb 2025 14:46:21 -0500","by mail-wr1-f70.google.com with SMTP id\n\tffacd0b85a97d-38f2c0aa6d6so2571572f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Feb 2025 11:46:20 -0800 (PST)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-43ab156a10fsm1008015e9.37.2025.02.24.11.46.15\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 24 Feb 2025 11:46:16 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"Y6kZDJc0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1740426385;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=k5ZuADspzitJlCN0Mc+4F6Y5QNQYQ3+fSVHVpoSCkFk=;\n\tb=Y6kZDJc0yej5yWjjYzcTRbd/bFQ5Rn8uVawllVd9R462uJS8VtL9A+wK2sbZO7CaFi2iB7\n\tRPit8qsYugevFOk7L26AQT89JOWVSQaberfcEUzkaMVAp5ELb9GVvaA5j05U/AVxwNrDmy\n\tJdWGru0f1/uZw67VkCK4w2LgksuF+2I=","X-MC-Unique":"NgBV4ILOMKijQsL7GU-D6A-1","X-Mimecast-MFC-AGG-ID":"NgBV4ILOMKijQsL7GU-D6A_1740426378","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1740426378; x=1741031178;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=k5ZuADspzitJlCN0Mc+4F6Y5QNQYQ3+fSVHVpoSCkFk=;\n\tb=JQzlCzVJlZzyLAHHCK3iQFo5h9ZEybnfqfl9VP4AO6kSv3aKp/URjnORlgyZpEGSmI\n\tDq4j5L91rehM0JiaNKvcxB1X1oqRDUull7FMQiN988kS8i6DHc0/3mTnpTNDtUaICU1m\n\tdHTilOm/zuudj6pkGG5K1Havk35/zDPH/7XYyUN8QO1k/iupPSDk4eWvwo+dnEoeOaGA\n\tszYs/3OJ5m3aZW5Hu687vjYbGwP22IozOSENC3cQAWhKTZYkfwtU/cjTlA7b92fHKagD\n\tjHm79bto18RqPGysnI9l5+VV71hKdIg8AXzVijOJLxUfa0j6/f4wAnPqGSg6DjD7lAAr\n\t3DsA==","X-Gm-Message-State":"AOJu0Yw3gNEgDIPlSi2XTcvcNvSF8B4s49kCwzmPCEQ3TqR5RjzZWi6j\n\ttqdmrX4TSGHbAhvuHwwlRg7kwlyY2f2VW+daOmxPwWPgsJWtz+shv+Zka3+W0BOVXFGmGznRQNi\n\tyBBr0zJnHHJRLxiZmlS8CXWcZQal6GiIoP6pXThasXwV3NTCQujW6gjuGSmsAddu08NOcAXFxZq\n\t0RzBY=","X-Gm-Gg":"ASbGncs8pW1KEjfJf4mjxhrJvSBPo3Q/3Q3wV0hrw1ccUNhqSgR8ttTZmBUqmascCQW\n\tMc35rIGFvN/yvEbXs2rWypL8B7wEJPlKPiN2xxnDvGq73xdKQ/RtGEfomZiRISuXR8LCAWn3Ira\n\tD3J7y1tMM4MOxPUIQwsCxyjZIN1wbpE3uO4L5NK/e/A5pYk6wY9x4wGWNGEUFxTViCP4sH9qC2X\n\tZ9LRtikSH7LnqcJCp7iwNg/x4IoGidOyD8bDcmdmkTfz8xbZgPfSUMf+mDqspxVdUI8SQXddk/s\n\tbOTMMgKFRMWCgwGJj2lAOw24GwlW+StsNurBYZ6clWVdJqbTU9couA8N9V1VyhB5lCLn","X-Received":["by 2002:a5d:5847:0:b0:38f:3e0a:ca6a with SMTP id\n\tffacd0b85a97d-38f614991c2mr15436372f8f.2.1740426377745; \n\tMon, 24 Feb 2025 11:46:17 -0800 (PST)","by 2002:a5d:5847:0:b0:38f:3e0a:ca6a with SMTP id\n\tffacd0b85a97d-38f614991c2mr15436358f8f.2.1740426377400; \n\tMon, 24 Feb 2025 11:46:17 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IHDER0Gp5+d7Bye77vAJsaKxTSG2Nn5oX/E6Q1nG7Yp4DFebohGfP3xlPgGgyq+ThYsw/mqnA==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Stanislaw Gruszka\n\t<stanislaw.gruszka@linux.intel.com>","Subject":"Re: [PATCH] pipeline: simple: Create DelayedControls instance once\n\tonly","In-Reply-To":"<20250224012325.24246-1-laurent.pinchart@ideasonboard.com>\n\t(Laurent Pinchart's message of \"Mon, 24 Feb 2025 03:23:25 +0200\")","References":"<20250224012325.24246-1-laurent.pinchart@ideasonboard.com>","Date":"Mon, 24 Feb 2025 20:46:15 +0100","Message-ID":"<85ikozm8hk.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"Q3LKIwkhEm200Jfel9I-L-8zZEbN1yv6SJiMzRlYkNA_1740426378","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]