[{"id":4940,"web_url":"https://patchwork.libcamera.org/comment/4940/","msgid":"<CAHW6GYLJRB_bNN3P-mkPd8LThUF+Pn=OSUGzhZ_dGgrJHRCu0g@mail.gmail.com>","date":"2020-05-28T16:06:46","subject":"Re: [libcamera-devel] [PATCH] pipeline: raspberrypi: Fix for\n\tstaggered write on reset","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for submitting this one!\n\nOn Thu, 28 May 2020 at 15:56, Naushir Patuck <naush@raspberrypi.com> wrote:\n\n> The reset function in staggered write was using the wrong index when\n> looking for the last updated camera parameters. This would cause\n> possibly stale exposure values to be written to the camera on a\n> mode switch for captures.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\n> b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\n> index 391e13f5..b26fa63d 100644\n> --- a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\n> @@ -46,7 +46,7 @@ void StaggeredCtrl::reset()\n>  {\n>         std::lock_guard<std::mutex> lock(lock_);\n>\n> -       int lastSetCount = std::max<int>(0, setCount_ - 1);\n> +       int lastSetCount = std::max<int>(0, setCount_);\n>\n\nActually I wonder whether we shouldn't just go with\n\n       uint32_t lastSetCount = setCount_;\n\n(the std::max seems a bit redundant now that we don't subtract 1).\n\n\n>         std::unordered_map<uint32_t, int32_t> lastVal;\n>\n>         /* Reset the counters. */\n> --\n> 2.25.1\n>\n>","headers":{"Return-Path":"<david.plowman@raspberrypi.com>","Received":["from mail-oo1-xc42.google.com (mail-oo1-xc42.google.com\n\t[IPv6:2607:f8b0:4864:20::c42])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 41BFF603D3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 May 2020 18:06:58 +0200 (CEST)","by mail-oo1-xc42.google.com with SMTP id e12so178219oou.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 May 2020 09:06:58 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"HA9BdMq/\"; 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=NSjBnkpZMSibCO0vEeOvJxQf5ptoML3hsvNL8eH7lOc=;\n\tb=HA9BdMq/efJKGc+Dk8foHj1lsKvpRuNmXaR6IkjkRpDAn79NP3LRNv6Q463AUOgoOI\n\tMa3c/mN9fecm0YINCy0tZJcwq3kqcCdQeiShyiwqIZARPsd0vaXawSx12WvZCNzTQ99U\n\tbxwdiqReQnk4PpNQjKs/kEbw2n4uLNdI3CNT6p9lTP/gc7gzhaIgnAs9qyKkZYx2HKtS\n\t5ET8krK+fd6FOWo68adPPG5kEhlt3e3GNtM+H1C4xH5vobFCCGRSVIjzzozKONxZzza/\n\tuA7mcVD1vFoQepUs57XbXuC47pA2BUGbROQSrEnDUg3cjpGVROHnCjgjb37QuB4EJA2a\n\tqkfg==","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=NSjBnkpZMSibCO0vEeOvJxQf5ptoML3hsvNL8eH7lOc=;\n\tb=L1U/lUL//QPdEMouVHJNunj9FuJy0KUjj0SYzl1kvrKvI77nBHQoi35SsvUrpzWxrU\n\tzRajkZtOCg8RadC6cK9KOVgYlyM2xpjA4WDNNGX95SJSxpkotYzq+TBxUL2RCF+uQ4J1\n\tCWOgdp1wtlA8vDJrVymBzZaTxCFZ8Znp1PljGSWf8+p2VPPwD+V2yrvrxpyA4994hCz4\n\tvWt76rySJhq9Skj/9iQX7hyhtN0NOfWGxvrUVy6dy+Vk8DV+VbqSbT25576cvqDr0VcQ\n\tMae9yXrBkvu5H+8VMAbl5aGXZIwGQ7t8w8PVb6puFkFBnMGLMIgVVmjN51bMjfJf4D2F\n\tNhaQ==","X-Gm-Message-State":"AOAM533bk4ydcTH+qLgUmPuykKBD/M7DIZFLXgYPgArXfRUn0gQlpjOt\n\t7fAPcB2gFDxju9yTu5niwmFky//HHIDAa4DU0ncrtA==","X-Google-Smtp-Source":"ABdhPJyu82WGxGpWswvcVSpGyOjxDaABFcofxmRTN+nN90P5EewwZaZDcErX7mVaFJ++uzDc+Rp5pQqopM37ZLtyMcY=","X-Received":"by 2002:a4a:b91a:: with SMTP id x26mr3072135ooo.5.1590682016675; \n\tThu, 28 May 2020 09:06:56 -0700 (PDT)","MIME-Version":"1.0","References":"<20200528145610.96585-1-naush@raspberrypi.com>","In-Reply-To":"<20200528145610.96585-1-naush@raspberrypi.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Thu, 28 May 2020 17:06:46 +0100","Message-ID":"<CAHW6GYLJRB_bNN3P-mkPd8LThUF+Pn=OSUGzhZ_dGgrJHRCu0g@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"multipart/alternative; boundary=\"0000000000008e0dcb05a6b78412\"","Subject":"Re: [libcamera-devel] [PATCH] pipeline: raspberrypi: Fix for\n\tstaggered write on reset","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>","X-List-Received-Date":"Thu, 28 May 2020 16:06:58 -0000"}},{"id":4941,"web_url":"https://patchwork.libcamera.org/comment/4941/","msgid":"<CAEmqJPpdsP8QFixh8HVPhsNydJMD6GS6UUdUoQuhS=t_D=78Xw@mail.gmail.com>","date":"2020-05-29T07:17:25","subject":"Re: [libcamera-devel] [PATCH] pipeline: raspberrypi: Fix for\n\tstaggered write on reset","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi David,\n\nOn Thu, 28 May 2020 at 17:06, David Plowman\n<david.plowman@raspberrypi.com> wrote:\n>\n> Hi Naush\n>\n> Thanks for submitting this one!\n>\n> On Thu, 28 May 2020 at 15:56, Naushir Patuck <naush@raspberrypi.com> wrote:\n>>\n>> The reset function in staggered write was using the wrong index when\n>> looking for the last updated camera parameters. This would cause\n>> possibly stale exposure values to be written to the camera on a\n>> mode switch for captures.\n>>\n>> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n>> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n>> ---\n>>  src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\n>> index 391e13f5..b26fa63d 100644\n>> --- a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\n>> +++ b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\n>> @@ -46,7 +46,7 @@ void StaggeredCtrl::reset()\n>>  {\n>>         std::lock_guard<std::mutex> lock(lock_);\n>>\n>> -       int lastSetCount = std::max<int>(0, setCount_ - 1);\n>> +       int lastSetCount = std::max<int>(0, setCount_);\n>\n>\n> Actually I wonder whether we shouldn't just go with\n>\n>        uint32_t lastSetCount = setCount_;\n>\n\nAgreed, this is not needed any more.  New patch incoming.\n\nNaush\n\n\n> (the std::max seems a bit redundant now that we don't subtract 1).\n>\n>>\n>>         std::unordered_map<uint32_t, int32_t> lastVal;\n>>\n>>         /* Reset the counters. */\n>> --\n>> 2.25.1\n>>","headers":{"Return-Path":"<naush@raspberrypi.com>","Received":["from mail-lf1-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E3B4603CE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 May 2020 09:17:43 +0200 (CEST)","by mail-lf1-x143.google.com with SMTP id 82so691984lfh.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 May 2020 00:17:43 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"CM529bBY\"; 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=x7MKTpomLq55+fIYXtFq2Cj4r642mh+fyhNd07peqLU=;\n\tb=CM529bBYVTqc2gQUJD3TBAHk7Skn3CPxgbzIoGR9CqALYCIyBw2THElL+H1F/WFNw5\n\thylMP/IuJOpI/AwP3HTKvA1kMgoLrU4AV4KqYtBhEIlDBhU9YWzY+5OHgd/KzGAHOV+P\n\tAlY5YRsjm1079c0TPWJUwZep6Eo1tmfOIMKFIdp9Ixp1j7BrKZZ04gfT9bMYTBj1bBs3\n\tKXIavBPIvZ/0MswMrvNA79ZcqkSq+vNIDP29MoJ7g0MdDRlk/r4i2wEFWZOWhERxAxht\n\tkGJbXWYqPZsdv+wiYJ5Xu49RDkHFiX6/BsdHigrx6BKGo/u7VjahRKpeKqryGrsXwqPE\n\tiMkw==","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=x7MKTpomLq55+fIYXtFq2Cj4r642mh+fyhNd07peqLU=;\n\tb=rlNUmgPeL/f2dWFi/6By6EfJJQl+ExJf9F9y3zJ30PU2hhh79n82m8Ly3OkqiBKrmI\n\tmqc0DDaXukMGsx7V8QgCkJ7yMQYXZnsieQuIKjZ2zd5aFB7wgvXa/CGwBoKr+R/eM1mC\n\tdsjGf1Vx91oB5HYoO8maTWZOQcogcUuA6QW/5D3FQxoRFJpOnpODgfPFhdNo9DBt1Ybb\n\tsJsz0Yhen9vMePR3pc/fvqwogfZfhC5EYmrGC++R8iPeIWm7qWOGZ0fMZhOpDa6020gA\n\twLsoL9imozjM4vGlSx453ya2O3xptB2+fFhIGweHsxV+hHb5ubb0kiQWNG6/9LNflWqm\n\t5qYw==","X-Gm-Message-State":"AOAM531YD9nVk08Voo7O8iN+Zhe2xRzyCpECd2ft3XxqztbnqItehe3a\n\t9BeEGVC+ngyVVVrZlfaDxadu79W5UXH+31cTBq7eqQ==","X-Google-Smtp-Source":"ABdhPJy0+xS9q2kiuB37zOGL45D4z0Y0m879yBqhfDVarCxw7JVUcO2jxSuCtnmt94SAaaEU2gcm1mBLHlSoDofIy+E=","X-Received":"by 2002:ac2:44bb:: with SMTP id c27mr3771993lfm.59.1590736662584;\n\tFri, 29 May 2020 00:17:42 -0700 (PDT)","MIME-Version":"1.0","References":"<20200528145610.96585-1-naush@raspberrypi.com>\n\t<CAHW6GYLJRB_bNN3P-mkPd8LThUF+Pn=OSUGzhZ_dGgrJHRCu0g@mail.gmail.com>","In-Reply-To":"<CAHW6GYLJRB_bNN3P-mkPd8LThUF+Pn=OSUGzhZ_dGgrJHRCu0g@mail.gmail.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Fri, 29 May 2020 08:17:25 +0100","Message-ID":"<CAEmqJPpdsP8QFixh8HVPhsNydJMD6GS6UUdUoQuhS=t_D=78Xw@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH] pipeline: raspberrypi: Fix for\n\tstaggered write on reset","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>","X-List-Received-Date":"Fri, 29 May 2020 07:17:43 -0000"}}]