[{"id":13894,"web_url":"https://patchwork.libcamera.org/comment/13894/","msgid":"<CAEmqJPpxhcb1ciBrT_GV+6gn2qGBO6Q0dcjio6yJBVoCuVYCFg@mail.gmail.com>","date":"2020-11-26T09:27:39","subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","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 your patch.  You beat me to it, I had a similar change in my\nframerate set (but limited to 66ms) :)\n\nOn Wed, 25 Nov 2020 at 11:36, David Plowman <david.plowman@raspberrypi.com>\nwrote:\n\n> The exposure times in the exposure modes were causing AGC oscillations\n> because the algorithm was demanding long unachievable exposure times\n> but, without working sensor metadata, thought it was getting them when\n> actually it was not. We fix it by making the exposure profile request\n> only achievable exposure times, as we do for the ov5647 tuning.\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n>\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n\n> ---\n>  src/ipa/raspberrypi/data/imx219.json | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/ipa/raspberrypi/data/imx219.json\n> b/src/ipa/raspberrypi/data/imx219.json\n> index b03a7beb..212f8b9a 100644\n> --- a/src/ipa/raspberrypi/data/imx219.json\n> +++ b/src/ipa/raspberrypi/data/imx219.json\n> @@ -133,7 +133,7 @@\n>              {\n>                  \"shutter\":\n>                  [\n> -                    100, 10000, 30000, 60000, 120000\n> +                    100, 10000, 30000, 30000, 30000\n>                  ],\n>                  \"gain\":\n>                  [\n> @@ -144,7 +144,7 @@\n>              {\n>                  \"shutter\":\n>                  [\n> -                    100, 5000, 10000, 20000, 120000\n> +                    100, 5000, 10000, 20000, 30000\n>                  ],\n>                  \"gain\":\n>                  [\n> --\n> 2.20.1\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel\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 3EC80BE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Nov 2020 09:27:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0E0836343F;\n\tThu, 26 Nov 2020 10:27:58 +0100 (CET)","from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com\n\t[IPv6:2a00:1450:4864:20::22c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C0BC60331\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 10:27:56 +0100 (CET)","by mail-lj1-x22c.google.com with SMTP id 142so1557517ljj.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 01:27:56 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"lPk2r1j7\"; 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=5f9V8aV6s5Lrxl9fotlmLF1D9x9IdjQS8OtXogcf+Q8=;\n\tb=lPk2r1j7tDFW3IEFa4ZuCKC/2XUBHuR03moQOs6f5Bt/NnUa41J4S+h4kKnF3N5X5H\n\tEEytpdifLYz/vaMUfWhFC//zmR2t7kJm9a9PWogyYSX4J3Rh7s3ktt71JVXcmWOEerKX\n\ty4Vyep0GNFt4RkGdMlqeJ3XF7IAzfFtavc9vHgH9JgloczSZI8REuMP0ocrU/x05jUae\n\tqQzX02buOCTqUnlqm1YCwhyXt6OXWBTT20Rk7DM8obQGhMJeeCxxs1vlnjTVgahPLXxe\n\tk90yXM6CyQWVXs279Okw9VkI5XA2RuTtH5tA8BIBvms6aewQHk6Qx8BdsqwS/L5Vi9GC\n\t2ZwQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=5f9V8aV6s5Lrxl9fotlmLF1D9x9IdjQS8OtXogcf+Q8=;\n\tb=GCmI83YWll/fpmF6SqziMPO2g/2j6gbZQq35CTKx6L0ui0gCUFwbTudxuiJO53VSN8\n\tk+G5SAYn3HL214rZJ5MDiL760iuSZ3zVo2UzWnhg9SiDtP2L5DcnP6/+F55oH82Ol3vN\n\tkK2bmbB51u3spqnhSAoeiYI8FS0aLzVNM9WWNHko4srzwvrfJgXYFVW3Un4nw+BMHOH0\n\t66R8SUxwVkL+L6LKwYn/3NtmuTkFx2px9xGGZWJUyeJMrae7zjIqcAnnB1kqX/ZZD41m\n\t/qSm+xSkaQzvyiGtF/16U4T8A6ByjzeNDqMFm0jUh9WvQkT7pGKcuCJUxEJy2UUkhSf7\n\teTMA==","X-Gm-Message-State":"AOAM533bpAnUf1day/fciZOES1Wu9cZ3vpgf4acccGD8eG4YbjP1Ho/u\n\tPb803PujBMOaRKj1anS19ysyVBHmULm8naRsDs8hV8n2S0I=","X-Google-Smtp-Source":"ABdhPJyB7YR4jyttMwPIEvL3wxN43UUmlbEsQH7wSUpLo1uTNXVUQ57Og69TzyI5UVGXi2hFCT4KsJwzGm0ZTQsNMis=","X-Received":"by 2002:a2e:9a02:: with SMTP id o2mr907270lji.1.1606382875800;\n\tThu, 26 Nov 2020 01:27:55 -0800 (PST)","MIME-Version":"1.0","References":"<20201125113640.20246-1-david.plowman@raspberrypi.com>\n\t<20201125113640.20246-4-david.plowman@raspberrypi.com>","In-Reply-To":"<20201125113640.20246-4-david.plowman@raspberrypi.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Thu, 26 Nov 2020 09:27:39 +0000","Message-ID":"<CAEmqJPpxhcb1ciBrT_GV+6gn2qGBO6Q0dcjio6yJBVoCuVYCFg@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","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>","Content-Type":"multipart/mixed;\n\tboundary=\"===============7301139364889051646==\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13901,"web_url":"https://patchwork.libcamera.org/comment/13901/","msgid":"<20201126102002.GC3905@pendragon.ideasonboard.com>","date":"2020-11-26T10:20:02","subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","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 Wed, Nov 25, 2020 at 11:36:40AM +0000, David Plowman wrote:\n> The exposure times in the exposure modes were causing AGC oscillations\n> because the algorithm was demanding long unachievable exposure times\n> but, without working sensor metadata, thought it was getting them when\n> actually it was not. We fix it by making the exposure profile request\n> only achievable exposure times, as we do for the ov5647 tuning.\n\nThis looks good to me, and I assume it will still work with sensor\nembedded data, as unachievable exposure times are, well, unachievable\n:-)\n\nIs the process to select shutter values documented in the RPi camera\ndocumentation, or the tuning tool ? If someone wants to bring up a new\nsensor, how can we ensure a similar bug will not creep in ?\n\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/ipa/raspberrypi/data/imx219.json | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/ipa/raspberrypi/data/imx219.json b/src/ipa/raspberrypi/data/imx219.json\n> index b03a7beb..212f8b9a 100644\n> --- a/src/ipa/raspberrypi/data/imx219.json\n> +++ b/src/ipa/raspberrypi/data/imx219.json\n> @@ -133,7 +133,7 @@\n>              {\n>                  \"shutter\":\n>                  [\n> -                    100, 10000, 30000, 60000, 120000\n> +                    100, 10000, 30000, 30000, 30000\n>                  ],\n>                  \"gain\":\n>                  [\n> @@ -144,7 +144,7 @@\n>              {\n>                  \"shutter\":\n>                  [\n> -                    100, 5000, 10000, 20000, 120000\n> +                    100, 5000, 10000, 20000, 30000\n>                  ],\n>                  \"gain\":\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 9653BBE176\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Nov 2020 10:20:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 254576344A;\n\tThu, 26 Nov 2020 11:20:13 +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 062606343C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 11:20:12 +0100 (CET)","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 5B7EDA1B;\n\tThu, 26 Nov 2020 11:20:11 +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=\"pjszAUi7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1606386011;\n\tbh=FOBkSD0b+As67RjQH8QpZlURDayOFaxoHzG9T4/o9JE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=pjszAUi73rR9oROF/19wudk0e23BLBcx2lkCN5bq2dUdRUuymG+SlJtwRk9xl4nBo\n\tG6LnxdlinS2Z27WDWsd8TrLYQhqKCh7HgmQTQTOtBdZTtK8vtK2BboGOkkSYMyT140\n\tkGwgwiVzwTF6Y/yG54NcziuEtW3MresMbhNjEEL4=","Date":"Thu, 26 Nov 2020 12:20:02 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<20201126102002.GC3905@pendragon.ideasonboard.com>","References":"<20201125113640.20246-1-david.plowman@raspberrypi.com>\n\t<20201125113640.20246-4-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201125113640.20246-4-david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","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","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13904,"web_url":"https://patchwork.libcamera.org/comment/13904/","msgid":"<CAEmqJPqYxPjCxYU+kxBTRMVoN4You-WpmqBHnAkU0q9U418tNQ@mail.gmail.com>","date":"2020-11-26T10:37:47","subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\nOn Thu, 26 Nov 2020 at 10:20, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi David,\n>\n> Thank you for the patch.\n>\n> On Wed, Nov 25, 2020 at 11:36:40AM +0000, David Plowman wrote:\n> > The exposure times in the exposure modes were causing AGC oscillations\n> > because the algorithm was demanding long unachievable exposure times\n> > but, without working sensor metadata, thought it was getting them when\n> > actually it was not. We fix it by making the exposure profile request\n> > only achievable exposure times, as we do for the ov5647 tuning.\n>\n> This looks good to me, and I assume it will still work with sensor\n> embedded data, as unachievable exposure times are, well, unachievable\n> :-)\n>\n> Is the process to select shutter values documented in the RPi camera\n> documentation, or the tuning tool ? If someone wants to bring up a new\n> sensor, how can we ensure a similar bug will not creep in ?\n>\n\nMy work on FPS control does fix this problem in a generic way for\nnon-embedded data sensors.  This is done by ensuring we only send exposure\nvalues that will be validated based on vblank limits, thereby ensuring the\nreturn path (without embedded data) will be given the same values used by\nthe sensor device.   For embedded data sensors,  it all \"just works\", hence\nour preference to use it where available ;-)\n\nRegards,\nNaush\n\n\n\n>\n> > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> > ---\n> >  src/ipa/raspberrypi/data/imx219.json | 4 ++--\n> >  1 file changed, 2 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/src/ipa/raspberrypi/data/imx219.json\n> b/src/ipa/raspberrypi/data/imx219.json\n> > index b03a7beb..212f8b9a 100644\n> > --- a/src/ipa/raspberrypi/data/imx219.json\n> > +++ b/src/ipa/raspberrypi/data/imx219.json\n> > @@ -133,7 +133,7 @@\n> >              {\n> >                  \"shutter\":\n> >                  [\n> > -                    100, 10000, 30000, 60000, 120000\n> > +                    100, 10000, 30000, 30000, 30000\n> >                  ],\n> >                  \"gain\":\n> >                  [\n> > @@ -144,7 +144,7 @@\n> >              {\n> >                  \"shutter\":\n> >                  [\n> > -                    100, 5000, 10000, 20000, 120000\n> > +                    100, 5000, 10000, 20000, 30000\n> >                  ],\n> >                  \"gain\":\n> >                  [\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel\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 5AFBABE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Nov 2020 10:38:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 261906345B;\n\tThu, 26 Nov 2020 11:38:06 +0100 (CET)","from mail-lf1-x134.google.com (mail-lf1-x134.google.com\n\t[IPv6:2a00:1450:4864:20::134])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5ACA9633EF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 11:38:04 +0100 (CET)","by mail-lf1-x134.google.com with SMTP id u19so1814673lfr.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 02:38:04 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"QNJvx8CP\"; 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=eM6Jt74ME0ee6wlo1LXmY3xDe3i3g78ggWcJwANHEGY=;\n\tb=QNJvx8CPkWUWaFV9VBUy+falwi77s48qW/5AxxdLikqbGDlzgDuevsPXWXxvX2rmIc\n\ttFAeFuhDPS3KP5x7ZX+1Z3uftzUP79esNhZHpMO0+wpcmkl5aQ8ZGFZ8SBOUlfeHR673\n\tFp2dyqLmoTLJK2vyNf86BQ9Zru6wwOSXg4wNkpe8QVcs9rQprZGEtDQPoygZtdp0+U+m\n\tL5BdGxrzOdjOKPx9TBsjSQ75wu3zFSdn50+yxKY69IEAcBXogUuFbKr+tQ84169eu2bE\n\tEn3VeqmhHbwQSw4VuotVtO/284z1vZLCona7tMusoVuJ7+69X8uOCuyqT5+JklsIrKbV\n\tgvUA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=eM6Jt74ME0ee6wlo1LXmY3xDe3i3g78ggWcJwANHEGY=;\n\tb=DSWB3+7acLkthC6PbX9XDRWbzHFPp0XteEi3vJlb6sFBnwKGrSFJZa7V1xv8D28ARe\n\tacQA1cclRyaNn1BTUv+eSJhERMEOqLUSQGHj9M68sPDSqrqevhmg91vfoMvQOqHne/V0\n\tWpU3QYZ17ihIGGdASs6PIX+gH8oyxREUx7G/Z5UPH0bI/Pv2Xjy5A717jGt9+EaE8oRa\n\tWLf3xZkJXAlNvM1BlbDmctXbfrxKRDvmGCn9zQhsq1KovD1gnt31sYhcoRxty11uT9nu\n\tSMVDXreUtIok6XEIqEACYI0COWLtBMQm7RWY0zTuNd/p4PrQzxAdKLKg7/LzEP2RPKlV\n\tBi8g==","X-Gm-Message-State":"AOAM531zEHMWB8S/BVc0oJXnDmj+xV0RZLfqgnZLqZJrRgs2Mhn65d+Y\n\tkNxHknz+EehK13gXW12uXrewi63u541T075t28AsFw==","X-Google-Smtp-Source":"ABdhPJzbunTk+mr1ZeXfMkuXs+bTZWdcbEYA15EqIYFeJGG07huEMotXB0xo5UiVJcLxW/k+wz/en8Tnkdd55oRohr4=","X-Received":"by 2002:a05:6512:3e6:: with SMTP id\n\tn6mr1096309lfq.413.1606387083835; \n\tThu, 26 Nov 2020 02:38:03 -0800 (PST)","MIME-Version":"1.0","References":"<20201125113640.20246-1-david.plowman@raspberrypi.com>\n\t<20201125113640.20246-4-david.plowman@raspberrypi.com>\n\t<20201126102002.GC3905@pendragon.ideasonboard.com>","In-Reply-To":"<20201126102002.GC3905@pendragon.ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Thu, 26 Nov 2020 10:37:47 +0000","Message-ID":"<CAEmqJPqYxPjCxYU+kxBTRMVoN4You-WpmqBHnAkU0q9U418tNQ@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","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>","Content-Type":"multipart/mixed;\n\tboundary=\"===============3627943059573441539==\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13913,"web_url":"https://patchwork.libcamera.org/comment/13913/","msgid":"<20201126130259.GI3905@pendragon.ideasonboard.com>","date":"2020-11-26T13:02:59","subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nOn Thu, Nov 26, 2020 at 10:37:47AM +0000, Naushir Patuck wrote:\n> On Thu, 26 Nov 2020 at 10:20, Laurent Pinchart wrote:\n> > On Wed, Nov 25, 2020 at 11:36:40AM +0000, David Plowman wrote:\n> > > The exposure times in the exposure modes were causing AGC oscillations\n> > > because the algorithm was demanding long unachievable exposure times\n> > > but, without working sensor metadata, thought it was getting them when\n> > > actually it was not. We fix it by making the exposure profile request\n> > > only achievable exposure times, as we do for the ov5647 tuning.\n> >\n> > This looks good to me, and I assume it will still work with sensor\n> > embedded data, as unachievable exposure times are, well, unachievable\n> > :-)\n> >\n> > Is the process to select shutter values documented in the RPi camera\n> > documentation, or the tuning tool ? If someone wants to bring up a new\n> > sensor, how can we ensure a similar bug will not creep in ?\n> \n> My work on FPS control does fix this problem in a generic way for\n> non-embedded data sensors. This is done by ensuring we only send exposure\n> values that will be validated based on vblank limits, thereby ensuring the\n> return path (without embedded data) will be given the same values used by\n> the sensor device. For embedded data sensors, it all \"just works\", hence\n> our preference to use it where available ;-)\n\nWouldn't algorithms still be able to do a better job when splitting\nsensitivity control between exposure time and gain if they know\nbeforehand what exposure times are achievable, instead of waiting for\nthe embedded data to report the actual value later ? My concern here is\nthat I don't see any reason why it would be desirable to specify\nunachievable shutter times in the tuning parameters, so we should try to\navoid it, especially if it can degrade performances. Making sure we\ndocument this properly would be a good first step.\n\n> > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> >\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> >\n> > > ---\n> > >  src/ipa/raspberrypi/data/imx219.json | 4 ++--\n> > >  1 file changed, 2 insertions(+), 2 deletions(-)\n> > >\n> > > diff --git a/src/ipa/raspberrypi/data/imx219.json b/src/ipa/raspberrypi/data/imx219.json\n> > > index b03a7beb..212f8b9a 100644\n> > > --- a/src/ipa/raspberrypi/data/imx219.json\n> > > +++ b/src/ipa/raspberrypi/data/imx219.json\n> > > @@ -133,7 +133,7 @@\n> > >              {\n> > >                  \"shutter\":\n> > >                  [\n> > > -                    100, 10000, 30000, 60000, 120000\n> > > +                    100, 10000, 30000, 30000, 30000\n> > >                  ],\n> > >                  \"gain\":\n> > >                  [\n> > > @@ -144,7 +144,7 @@\n> > >              {\n> > >                  \"shutter\":\n> > >                  [\n> > > -                    100, 5000, 10000, 20000, 120000\n> > > +                    100, 5000, 10000, 20000, 30000\n> > >                  ],\n> > >                  \"gain\":\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 F0280BE176\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Nov 2020 13:03:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8675163446;\n\tThu, 26 Nov 2020 14:03:10 +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 A4C9B63408\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 14:03:08 +0100 (CET)","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 177C3A1B;\n\tThu, 26 Nov 2020 14:03:08 +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=\"It5+7kXX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1606395788;\n\tbh=FL9L/TXuA28GrhRIU/niv1rp/UAHrqYzKpWWibojZv4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=It5+7kXXrvErPw7763m31fuVwmUgj7Vf1Hp8LZmKpfT/5dHTbFauOBVHtnlPD1tTz\n\tIPLTTUvAON5+segl/ccZvDPKPjaBj0/q/wY6Gz/2ohrV464rz8vnlptP9MWMLKpb5D\n\tRAk2EO2MKV3ipknGN9WBgqFamIdHOAHM31z0UzUU=","Date":"Thu, 26 Nov 2020 15:02:59 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<20201126130259.GI3905@pendragon.ideasonboard.com>","References":"<20201125113640.20246-1-david.plowman@raspberrypi.com>\n\t<20201125113640.20246-4-david.plowman@raspberrypi.com>\n\t<20201126102002.GC3905@pendragon.ideasonboard.com>\n\t<CAEmqJPqYxPjCxYU+kxBTRMVoN4You-WpmqBHnAkU0q9U418tNQ@mail.gmail.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<CAEmqJPqYxPjCxYU+kxBTRMVoN4You-WpmqBHnAkU0q9U418tNQ@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13917,"web_url":"https://patchwork.libcamera.org/comment/13917/","msgid":"<CAEmqJPrMivUqggj42aoPkNhPDsLGqVOEVh=2H3EZhfQ4E_bx1A@mail.gmail.com>","date":"2020-11-26T14:07:28","subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\nOn Thu, 26 Nov 2020 at 13:03, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Naush,\n>\n> On Thu, Nov 26, 2020 at 10:37:47AM +0000, Naushir Patuck wrote:\n> > On Thu, 26 Nov 2020 at 10:20, Laurent Pinchart wrote:\n> > > On Wed, Nov 25, 2020 at 11:36:40AM +0000, David Plowman wrote:\n> > > > The exposure times in the exposure modes were causing AGC\n> oscillations\n> > > > because the algorithm was demanding long unachievable exposure times\n> > > > but, without working sensor metadata, thought it was getting them\n> when\n> > > > actually it was not. We fix it by making the exposure profile request\n> > > > only achievable exposure times, as we do for the ov5647 tuning.\n> > >\n> > > This looks good to me, and I assume it will still work with sensor\n> > > embedded data, as unachievable exposure times are, well, unachievable\n> > > :-)\n> > >\n> > > Is the process to select shutter values documented in the RPi camera\n> > > documentation, or the tuning tool ? If someone wants to bring up a new\n> > > sensor, how can we ensure a similar bug will not creep in ?\n> >\n> > My work on FPS control does fix this problem in a generic way for\n> > non-embedded data sensors. This is done by ensuring we only send exposure\n> > values that will be validated based on vblank limits, thereby ensuring\n> the\n> > return path (without embedded data) will be given the same values used by\n> > the sensor device. For embedded data sensors, it all \"just works\", hence\n> > our preference to use it where available ;-)\n>\n> Wouldn't algorithms still be able to do a better job when splitting\n> sensitivity control between exposure time and gain if they know\n> beforehand what exposure times are achievable, instead of waiting for\n> the embedded data to report the actual value later ?\n\n\nYes, this would certainly help.  In practise we make do with digital gain\nto make up the difference in the Raspberry Pi AGC.  This is again tied into\nthe whole subject of framerate control.  At the end of the day, framerate\n(and vblank time) is what limits the shutter times available to use.  Once\nwe have framerates available to play with, these can be passed into the AGC\nalgorithm to restrict exposure times.\n\nHowever, this will not stop a user from setting up exposure profiles that\nrequest larger shutter speeds than what is achievable given fps\nconstraints.  In these cases, the user will not get what he wants, unless\nhe sets the framerate appropriately.\n\nRegards,\nNaush\n\n\n\n> My concern here is\n> that I don't see any reason why it would be desirable to specify\n> unachievable shutter times in the tuning parameters, so we should try to\n> avoid it, especially if it can degrade performances. Making sure we\n> document this properly would be a good first step.\n>\n\n\n\n\n>\n> > > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > >\n> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > >\n> > > > ---\n> > > >  src/ipa/raspberrypi/data/imx219.json | 4 ++--\n> > > >  1 file changed, 2 insertions(+), 2 deletions(-)\n> > > >\n> > > > diff --git a/src/ipa/raspberrypi/data/imx219.json\n> b/src/ipa/raspberrypi/data/imx219.json\n> > > > index b03a7beb..212f8b9a 100644\n> > > > --- a/src/ipa/raspberrypi/data/imx219.json\n> > > > +++ b/src/ipa/raspberrypi/data/imx219.json\n> > > > @@ -133,7 +133,7 @@\n> > > >              {\n> > > >                  \"shutter\":\n> > > >                  [\n> > > > -                    100, 10000, 30000, 60000, 120000\n> > > > +                    100, 10000, 30000, 30000, 30000\n> > > >                  ],\n> > > >                  \"gain\":\n> > > >                  [\n> > > > @@ -144,7 +144,7 @@\n> > > >              {\n> > > >                  \"shutter\":\n> > > >                  [\n> > > > -                    100, 5000, 10000, 20000, 120000\n> > > > +                    100, 5000, 10000, 20000, 30000\n> > > >                  ],\n> > > >                  \"gain\":\n> > > >                  [\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\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 0417BBE176\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Nov 2020 14:07:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 63D116345A;\n\tThu, 26 Nov 2020 15:07:47 +0100 (CET)","from mail-lj1-x229.google.com (mail-lj1-x229.google.com\n\t[IPv6:2a00:1450:4864:20::229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D19C63408\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 15:07:45 +0100 (CET)","by mail-lj1-x229.google.com with SMTP id f24so2446562ljk.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 06:07:45 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"JytuAhGQ\"; 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=bagkeOJ6IK9E2ov9IKqTYoxcCOpcroHmvd8v1j17e6c=;\n\tb=JytuAhGQy0/mhOsB1peUrJ5e+iKuWxGi9+pkp10Vl6ZFF2eO7aF7u/0YeWb04Y/uma\n\td6ZwQsVSre2rW1SVyjHG1PxLlTJd+/yskOXv9Wdzqc7S0nD04PHK0SaHQVXroG3mpBLM\n\ttlosF5fklTSvKin8bBoOfVOfYyVSoydtM+2PmK0CPAcDYkYc1mMJugWdbNeCri+WIGS7\n\tI9e7Ol2BycYB4BM2M9yzIOvfluT2glVjPGYnuieG1jzgZn//mnMK65+4k8NUU9wvVUjF\n\t6dRZz2xkUZ1JCYWE50GFnFIYZoQAJLLYPNEFVsKl1RRPLzvRRJ+w4L6DRE0a0gOUdbI9\n\tHcLw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=bagkeOJ6IK9E2ov9IKqTYoxcCOpcroHmvd8v1j17e6c=;\n\tb=F/yW7ypA+J1Vwn+z5lWp5TP9VNdfD/KssRp225MO6H/PMUrzuuFu/fXgD1hYIf9KFx\n\tPTBL2p5fIzr8DatGaXfkefO49toGumRo6KcnsFXltIe1A0EsfPHZtCjlTiz8Cfeu5oqG\n\t1QxeO8f6pp/IwstRMBAL60BqYec4LJtfDHXMz4yUgiX2CvHI4rkJb7RXjN3KEOZvpKPd\n\tUNxQIWYVLBo7wcdnhirj0HA4LGnt2QrM94NqqantfG5aAm/relIAbmG2OMPxEXDMY1nA\n\t6IE3YaMxnm/maxtewD7f7qP80lsdWsZWhNRiAdbLg2Ot2+lLtXWj5a1bIhN+PZ5ZtaNt\n\tOECg==","X-Gm-Message-State":"AOAM531UhGK3J9wYcFvVjUdSsJUOHsvDwWi0FV+A+cbx5L9kDrEHUapk\n\tCBFkYhBgiEVqo19GLE5oxrAFfzE41l6sebdsOvmung==","X-Google-Smtp-Source":"ABdhPJwtSJzVs3F/fx3+vcAMVtNSTyDp1yuc2brTZkbbbgS6sh53yOSI8EKol/ICGXsHaoJBOTDAmWiZsbd1ggERxhg=","X-Received":"by 2002:a2e:84c7:: with SMTP id q7mr1359589ljh.415.1606399664647;\n\tThu, 26 Nov 2020 06:07:44 -0800 (PST)","MIME-Version":"1.0","References":"<20201125113640.20246-1-david.plowman@raspberrypi.com>\n\t<20201125113640.20246-4-david.plowman@raspberrypi.com>\n\t<20201126102002.GC3905@pendragon.ideasonboard.com>\n\t<CAEmqJPqYxPjCxYU+kxBTRMVoN4You-WpmqBHnAkU0q9U418tNQ@mail.gmail.com>\n\t<20201126130259.GI3905@pendragon.ideasonboard.com>","In-Reply-To":"<20201126130259.GI3905@pendragon.ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Thu, 26 Nov 2020 14:07:28 +0000","Message-ID":"<CAEmqJPrMivUqggj42aoPkNhPDsLGqVOEVh=2H3EZhfQ4E_bx1A@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] src: ipa: raspberrypi: Fix\n\tinitial AGC oscillation for imx219 sensor","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>","Content-Type":"multipart/mixed;\n\tboundary=\"===============4702318488089530939==\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]