[{"id":20824,"web_url":"https://patchwork.libcamera.org/comment/20824/","msgid":"<163658119365.2121661.9827191415017536147@Monstersaurus>","date":"2021-11-10T21:53:13","subject":"Re: [libcamera-devel] [PATCH v2 02/14] ipu3: ipa: Report effective\n\tsensor controls with statistics to IPA","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Jean-Michel Hautbois (2021-11-10 19:58:49)\n> From: Han-Lin Chen <hanlinchen@chromium.org>\n> \n> The Intel close sourced IPA requires the effective controls applied to\n> the sensor when the statistics are generated. Report effective sensor controls\n> with the statistics to IPA.\n> \n> Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n> [Jean-Michel: Reword s/stastistics/statistics and move reset after IPA\n> start]\n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/ipu3/frames.h | 4 ++++\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 9 +++++++++\n>  2 files changed, 13 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h\n> index 3ef7e445..614701e2 100644\n> --- a/src/libcamera/pipeline/ipu3/frames.h\n> +++ b/src/libcamera/pipeline/ipu3/frames.h\n> @@ -14,6 +14,8 @@\n>  \n>  #include <libcamera/base/signal.h>\n>  \n> +#include <libcamera/controls.h>\n> +\n>  namespace libcamera {\n>  \n>  class FrameBuffer;\n> @@ -34,6 +36,8 @@ public:\n>                 FrameBuffer *paramBuffer;\n>                 FrameBuffer *statBuffer;\n>  \n> +               ControlList effectiveSensorControls;\n> +\n>                 bool paramDequeued;\n>                 bool metadataProcessed;\n>         };\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 8816efc5..3fcfa777 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -767,6 +767,12 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis\n>         if (ret)\n>                 goto error;\n>  \n> +       /*\n> +        * Reset the delayed controls with the gain and exposure values set by\n> +        * the IPA.\n\nThis seems to imply that resetting it is setting some values. Is that\naccurate?\n\nLooking at DelayedControls::reset() - it reads the controls from the\ndevice. Has the IPA already 'set' some controls before this point (not\nthrough the DelayedControls...)\n\nOther than that,\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> +        */\n> +       data->delayedCtrls_->reset();\n> +\n>         /*\n>          * Start the ImgU video devices, buffers will be queued to the\n>          * ImgU output and viewfinder when requests will be queued.\n> @@ -1363,6 +1369,8 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n>         request->metadata().set(controls::SensorTimestamp,\n>                                 buffer->metadata().timestamp);\n>  \n> +       info->effectiveSensorControls = delayedCtrls_->get(buffer->metadata().sequence);\n> +\n>         if (request->findBuffer(&rawStream_))\n>                 pipe()->completeBuffer(request, buffer);\n>  \n> @@ -1419,6 +1427,7 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer)\n>         ev.frame = info->id;\n>         ev.bufferId = info->statBuffer->cookie();\n>         ev.frameTimestamp = request->metadata().get(controls::SensorTimestamp);\n> +       ev.sensorControls = info->effectiveSensorControls;\n>         ipa_->processEvent(ev);\n>  }\n>  \n> -- \n> 2.32.0\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 D1F97BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 10 Nov 2021 21:53:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 53D9D6035D;\n\tWed, 10 Nov 2021 22:53:17 +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 CF05F6033C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Nov 2021 22:53:16 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 755098B6;\n\tWed, 10 Nov 2021 22:53:16 +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=\"GdpZm0Jc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636581196;\n\tbh=6iEPdfJqOzE+N24cH6Z15t5YCKOlP3isE4oSEHvoKD8=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=GdpZm0Jc4+PhjcplJcxbjy4Pf9ffTDGSUXe9XWtkXIeW3dy/RKVZW3XTwboHvyWio\n\thhp+htV4deKlXHP8Ey+Xo3YhwyQ5c9XKQ6vo9HSyaU4k5ClabX4N3zztiwpJnbZ/wI\n\tC0OpOuIKFiD7RqmHRU0ihpjeXSPwzqI02sXDETiI=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211110195901.85597-3-jeanmichel.hautbois@ideasonboard.com>","References":"<20211110195901.85597-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211110195901.85597-3-jeanmichel.hautbois@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 10 Nov 2021 21:53:13 +0000","Message-ID":"<163658119365.2121661.9827191415017536147@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2 02/14] ipu3: ipa: Report effective\n\tsensor controls with statistics to IPA","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":20842,"web_url":"https://patchwork.libcamera.org/comment/20842/","msgid":"<e4f48c1a-3b3c-b76b-3e2e-153baac99531@ideasonboard.com>","date":"2021-11-11T08:03:04","subject":"Re: [libcamera-devel] [PATCH v2 02/14] ipu3: ipa: Report effective\n\tsensor controls with statistics to IPA","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"On 10/11/2021 22:53, Kieran Bingham wrote:\n> Quoting Jean-Michel Hautbois (2021-11-10 19:58:49)\n>> From: Han-Lin Chen <hanlinchen@chromium.org>\n>>\n>> The Intel close sourced IPA requires the effective controls applied to\n>> the sensor when the statistics are generated. Report effective sensor controls\n>> with the statistics to IPA.\n>>\n>> Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n>> [Jean-Michel: Reword s/stastistics/statistics and move reset after IPA\n>> start]\n>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>> ---\n>>   src/libcamera/pipeline/ipu3/frames.h | 4 ++++\n>>   src/libcamera/pipeline/ipu3/ipu3.cpp | 9 +++++++++\n>>   2 files changed, 13 insertions(+)\n>>\n>> diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h\n>> index 3ef7e445..614701e2 100644\n>> --- a/src/libcamera/pipeline/ipu3/frames.h\n>> +++ b/src/libcamera/pipeline/ipu3/frames.h\n>> @@ -14,6 +14,8 @@\n>>   \n>>   #include <libcamera/base/signal.h>\n>>   \n>> +#include <libcamera/controls.h>\n>> +\n>>   namespace libcamera {\n>>   \n>>   class FrameBuffer;\n>> @@ -34,6 +36,8 @@ public:\n>>                  FrameBuffer *paramBuffer;\n>>                  FrameBuffer *statBuffer;\n>>   \n>> +               ControlList effectiveSensorControls;\n>> +\n>>                  bool paramDequeued;\n>>                  bool metadataProcessed;\n>>          };\n>> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n>> index 8816efc5..3fcfa777 100644\n>> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n>> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n>> @@ -767,6 +767,12 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis\n>>          if (ret)\n>>                  goto error;\n>>   \n>> +       /*\n>> +        * Reset the delayed controls with the gain and exposure values set by\n>> +        * the IPA.\n> \n> This seems to imply that resetting it is setting some values. Is that\n> accurate?\n> \n> Looking at DelayedControls::reset() - it reads the controls from the\n> device. Has the IPA already 'set' some controls before this point (not\n> through the DelayedControls...)\n> \n\nNot yet, except HFLIP and VFLIP controls, which are not useful for us in \nthis ? Maybe some later ? I must say this is what RPi is doing too :-).\n\n> Other than that,\n> \n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n>> +        */\n>> +       data->delayedCtrls_->reset();\n>> +\n>>          /*\n>>           * Start the ImgU video devices, buffers will be queued to the\n>>           * ImgU output and viewfinder when requests will be queued.\n>> @@ -1363,6 +1369,8 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n>>          request->metadata().set(controls::SensorTimestamp,\n>>                                  buffer->metadata().timestamp);\n>>   \n>> +       info->effectiveSensorControls = delayedCtrls_->get(buffer->metadata().sequence);\n>> +\n>>          if (request->findBuffer(&rawStream_))\n>>                  pipe()->completeBuffer(request, buffer);\n>>   \n>> @@ -1419,6 +1427,7 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer)\n>>          ev.frame = info->id;\n>>          ev.bufferId = info->statBuffer->cookie();\n>>          ev.frameTimestamp = request->metadata().get(controls::SensorTimestamp);\n>> +       ev.sensorControls = info->effectiveSensorControls;\n>>          ipa_->processEvent(ev);\n>>   }\n>>   \n>> -- \n>> 2.32.0\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 64683BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Nov 2021 08:03:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C8E076035A;\n\tThu, 11 Nov 2021 09:03:08 +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 5C5AC6032C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Nov 2021 09:03:07 +0100 (CET)","from [IPV6:2a01:e0a:169:7140:e627:8337:a781:d98] (unknown\n\t[IPv6:2a01:e0a:169:7140:e627:8337:a781:d98])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 11AC14A0;\n\tThu, 11 Nov 2021 09:03:07 +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=\"MBck5mBh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636617787;\n\tbh=qNwRTjv+etnD9r2BnegmxBlzFHMGflDK4NFL0PH9uys=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=MBck5mBhqKxaBDmyB41w2zjvkr1fNJEwGCr5/dDVaAu7gqtrtPlVOekAjraNZvml0\n\tQUEtY0WvJIdhhybcSk6qc710LnEsqLP+LWEnYd9ji7ZU24t8K/PGLsZschxqAln7NW\n\tZgnyvkFROiuNBFCZspUv2mCD2+rGgE9JvnLEoR3Q=","Message-ID":"<e4f48c1a-3b3c-b76b-3e2e-153baac99531@ideasonboard.com>","Date":"Thu, 11 Nov 2021 09:03:04 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.2.1","Content-Language":"en-US","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20211110195901.85597-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211110195901.85597-3-jeanmichel.hautbois@ideasonboard.com>\n\t<163658119365.2121661.9827191415017536147@Monstersaurus>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","In-Reply-To":"<163658119365.2121661.9827191415017536147@Monstersaurus>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v2 02/14] ipu3: ipa: Report effective\n\tsensor controls with statistics to IPA","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>"}}]