{"id":13469,"url":"https://patchwork.libcamera.org/api/1.1/patches/13469/?format=json","web_url":"https://patchwork.libcamera.org/patch/13469/","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":"<20210824195636.1110845-8-nfraprado@collabora.com>","date":"2021-08-24T19:56:26","name":"[libcamera-devel,v8,07/17] libcamera: pipeline: vimc, uvcvideo: Don't rely on bufferCount","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"592e1c5af6d20e7f949ea3954c8f269690116f4a","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/13469/mbox/","series":[{"id":2389,"url":"https://patchwork.libcamera.org/api/1.1/series/2389/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2389","date":"2021-08-24T19:56:19","name":"lc-compliance: Add test to queue more requests than hardware depth","version":8,"mbox":"https://patchwork.libcamera.org/series/2389/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13469/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13469/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 73442C3247\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 24 Aug 2021 19:57:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D44A8688AC;\n\tTue, 24 Aug 2021 21:57:32 +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 C1253688CA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Aug 2021 21:57:30 +0200 (CEST)","from [127.0.0.1] (localhost [127.0.0.1])\n\t(Authenticated sender: nfraprado) with ESMTPSA id 6127D1F43362"],"From":"=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 24 Aug 2021 16:56:26 -0300","Message-Id":"<20210824195636.1110845-8-nfraprado@collabora.com>","X-Mailer":"git-send-email 2.33.0","In-Reply-To":"<20210824195636.1110845-1-nfraprado@collabora.com>","References":"<20210824195636.1110845-1-nfraprado@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v8 07/17] libcamera: pipeline: vimc,\n\tuvcvideo: Don't rely on bufferCount","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":"kernel@collabora.com, =?utf-8?q?Andr=C3=A9_Almeida?=\n\t<andrealmeid@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Instead of using bufferCount as the number of V4L2 buffer slots to\nreserve in the vimc and uvcvideo pipeline handlers, use a reasonably\nhigh constant: 16. Overallocating isn't a problem as buffer slots are\ncheap. Having too few, on the other hand, could degrade performance. It\nis expected that this number will be more than enough for most, if not\nall, use cases.\n\nThis makes way for removing bufferCount.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n\n---\n\nChanges in v8:\n- New\n\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 5 +++--\n src/libcamera/pipeline/vimc/vimc.cpp         | 5 +++--\n 2 files changed, 6 insertions(+), 4 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 7821cacfa883..c210cf57750f 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -91,6 +91,8 @@ private:\n \t{\n \t\treturn static_cast<UVCCameraData *>(camera->_d());\n \t}\n+\n+\tstatic constexpr unsigned int kUVCBufferSlotCount = 16;\n };\n \n UVCCameraConfiguration::UVCCameraConfiguration(UVCCameraData *data)\n@@ -236,9 +238,8 @@ int PipelineHandlerUVC::exportFrameBuffers(Camera *camera,\n int PipelineHandlerUVC::start(Camera *camera, [[maybe_unused]] const ControlList *controls)\n {\n \tUVCCameraData *data = cameraData(camera);\n-\tunsigned int count = data->stream_.configuration().bufferCount;\n \n-\tint ret = data->video_->importBuffers(count);\n+\tint ret = data->video_->importBuffers(kUVCBufferSlotCount);\n \tif (ret < 0)\n \t\treturn ret;\n \ndiff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\nindex eebdfd1a4c01..d2943f61a745 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -105,6 +105,8 @@ private:\n \t{\n \t\treturn static_cast<VimcCameraData *>(camera->_d());\n \t}\n+\n+\tstatic constexpr unsigned int kVimcBufferSlotCount = 16;\n };\n \n namespace {\n@@ -331,9 +333,8 @@ int PipelineHandlerVimc::exportFrameBuffers(Camera *camera,\n int PipelineHandlerVimc::start(Camera *camera, [[maybe_unused]] const ControlList *controls)\n {\n \tVimcCameraData *data = cameraData(camera);\n-\tunsigned int count = data->stream_.configuration().bufferCount;\n \n-\tint ret = data->video_->importBuffers(count);\n+\tint ret = data->video_->importBuffers(kVimcBufferSlotCount);\n \tif (ret < 0)\n \t\treturn ret;\n \n","prefixes":["libcamera-devel","v8","07/17"]}