{"id":18064,"url":"https://patchwork.libcamera.org/api/patches/18064/?format=json","web_url":"https://patchwork.libcamera.org/patch/18064/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20221228223003.2265712-9-paul.elder@ideasonboard.com>","date":"2022-12-28T22:29:52","name":"[libcamera-devel,v10,08/19] libcamera: pipeline: vimc, uvcvideo: Don't rely on bufferCount","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"592e1c5af6d20e7f949ea3954c8f269690116f4a","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18064/mbox/","series":[{"id":3691,"url":"https://patchwork.libcamera.org/api/series/3691/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3691","date":"2022-12-28T22:29:44","name":"lc-compliance: Add test to queue more requests than hardware depth","version":10,"mbox":"https://patchwork.libcamera.org/series/3691/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18064/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18064/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 D09A4C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Dec 2022 22:30:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4CA5F625EE;\n\tWed, 28 Dec 2022 23:30:32 +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 5C6C7625DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Dec 2022 23:30:27 +0100 (CET)","from pyrite.mediacom.info (unknown\n\t[IPv6:2604:2d80:ad8a:9000:1bf9:855b:22de:3645])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0F492109;\n\tWed, 28 Dec 2022 23:30:25 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1672266632;\n\tbh=A/v6s9S+6QPq7TXJyUJoD86lQzpWi2AxeuEf8n4vCv4=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=Yn5cmdmSYIej/tn0rUSxI3vTTITD4VXNfKOx3z5NDRw9eD+wDHCggJXtP6oi6fule\n\tUd1QWN/kImg989r1mRgJDljqNgLrhiS70JH7mXBs/anKS9sMafqjrpVxRMGjHmuBky\n\tyDBxdSPowSKs7VgLF8TvLyguUQLssaoyIvaul0I5AAKVsPaaVxxfxeuW7nYflCXu0e\n\tlR6EXLnXGMywRlhEAS934Eo/50MekOmdEDfvKgeNCtg11nBuwHxtN8oPb6vtjKONlT\n\tvuHWOSSeWU+bzmaKFccv9LR/8zm53hL8zGPknGNmOws/FMap85NGrS+F8uUU+r8Pnj\n\tKz9WEmmhP2Vdw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1672266627;\n\tbh=A/v6s9S+6QPq7TXJyUJoD86lQzpWi2AxeuEf8n4vCv4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Ik78jgyAUuvDmycuCNKYeSPTvIocRNMjhM/YuWsDwQgG6yT94kLdDLzLVBxSrTrM3\n\tDo8mf0pbmiDaf4EM1foGvJCAYbYVxX+I8NNq6B2dEEAJDn2DHeJAXyL0nPdeJz+h44\n\t6huatWEt4K+wSyLPGFR+suX80eIOXMIyTn8yXyrY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Ik78jgyA\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 28 Dec 2022 16:29:52 -0600","Message-Id":"<20221228223003.2265712-9-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20221228223003.2265712-1-paul.elder@ideasonboard.com>","References":"<20221228223003.2265712-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v10 08/19] 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>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n\nInstead 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>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\n---\nChanges in v9:\n- rebased\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 4ce240a4..18966d01 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -97,6 +97,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@@ -239,9 +241,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 e58caf99..eaa6ebf7 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -106,6 +106,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@@ -334,9 +336,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","v10","08/19"]}