[{"id":26103,"web_url":"https://patchwork.libcamera.org/comment/26103/","msgid":"<20221216152616.j67nufelrb4ai2dh@uno.localdomain>","date":"2022-12-16T15:26:16","subject":"Re: [libcamera-devel] [PATCH v9 08/18] libcamera: pipeline: vimc,\n\tuvcvideo: Don't rely on bufferCount","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Paul\n\nOn Fri, Dec 16, 2022 at 09:29:29PM +0900, Paul Elder via libcamera-devel wrote:\n> From: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n>\n> Instead of using bufferCount as the number of V4L2 buffer slots to\n> reserve in the vimc and uvcvideo pipeline handlers, use a reasonably\n> high constant: 16. Overallocating isn't a problem as buffer slots are\n> cheap. Having too few, on the other hand, could degrade performance. It\n> is expected that this number will be more than enough for most, if not\n> all, use cases.\n>\n> This makes way for removing bufferCount.\n>\n> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n>\n> ---\n\nSeems reasonable\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> Changes in v9:\n> - rebased\n>\n> Changes 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(-)\n>\n> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> index 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>\n> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\n> index 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> --\n> 2.35.1\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 C4C93C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 16 Dec 2022 15:26:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 81B346339A;\n\tFri, 16 Dec 2022 16:26:20 +0100 (CET)","from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 599ED603D0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Dec 2022 16:26:18 +0100 (CET)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id E3896E0003;\n\tFri, 16 Dec 2022 15:26:17 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1671204380;\n\tbh=s119a2tBirAHSCDppqBP+6zDJ8mKusyT/vSBdRof30o=;\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=CR/3KKeWdfnGuduI9lw6k4k7j/ApVpyx2KWVUMeOgUZr737S+cv5vEln30Z93U2kc\n\tZD2FIqd+b1oCQb35ZchmkD8AdtmPopErba/NJGeqpyv9ZwqOZk00lrlnOOuG9SlvIw\n\t/78uC+ZrC4nfYThocBBsZVkTNfCjqWAPu+ZQN3mjAaoHtUcD2f1XfKh+sGBmmBTy2y\n\tw+LVCUANSy9NvcHmFO5nICJTltKLuRLiqxL6H2Bv5nd2zdeL7upH6/jHJNJFjzYdWJ\n\tStrT40PChLD1Dkbuo3/mjqqyhpyVy+EUMn8CIGLV9o0OUUEk0jCKH1IRan9c3nVVIx\n\t2BoeMKnhmDBnA==","Date":"Fri, 16 Dec 2022 16:26:16 +0100","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<20221216152616.j67nufelrb4ai2dh@uno.localdomain>","References":"<20221216122939.256534-1-paul.elder@ideasonboard.com>\n\t<20221216122939.256534-9-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20221216122939.256534-9-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v9 08/18] 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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]