From patchwork Mon Sep 26 09:57:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17398 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 E9A2BBD16B for ; Mon, 26 Sep 2022 09:57:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 730C862255; Mon, 26 Sep 2022 11:57:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664186271; bh=bR2XcJuN9v/o7WELV1bz1uQ//2GkfmEfO0JjDU9qjxk=; 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=W1K4adyrOf0LiDhLHih5ghv2vmmTlqE8mMFhoG7rawIy+XP2Keb3gRdnrTm3A7GIM IkRLVEGvvub48TRUTPiMaf0zAKGR3T1BvsWMtkKXXJPV6muCacMuv45GaZ4XVo5MXN cMxc/apIcHSG8/n/JLnCAuvQRHI707ZUYnXZ46iqD0eNGC5GsFa2r5eXiwExuz0JgN oTHqZ/6r0kZ1jSBvtK3fvjlG4glL037ZPVEBjH7/S9XV2D+7EjI44MIfa9JbnNdWxU 3+3R9FtYuxFC66WlnxpAjlG8CzMA3o7tehGKVEakMlCkP5LQSGG1I7W7S9OxYVZj3R kGRwE3bn7105A== Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 697AD6224C for ; Mon, 26 Sep 2022 11:57:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="DPt/ksiH"; dkim-atps=neutral Received: by mail-wr1-x434.google.com with SMTP id r7so9390058wrm.2 for ; Mon, 26 Sep 2022 02:57:49 -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; bh=ZPzBiNF1VfWzy9TrECDZS8BLt3LUNp1q4BLHZaXn4hI=; b=DPt/ksiH78sHZTwA46IjGmkcEr5OVpN/CIrZFfnL9+aporFn5yq2yTT+f30M9EEBTa +BQkPtzTnk6/JofAibh/oKlWXDHBxorbxqN1NB8OerqkwN32SHvsIewWaG6r7jsWt60b qGqhTG6tXclPpFEF7lk3X81t1Z5UoeWEjOFhOglj3L6ns7m3D3a4rFFR/X7aiRf7hgzl 0Qm/i7B8sn79h5vo75sY54Db21diiwJXNVzP5E6z53TTM+VweeJEyyWkpA+mIn4+Rczg OLFWvt+s0UvLarSPdErMpsXOaq5MUtOqCUBi9nDnztlPWYdv4gBn1aX30+siXij5DMoG UIGw== 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; bh=ZPzBiNF1VfWzy9TrECDZS8BLt3LUNp1q4BLHZaXn4hI=; b=0fhKbDot5S7hMxuQB9VupuFYqKpRN3i+q+amwi/8VYCizqLEwd5FtUtG5q597C9PzN w2KSPTx0CO69i9J2EC3YpDzH/Hw4or0vwoEa9AeNBRMOVf9zm7kk5B225EycJ6h7NALA lUWFKnS5cta4M8OjvEZgaYQPWDH8li0UyoqUEch8aZTskXB6kd0mmD/HoJYE0MlaBtEA 5ujwDhknYOsOnBKiDm4fEYI0RqyulZml7UIDVsKVAlmtk5zo83SwEYNAOUBIqHFby/+Q cVwXzYK+KuKkgB8jx3UOPwQinhUO70kjkLFLhNti/KNVGhkCTDMVPZU5IVK8SB71Dex4 Qp0g== X-Gm-Message-State: ACrzQf2g3UETA65Z9mGEpL9Qwn8pQDcwiWbMMwa4A5YhokKKbdH6B1fl zSzs8RU2jB3mAwjVfIrpJxO6j87C6dcQtZLk X-Google-Smtp-Source: AMsMyM7wFHHAA3CKtnkeQh9FRAO5EDMgArziysnZ15yjNWlv4shy7G5NmBCf3OZTJyBn2VLikvsfsQ== X-Received: by 2002:adf:fe06:0:b0:228:db6f:41ae with SMTP id n6-20020adffe06000000b00228db6f41aemr13626894wrr.577.1664186268893; Mon, 26 Sep 2022 02:57:48 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id p22-20020a05600c419600b003a4efb794d7sm10160671wmh.36.2022.09.26.02.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 02:57:47 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 26 Sep 2022 10:57:31 +0100 Message-Id: <20220926095737.30506-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220926095737.30506-1-naush@raspberrypi.com> References: <20220926095737.30506-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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: Laurent Pinchart --- 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 */