From patchwork Mon Oct 31 11:45:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17736 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D8AE0C3285 for ; Mon, 31 Oct 2022 11:45:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 00D2163035; Mon, 31 Oct 2022 12:45:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1667216730; bh=94lFACRMLlJSvs2JAH2MVfht2+K/TNuOHg6pDaIUxFM=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=3Sd0O5Jhu82eCrluf2Qp53x7zIZ4KSol9fIfq4TOiPxL+25YCjWiFoTeKLKt2jUkc 5YGgOueyL+FjIAJet9N4rVpURksu1LPCt5O3CUwSDspBVwk14NI/YuBaM8p+Amwimd LIf/K0i581UPHzHrNbf4szpgZuKke2PsWWjlk+nYXw0YvFT+nKzgdaLzF2doG4XB5h EYXnCp9ipWOcr+tTAxzqtp86BzDK/YoishQ4czlsJsP89CTRcRGq6gFXf5PhlWeUl/ 3KM8xofM69OglsBorndqDnjINyG9SRubWf6yE3H7OvRJ2NybtFONwPqq6LJueaPIjn UqUoMDIwP5S+A== Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D7DC961F46 for ; Mon, 31 Oct 2022 12:45:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Tw0mQnaz"; dkim-atps=neutral Received: by mail-wr1-x42d.google.com with SMTP id bs21so15587813wrb.4 for ; Mon, 31 Oct 2022 04:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JPw0yACzhH/JPVM8B5gaYJbcuHwNFRb/r1SBK2+U6XM=; b=Tw0mQnazQMBMMBOaBFgYinlSjDkdVcga9+oy1+cN+GttecdOztgomH9cFn4T2dXOY4 s/3ETiFaJGrbMML+bcl5nvj+y7n+Oa6LsIo/HONfif9pozvIyLjiXlydrGnjyYHuF0RL 14UYTqNpeUR0YQbmG3veSe4pIQLQxhZjXl8sjAAmlXQ2w9J3kr1MTCjm9z2cD6ZiwE9U 7WgWoMOAdmjuFPZEVqtj3ESWErrJ6BwiSlHOCiTPqEvyzGs2QccrWyFI1cR1IRX78DVs dy7bDO6e2CUKRrmD/vM86xs7zchtTKYLDdqM8h1N1ZP8vpSqDeJxA0aUgDmFh+diAizA H03g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JPw0yACzhH/JPVM8B5gaYJbcuHwNFRb/r1SBK2+U6XM=; b=TzxFnHZDFSNQZyhiqmypDkpUv245zQe+nSIc6Z2cJ/y3GF/8Toxc0A4hg+EleQwuMQ 6ubaS5LzBGjlZ1cY1TSXPZX0xXWkGQy7SVvqyYwrO0WlJ5GKwycVJgr1GCYFUcUzvcR1 X79xpkzgagxWZX2DLPoviAqByMwumndMyZ434iTfjcQ52mqLkuR/530HbEM5C4CNMlAM 5KVqCBc14Taqom3u+SK8OsR0LTwmszvXfXeJP3bRTRDLJDmKiJPNN4GYsh+vVjqGfpI+ 9U49qUCI5mOZfVc/1kh0gonllyhhSfZ+/S4OL9UC6YIihzeNUi7pFGJn0GMVsaPwu4Ok 6JnQ== X-Gm-Message-State: ACrzQf16cRdqZDZAuhpROBExTcPTAurqFRdXV2uVQt0P9na8u/VpwSJN 4WxBD5tLYZVlS/nzJd3iSe/9MzHoF0aLsA== X-Google-Smtp-Source: AMsMyM7as4+D+pU6RuqYK9Zx67wS/TgsVR6r1pi8n4c6timO2gzK6BDWiyiwB4OqF/kaFQz5gkafkA== X-Received: by 2002:a5d:4410:0:b0:236:a8f9:268f with SMTP id z16-20020a5d4410000000b00236a8f9268fmr7816879wrq.405.1667216728178; Mon, 31 Oct 2022 04:45:28 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h11-20020adff18b000000b0023677e1157fsm6936354wro.56.2022.10.31.04.45.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 04:45:27 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Oct 2022 11:45:16 +0000 Message-Id: <20221031114522.14215-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031114522.14215-1-naush@raspberrypi.com> References: <20221031114522.14215-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 1/7] delayed_controls: Template the ControlRingBuffer class X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Convert ControlRingBuffer to a templated class to allow arbitrary ring buffer array types to be defined. Rename ControlRingBuffer to RingBuffer to indicate this. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Tested-by: David Plowman Reviewed-by: Kieran Bingham --- include/libcamera/internal/delayed_controls.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h index aef37077103c..de8026e3e4f0 100644 --- a/include/libcamera/internal/delayed_controls.h +++ b/include/libcamera/internal/delayed_controls.h @@ -53,17 +53,18 @@ private: /* \todo Make the listSize configurable at instance creation time. */ static constexpr int listSize = 16; - class ControlRingBuffer : public std::array + template + class RingBuffer : public std::array { public: - Info &operator[](unsigned int index) + T &operator[](unsigned int index) { - return std::array::operator[](index % listSize); + return std::array::operator[](index % listSize); } - const Info &operator[](unsigned int index) const + const T &operator[](unsigned int index) const { - return std::array::operator[](index % listSize); + return std::array::operator[](index % listSize); } }; @@ -75,7 +76,7 @@ private: uint32_t queueCount_; uint32_t writeCount_; /* \todo Evaluate if we should index on ControlId * or unsigned int */ - std::unordered_map values_; + std::unordered_map> values_; }; } /* namespace libcamera */