[{"id":25952,"web_url":"https://patchwork.libcamera.org/comment/25952/","msgid":"<Y4iQAc/EjFSItQvO@pyrite.rasen.tech>","date":"2022-12-01T11:29:05","subject":"Re: [libcamera-devel] [PATCH v8 11/17] lc-compliance: Move buffer\n\tallocation to separate function","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Tue, Aug 24, 2021 at 04:56:30PM -0300, Nícolas F. R. A. Prado wrote:\n> Move buffer allocation to its own function and with an optional count\n> argument so tests can specify how many buffers to allocate. When count\n> is omitted, allocate MinimumRequests buffers.\n> \n> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> ---\n> \n> Changes in v8:\n> - Made SimpleCapture::allocateBuffers() a single function with an optional parameter\n> \n> Changes in v5:\n> - New\n> \n>  src/lc-compliance/capture_test.cpp   |  8 +++++++-\n>  src/lc-compliance/simple_capture.cpp | 15 ++++++++++-----\n>  src/lc-compliance/simple_capture.h   |  1 +\n>  3 files changed, 18 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/lc-compliance/capture_test.cpp b/src/lc-compliance/capture_test.cpp\n> index 52578207c11f..6439cbd88f8e 100644\n> --- a/src/lc-compliance/capture_test.cpp\n> +++ b/src/lc-compliance/capture_test.cpp\n> @@ -80,6 +80,8 @@ TEST_P(SingleStream, Capture)\n>  \n>  \tcapture.configure(role);\n>  \n> +\tcapture.allocateBuffers();\n> +\n>  \tcapture.capture(numRequests);\n>  }\n>  \n> @@ -99,8 +101,10 @@ TEST_P(SingleStream, CaptureStartStop)\n>  \n>  \tcapture.configure(role);\n>  \n> -\tfor (unsigned int starts = 0; starts < numRepeats; starts++)\n> +\tfor (unsigned int starts = 0; starts < numRepeats; starts++) {\n> +\t\tcapture.allocateBuffers();\n>  \t\tcapture.capture(numRequests);\n> +\t}\n>  }\n>  \n>  /*\n> @@ -118,6 +122,8 @@ TEST_P(SingleStream, UnbalancedStop)\n>  \n>  \tcapture.configure(role);\n>  \n> +\tcapture.allocateBuffers();\n> +\n>  \tcapture.capture(numRequests);\n>  }\n>  \n> diff --git a/src/lc-compliance/simple_capture.cpp b/src/lc-compliance/simple_capture.cpp\n> index d87f30cbeb1b..041a2a4cbb5a 100644\n> --- a/src/lc-compliance/simple_capture.cpp\n> +++ b/src/lc-compliance/simple_capture.cpp\n> @@ -44,15 +44,20 @@ void SimpleCapture::configure(StreamRole role)\n>  \t}\n>  }\n>  \n> -void SimpleCapture::start()\n> +void SimpleCapture::allocateBuffers(unsigned int count)\n>  {\n> -\tunsigned int bufferCount = camera_->properties().get(properties::MinimumRequests);\n> +\tif (!count)\n> +\t\tcount = camera_->properties().get(properties::MinimumRequests);\n> +\n>  \tStream *stream = config_->at(0).stream();\n> -\tint count = allocator_->allocate(stream, bufferCount);\n> +\tint allocatedCount = allocator_->allocate(stream, count);\n>  \n> -\tASSERT_GE(count, 0) << \"Failed to allocate buffers\";\n> -\tEXPECT_EQ(count, bufferCount) << \"Allocated less buffers than expected\";\n> +\tASSERT_GE(allocatedCount, 0) << \"Failed to allocate buffers\";\n> +\tEXPECT_EQ(allocatedCount, count) << \"Allocated less buffers than expected\";\n> +}\n>  \n> +void SimpleCapture::start()\n> +{\n>  \tcamera_->requestCompleted.connect(this, &SimpleCapture::requestComplete);\n>  \n>  \tASSERT_EQ(camera_->start(), 0) << \"Failed to start camera\";\n> diff --git a/src/lc-compliance/simple_capture.h b/src/lc-compliance/simple_capture.h\n> index 100ffd6637ad..401ba8273da8 100644\n> --- a/src/lc-compliance/simple_capture.h\n> +++ b/src/lc-compliance/simple_capture.h\n> @@ -17,6 +17,7 @@ class SimpleCapture\n>  {\n>  public:\n>  \tvoid configure(libcamera::StreamRole role);\n> +\tvoid allocateBuffers(unsigned int count = 0);\n>  \n>  protected:\n>  \tSimpleCapture(std::shared_ptr<libcamera::Camera> camera);\n> -- \n> 2.33.0\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 2701FBDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  1 Dec 2022 11:29:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5CA7F6333F;\n\tThu,  1 Dec 2022 12:29:15 +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 CC70063335\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  1 Dec 2022 12:29:13 +0100 (CET)","from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EB02433F;\n\tThu,  1 Dec 2022 12:29:11 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669894155;\n\tbh=6YMq+5fOnnPkG86TuJncFIn4w2NcWS1p3euRHjHaD24=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=EHxRFVvFcz4nxl+D1ySeJjb1mDJM5KUS4XrIz4Hvh68Cbsy/OgZmlLeBvPOrjNReD\n\tYNxVbn5Xf5zSu9RAzf/gs+t6ifL1BxL+ERdJL0+yWLQ5JVBco42qfT62tylIuBV7wo\n\td3HxL7bQCdhIqxZFPG5SayxRUwOgSiLFn7MH3jTvsigcyrIJrl0QIan4uW3XbGH+Qm\n\tYWPDrVw2ZDpulP/RwRev0T1uOKbszoB9QtrWBGxVJs7acjL4aK4Im5PcT1xfdSepGC\n\ts2BROzKt4x6fmpJCNVeNmR1GRZ00OqPfl6U0kQoctXbyKnNbVo35Iag3SPkcm7uIy4\n\twYqTstjMDSnAQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1669894153;\n\tbh=6YMq+5fOnnPkG86TuJncFIn4w2NcWS1p3euRHjHaD24=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=FQ1S5TUHlfTKDLSbrg25N0JRoC96wKUV0kltNVzkzxHFSXn5/gPieTG0/vA+2LzPz\n\ts+ZQ6+jBNbIwvv/JAp0/V1UNX8Bh1GtFUBA6+LRUdLszB4OJpkq948OBKdTafQbVuE\n\tBP/3f8cVbAG9cpoNMXL2lZbaPSE3BaIj7s0EGRPI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"FQ1S5TUH\"; dkim-atps=neutral","Date":"Thu, 1 Dec 2022 20:29:05 +0900","To":"=?iso-8859-1?q?N=EDcolas_F=2E_R=2E_A=2E?= Prado <nfraprado@collabora.com>","Message-ID":"<Y4iQAc/EjFSItQvO@pyrite.rasen.tech>","References":"<20210824195636.1110845-1-nfraprado@collabora.com>\n\t<20210824195636.1110845-12-nfraprado@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20210824195636.1110845-12-nfraprado@collabora.com>","Subject":"Re: [libcamera-devel] [PATCH v8 11/17] lc-compliance: Move buffer\n\tallocation to separate function","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":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, kernel@collabora.com,\n\t=?iso-8859-1?q?Andr=E9?= Almeida <andrealmeid@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]