{"id":11884,"url":"https://patchwork.libcamera.org/api/1.1/patches/11884/?format=json","web_url":"https://patchwork.libcamera.org/patch/11884/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210409213815.356837-3-nfraprado@collabora.com>","date":"2021-04-09T21:38:14","name":"[libcamera-devel,RFC,2/3] libcamera: pipeline: rkisp1: Allow bufferCount to be user-configurable","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"fe2c30368fca407accddcc9752e374e216eedcbd","submitter":{"id":84,"url":"https://patchwork.libcamera.org/api/1.1/people/84/?format=json","name":"Nícolas F. R. A. Prado","email":"nfraprado@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11884/mbox/","series":[{"id":1908,"url":"https://patchwork.libcamera.org/api/1.1/series/1908/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1908","date":"2021-04-09T21:38:12","name":"Add lc-compliance test for overflowing requests","version":1,"mbox":"https://patchwork.libcamera.org/series/1908/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11884/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11884/checks/","tags":{},"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 599E1BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 Apr 2021 21:38:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1DA9368801;\n\tFri,  9 Apr 2021 23:38:51 +0200 (CEST)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 500CC687EF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  9 Apr 2021 23:38:50 +0200 (CEST)","from localhost.localdomain (unknown\n\t[IPv6:2804:14c:1a9:2978:fcbb:7aa5:bea8:667e])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits))\n\t(No client certificate requested) (Authenticated sender: nfraprado)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id 5E6B51F46A97;\n\tFri,  9 Apr 2021 22:38:48 +0100 (BST)"],"From":"=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  9 Apr 2021 18:38:14 -0300","Message-Id":"<20210409213815.356837-3-nfraprado@collabora.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210409213815.356837-1-nfraprado@collabora.com>","References":"<20210409213815.356837-1-nfraprado@collabora.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [RFC PATCH 2/3] libcamera: pipeline: rkisp1:\n\tAllow bufferCount to be user-configurable","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>","Cc":"Collabora Kernel ML <kernel@collabora.com>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Allow the StreamConfiguration's bufferCount to be changed by the user.\nThis allows the user to, after increasing bufferCount, allocate more\nbuffers through FrameBufferAllocator.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  4 ++--\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 12 +++++++-----\n src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  4 ++--\n 3 files changed, 11 insertions(+), 9 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 549f4a4e61a8..c7b93b2804c7 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -792,7 +792,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL\n \t}\n \n \tif (data->mainPath_->isEnabled()) {\n-\t\tret = mainPath_.start();\n+\t\tret = mainPath_.start(data->mainPathStream_.configuration());\n \t\tif (ret) {\n \t\t\tparam_->streamOff();\n \t\t\tstat_->streamOff();\n@@ -803,7 +803,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL\n \t}\n \n \tif (data->selfPath_->isEnabled()) {\n-\t\tret = selfPath_.start();\n+\t\tret = selfPath_.start(data->selfPathStream_.configuration());\n \t\tif (ret) {\n \t\t\tmainPath_.stop();\n \t\t\tparam_->streamOff();\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex 25f482eb8d8e..a03b5c23b87e 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -61,7 +61,7 @@ StreamConfiguration RkISP1Path::generateConfiguration(const Size &resolution)\n \tStreamConfiguration cfg(formats);\n \tcfg.pixelFormat = formats::NV12;\n \tcfg.size = maxResolution;\n-\tcfg.bufferCount = RKISP1_BUFFER_COUNT;\n+\tcfg.bufferCount = RKISP1_MIN_BUFFER_COUNT;\n \n \treturn cfg;\n }\n@@ -77,7 +77,10 @@ CameraConfiguration::Status RkISP1Path::validate(StreamConfiguration *cfg)\n \n \tcfg->size.boundTo(maxResolution_);\n \tcfg->size.expandTo(minResolution_);\n-\tcfg->bufferCount = RKISP1_BUFFER_COUNT;\n+\tif (cfg->bufferCount < RKISP1_MIN_BUFFER_COUNT) {\n+\t\tcfg->bufferCount = RKISP1_MIN_BUFFER_COUNT;\n+\t\tstatus = CameraConfiguration::Adjusted;\n+\t}\n \n \tV4L2DeviceFormat format;\n \tformat.fourcc = video_->toV4L2PixelFormat(cfg->pixelFormat);\n@@ -164,15 +167,14 @@ int RkISP1Path::configure(const StreamConfiguration &config,\n \treturn 0;\n }\n \n-int RkISP1Path::start()\n+int RkISP1Path::start(const StreamConfiguration &config)\n {\n \tint ret;\n \n \tif (running_)\n \t\treturn -EBUSY;\n \n-\t/* \\todo Make buffer count user configurable. */\n-\tret = video_->importBuffers(RKISP1_BUFFER_COUNT);\n+\tret = video_->importBuffers(config.bufferCount);\n \tif (ret)\n \t\treturn ret;\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\nindex 3b3e37d258d0..13291da89dc5 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n@@ -49,14 +49,14 @@ public:\n \t\treturn video_->exportBuffers(bufferCount, buffers);\n \t}\n \n-\tint start();\n+\tint start(const StreamConfiguration &config);\n \tvoid stop();\n \n \tint queueBuffer(FrameBuffer *buffer) { return video_->queueBuffer(buffer); }\n \tSignal<FrameBuffer *> &bufferReady() { return video_->bufferReady; }\n \n private:\n-\tstatic constexpr unsigned int RKISP1_BUFFER_COUNT = 4;\n+\tstatic constexpr unsigned int RKISP1_MIN_BUFFER_COUNT = 4;\n \n \tconst char *name_;\n \tbool running_;\n","prefixes":["libcamera-devel","RFC","2/3"]}