[{"id":20053,"web_url":"https://patchwork.libcamera.org/comment/20053/","msgid":"<YVwat04YbV+4X6bG@pendragon.ideasonboard.com>","date":"2021-10-05T09:28:23","subject":"Re: [libcamera-devel] [PATCH v2 1/1] pipeline: raspberrypi: Create\n\tempty control lists correctly","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nThank you for the patch.\n\nOn Tue, Oct 05, 2021 at 09:57:00AM +0100, David Plowman wrote:\n> When the pipeline handler start() method is supplied with a NULL list\n> of controls, we send an empty control list to the IPA. When the IPA is\n> running in isolated mode the control list goes through the data\n> serializer, for which it must be marked correctly as a list of\n> \"controls::controls\", otherwise the IPA process will abort.\n> \n> The IPA has a similar problem returning a control list in its\n> configure() method. We must be careful to initialise it properly even\n> when empty.\n\nLooks good to me. I'll wait another day before pushing this to let Paul\nchime in if he wants to.\n\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/ipa/raspberrypi/raspberrypi.cpp                | 13 +++++++++----\n>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp |  3 ++-\n>  2 files changed, 11 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> index 047123ab..fed82e22 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -389,21 +389,26 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n>  \t/* Pass the camera mode to the CamHelper to setup algorithms. */\n>  \thelper_->SetCameraMode(mode_);\n>  \n> +\t/*\n> +\t * Initialise this ControlList correctly, even if empty, in case the IPA is\n> +\t * running is isolation mode (passing the ControlList through the IPC layer).\n> +\t */\n> +\tControlList ctrls(sensorCtrls_);\n> +\n>  \tif (firstStart_) {\n>  \t\t/* Supply initial values for frame durations. */\n>  \t\tapplyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration);\n>  \n>  \t\t/* Supply initial values for gain and exposure. */\n> -\t\tControlList ctrls(sensorCtrls_);\n>  \t\tAgcStatus agcStatus;\n>  \t\tagcStatus.shutter_time = defaultExposureTime;\n>  \t\tagcStatus.analogue_gain = defaultAnalogueGain;\n>  \t\tapplyAGC(&agcStatus, ctrls);\n> -\n> -\t\tASSERT(controls);\n> -\t\t*controls = std::move(ctrls);\n>  \t}\n>  \n> +\tASSERT(controls);\n> +\t*controls = std::move(ctrls);\n> +\n>  \treturn 0;\n>  }\n>  \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 0bdfa727..1634ca98 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -825,7 +825,8 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n>  \n>  \t/* Start the IPA. */\n>  \tipa::RPi::StartConfig startConfig;\n> -\tdata->ipa_->start(controls ? *controls : ControlList{}, &startConfig);\n> +\tdata->ipa_->start(controls ? *controls : ControlList{ controls::controls },\n> +\t\t\t  &startConfig);\n>  \n>  \t/* Apply any gain/exposure settings that the IPA may have passed back. */\n>  \tif (!startConfig.controls.empty())","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 D5DC4BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Oct 2021 09:28:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 94218691B6;\n\tTue,  5 Oct 2021 11:28:32 +0200 (CEST)","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 5CF6C684C6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Oct 2021 11:28:31 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D3A9125B;\n\tTue,  5 Oct 2021 11:28:30 +0200 (CEST)"],"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=\"Oq9n3So8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1633426111;\n\tbh=8pVZVrtZ3KwgWOwxh1RZ6xFuqwjogboiNMEkmAsTYqk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Oq9n3So8q0YbC7FTUgcDD5Rldrc6Bh2yNKpFE3RR37kZjt+3yiA0s/1N74dGgNdhJ\n\ty0QDlJZ3JlMwXui8LU7S6NQpyaLSNPlYvSCzzs2SEu3l3jXF+xYrXcwTnDY9Niv3bw\n\tvhzruj9WGPvLxGcLGNIlyhxI90a87iOvGuqhTPH4=","Date":"Tue, 5 Oct 2021 12:28:23 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<YVwat04YbV+4X6bG@pendragon.ideasonboard.com>","References":"<20211005085700.16708-1-david.plowman@raspberrypi.com>\n\t<20211005085700.16708-2-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211005085700.16708-2-david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/1] pipeline: raspberrypi: Create\n\tempty control lists correctly","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20062,"web_url":"https://patchwork.libcamera.org/comment/20062/","msgid":"<CAEmqJPqMS17oyXEmEYapLWp=k3qBgw5mDJt_444aBiEO-1oNRA@mail.gmail.com>","date":"2021-10-05T09:53:36","subject":"Re: [libcamera-devel] [PATCH v2 1/1] pipeline: raspberrypi: Create\n\tempty control lists correctly","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi David,\n\nThank you for this fix.\n\nOn Tue, 5 Oct 2021 at 09:57, David Plowman <david.plowman@raspberrypi.com>\nwrote:\n\n> When the pipeline handler start() method is supplied with a NULL list\n> of controls, we send an empty control list to the IPA. When the IPA is\n> running in isolated mode the control list goes through the data\n> serializer, for which it must be marked correctly as a list of\n> \"controls::controls\", otherwise the IPA process will abort.\n>\n> The IPA has a similar problem returning a control list in its\n> configure() method. We must be careful to initialise it properly even\n> when empty.\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n\n> ---\n>  src/ipa/raspberrypi/raspberrypi.cpp                | 13 +++++++++----\n>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp |  3 ++-\n>  2 files changed, 11 insertions(+), 5 deletions(-)\n>\n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp\n> b/src/ipa/raspberrypi/raspberrypi.cpp\n> index 047123ab..fed82e22 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -389,21 +389,26 @@ int IPARPi::configure(const IPACameraSensorInfo\n> &sensorInfo,\n>         /* Pass the camera mode to the CamHelper to setup algorithms. */\n>         helper_->SetCameraMode(mode_);\n>\n> +       /*\n> +        * Initialise this ControlList correctly, even if empty, in case\n> the IPA is\n> +        * running is isolation mode (passing the ControlList through the\n> IPC layer).\n> +        */\n> +       ControlList ctrls(sensorCtrls_);\n> +\n>         if (firstStart_) {\n>                 /* Supply initial values for frame durations. */\n>                 applyFrameDurations(defaultMinFrameDuration,\n> defaultMaxFrameDuration);\n>\n>                 /* Supply initial values for gain and exposure. */\n> -               ControlList ctrls(sensorCtrls_);\n>                 AgcStatus agcStatus;\n>                 agcStatus.shutter_time = defaultExposureTime;\n>                 agcStatus.analogue_gain = defaultAnalogueGain;\n>                 applyAGC(&agcStatus, ctrls);\n> -\n> -               ASSERT(controls);\n> -               *controls = std::move(ctrls);\n>         }\n>\n> +       ASSERT(controls);\n> +       *controls = std::move(ctrls);\n> +\n>         return 0;\n>  }\n>\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 0bdfa727..1634ca98 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -825,7 +825,8 @@ int PipelineHandlerRPi::start(Camera *camera, const\n> ControlList *controls)\n>\n>         /* Start the IPA. */\n>         ipa::RPi::StartConfig startConfig;\n> -       data->ipa_->start(controls ? *controls : ControlList{},\n> &startConfig);\n> +       data->ipa_->start(controls ? *controls : ControlList{\n> controls::controls },\n> +                         &startConfig);\n>\n>         /* Apply any gain/exposure settings that the IPA may have passed\n> back. */\n>         if (!startConfig.controls.empty())\n> --\n> 2.20.1\n>\n>","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 8B987BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Oct 2021 09:53:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5178A691B6;\n\tTue,  5 Oct 2021 11:53:56 +0200 (CEST)","from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com\n\t[IPv6:2a00:1450:4864:20::12f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C780E684C6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Oct 2021 11:53:54 +0200 (CEST)","by mail-lf1-x12f.google.com with SMTP id m3so82820269lfu.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 05 Oct 2021 02:53:54 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"RhhDWd7X\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=6wb8urA7MDtB9tBoxkWlzIhcpNBfM8QmK7d/BkY/Hi8=;\n\tb=RhhDWd7X6Huq1I27o69keCUQtXsCwhkzI9ulSLFBi99S2C6N037QBUKlrt7gtl5/Di\n\tom0UPzCbArjZN/l3Xq0aDdJsyBJWy8oNTOJZ+zkoyZtSRsYXXHn/A0KHfxFmnSw72MZx\n\tZwZBy2hvQ48R9AFb68jePXvIoBZpZbpnodMhAHsOcgCG5KTXRKr5RqwieODjk4yEePSU\n\tcvMy9gnv8SfOokCPaZHG5jizTJBCuFTTvBh8PsaLksSG4VxdaJgqIqeDdpvUUExg98hi\n\tEPR/xJWpyZDyzQfhrW6Nz/7KRCmA3RCRu6DMZAIP85MWmtWIj+kq6fNigFe3MruV3XAf\n\tbB/A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=6wb8urA7MDtB9tBoxkWlzIhcpNBfM8QmK7d/BkY/Hi8=;\n\tb=We3e+C+NhxG9zx6pbyNy9diHCGgql7j1Fqlf7Paff0Iyv2bPz7W72L7pKDFpFV+73A\n\t9SYlU4/jSsrKD6+H1ULab524+zo4QU6mRcv8pwanJs8FKgALbvOYoFE3Ikw5OG0dc9x2\n\t6ncVF2REF8gLg1S6C4lEmfoGISmxdQ09Vj70Hx6/E410iEJnKroO9llyCkdhIb4guW/X\n\t/pOTnL5Z/2FKtZvvHdS9eMD1aDhRzH0Wzg0x4usgTtaLjtVghbuQjQeDv+6EM6Mlo/8V\n\tlDdKHMkQWil8EIkN6KND4BjAkmunhkjnRxRJERdOCzvkXoB7TXRBkV4/MnSEYApMyAuE\n\tvaYA==","X-Gm-Message-State":"AOAM533EVhpHQuQBnpNNso4Bt+CdtO0HK+TrMAXJGy4xabYWiVAMaETK\n\tWXEuMw6Ej7+wsJtnUTAoVfS9FEYAwZrACThGHR6ffQ==","X-Google-Smtp-Source":"ABdhPJwPrB708Eis7nURZAsx+kK6QhXJ1Nm+4nS9dUHqqYmzjeuSC+yhiP8HiLlg3ntdn34VWmKbBhRCHy5JZfcZ9gs=","X-Received":"by 2002:a05:651c:1b8:: with SMTP id\n\tc24mr22206443ljn.520.1633427632273; \n\tTue, 05 Oct 2021 02:53:52 -0700 (PDT)","MIME-Version":"1.0","References":"<20211005085700.16708-1-david.plowman@raspberrypi.com>\n\t<20211005085700.16708-2-david.plowman@raspberrypi.com>","In-Reply-To":"<20211005085700.16708-2-david.plowman@raspberrypi.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Tue, 5 Oct 2021 10:53:36 +0100","Message-ID":"<CAEmqJPqMS17oyXEmEYapLWp=k3qBgw5mDJt_444aBiEO-1oNRA@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Content-Type":"multipart/alternative; boundary=\"000000000000c9cd7d05cd9801e5\"","Subject":"Re: [libcamera-devel] [PATCH v2 1/1] pipeline: raspberrypi: Create\n\tempty control lists correctly","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]