[{"id":25802,"web_url":"https://patchwork.libcamera.org/comment/25802/","msgid":"<CAHW6GYJC0h9N9djEQ+NnnkmWXBqb3B8Sd2aiUHScKJp-LVa0Cg@mail.gmail.com>","date":"2022-11-15T13:52:18","subject":"Re: [libcamera-devel] [PATCH v6 3/8] pipeline: raspberrypi:\n\tdelayed_controls: Template the ControlRingBuffer class","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 the updated patch.\n\nOn Tue, 15 Nov 2022 at 09:08, Naushir Patuck via libcamera-devel\n<libcamera-devel@lists.libcamera.org> wrote:\n>\n> Convert ControlRingBuffer to a templated class to allow arbitrary ring buffer\n> array types to be defined. Rename ControlRingBuffer to RingBuffer to indicate\n> this.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks\nDavid\n\n> ---\n>  .../pipeline/raspberrypi/delayed_controls.h         | 13 +++++++------\n>  1 file changed, 7 insertions(+), 6 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/raspberrypi/delayed_controls.h b/src/libcamera/pipeline/raspberrypi/delayed_controls.h\n> index f7f246482968..238b86ab6cb4 100644\n> --- a/src/libcamera/pipeline/raspberrypi/delayed_controls.h\n> +++ b/src/libcamera/pipeline/raspberrypi/delayed_controls.h\n> @@ -56,17 +56,18 @@ private:\n>         };\n>\n>         static constexpr int listSize = 16;\n> -       class ControlRingBuffer : public std::array<Info, listSize>\n> +       template<typename T>\n> +       class RingBuffer : public std::array<T, listSize>\n>         {\n>         public:\n> -               Info &operator[](unsigned int index)\n> +               T &operator[](unsigned int index)\n>                 {\n> -                       return std::array<Info, listSize>::operator[](index % listSize);\n> +                       return std::array<T, listSize>::operator[](index % listSize);\n>                 }\n>\n> -               const Info &operator[](unsigned int index) const\n> +               const T &operator[](unsigned int index) const\n>                 {\n> -                       return std::array<Info, listSize>::operator[](index % listSize);\n> +                       return std::array<T, listSize>::operator[](index % listSize);\n>                 }\n>         };\n>\n> @@ -76,7 +77,7 @@ private:\n>\n>         uint32_t queueCount_;\n>         uint32_t writeCount_;\n> -       std::unordered_map<const ControlId *, ControlRingBuffer> values_;\n> +       std::unordered_map<const ControlId *, RingBuffer<Info>> values_;\n>  };\n>\n>  } /* namespace RPi */\n> --\n> 2.25.1\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 F13E4BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 15 Nov 2022 13:52:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7765763086;\n\tTue, 15 Nov 2022 14:52:33 +0100 (CET)","from mail-pl1-x629.google.com (mail-pl1-x629.google.com\n\t[IPv6:2607:f8b0:4864:20::629])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B480763079\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Nov 2022 14:52:31 +0100 (CET)","by mail-pl1-x629.google.com with SMTP id v17so13231649plo.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Nov 2022 05:52:31 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668520353;\n\tbh=stMJzvN9ML7XBvLI23DT20iddNOCVXaqgnpX1Ibzryo=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=utXJ/KI+IBn57ClQpdRszSeADS9e+OGNA97W6x/Y7K8LnpymP9QSceeu5TmSopF12\n\twB4Ibp9bPfKkdJJDPrwgh+loEEe/MCFNv4GVHJlZHw+k1V0q6y7nHEHe7EC9Yzo5C0\n\tu3Kax4UT5simLyvZopjgsPS7slc6Yj5xwb7swLiHGMHTBOTPSVd5klrLwDtemE55S9\n\tehO58EyPc3aZERjtzJnGy53eotGOYvgKdRdq8gPPweE3/q49a0O4ZhCIUc5qhQvKrt\n\tR5ajyrAuZNJOf2NigtYIE9twLyTdanXvB2KNMYD9/xRPA9e9LKwDqDGvYUmI/LnajX\n\tCRwCdhiWj+5Qw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=ZyJHtawo7lvr2IWmlZiezegEo49dQlBP5ekHfJeVagU=;\n\tb=JGGIe1LUhEOnQlyujhmZJG8+SaYl/yTTVdRnVRGR0lZNF/GraH4wLJP2aJ+m0P2EOw\n\tdG4pKYyEDTk5jTmQt/o6dTwgPBV0TphntSgMyYCw7+p5FSv/V5Pz9Sh8rbJfPLRzQ5wV\n\t3hFq7uluibyA34aNKZjkHRVpOBlU4xJekp4ASCjPTiPiGC/Q8qeJMVn7nfGHaJd4SIZx\n\tWMXlQqiDOmr49QhqjXSjIqjmD4QB5oYS2AaXnr1RyhsiP5637U4Q+5lb9/vt3J6z0CA7\n\tjMQy+I8PDpeoXbmCZLGwvbOq8JZq0MViM1jvolBpsAhGSTJpFD9fXDU/4GEjugk8l8ui\n\tFKvg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"JGGIe1LU\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=ZyJHtawo7lvr2IWmlZiezegEo49dQlBP5ekHfJeVagU=;\n\tb=oQLJehIa962Gr7XCDvgRfKmG3+U4a0z/Ext0Kph2FSxTJNUewrBOyY7WHy8EExfSpG\n\tUGTtrhP75nRsQGbIuHSRl1AzV8pPTR1GEPEg+LlgOU/TVLgM2yft2d5STzzotLtifCqJ\n\tqetWYFS87ttsAeijmi+e5LyqpRvx5ozoIqK1ebQqaPP82XAxitNjKD1twMV6OTlR13af\n\ttFm0H6KGzawNqpJ3P6iDs3x8M7MbLnkdmhS62bErXicT693CZBch6blsvG7sDsQalm/V\n\twEzANYYmRKBYsS0lnvJvaryLPz7KPYwMX/dyIBjMVho7kqbxW8Jf1SUBQNll2w1+/BdZ\n\td5Dg==","X-Gm-Message-State":"ANoB5pnzB11fY1x7tZlNkf8VeMqDkEDseYsXlyaeIeQuJrQKqXrmb221\n\t+edZTxt/rmtrvC/C2XGTeydxWCHs5YupbpsPgg2n3g==","X-Google-Smtp-Source":"AA0mqf6LI350YzwwuzVjjgpJ6Gg1eE3ydjM+PvQTGrEMf8LBPKz6kUZTSUbICbccDQFMd0rhQ8mvEk/3SO3vClaiGIQ=","X-Received":"by 2002:a17:902:7615:b0:188:d4ea:251f with SMTP id\n\tk21-20020a170902761500b00188d4ea251fmr3070942pll.36.1668520350215;\n\tTue, 15 Nov 2022 05:52:30 -0800 (PST)","MIME-Version":"1.0","References":"<20221115090755.2921-1-naush@raspberrypi.com>\n\t<20221115090755.2921-4-naush@raspberrypi.com>","In-Reply-To":"<20221115090755.2921-4-naush@raspberrypi.com>","Date":"Tue, 15 Nov 2022 13:52:18 +0000","Message-ID":"<CAHW6GYJC0h9N9djEQ+NnnkmWXBqb3B8Sd2aiUHScKJp-LVa0Cg@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v6 3/8] pipeline: raspberrypi:\n\tdelayed_controls: Template the ControlRingBuffer class","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>","From":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]