[{"id":5096,"web_url":"https://patchwork.libcamera.org/comment/5096/","msgid":"<20200606212017.GE7339@pendragon.ideasonboard.com>","date":"2020-06-06T21:20:17","subject":"Re: [libcamera-devel] [PATCH v2 05/10] libcamera: ipu3: Calculate\n\tnumber of buffers for ImgU","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Sat, Jun 06, 2020 at 05:04:31PM +0200, Niklas Söderlund wrote:\n> Decouple the number of buffers to allocate for the ImgU from the number\n> of buffers allocated for the CIO2. Instead of blindly following the CIO2\n> pick the maximum number of buffers requested for any stream facing\n> applications.\n> \n> This is potentially wasteful, as each stream could allocate just as many\n> buffers as requested by the application instead of the maximum from the\n> set. But this is not more wasteful than what is already used by the\n> pipeline and should be fixed on top after the decoupling of the two\n> processing units.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> * Changes since v1\n> - Use std::max({ ... })\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 6 +++++-\n>  1 file changed, 5 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 6df93eedb365b904..d143a425817b5f03 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -726,7 +726,11 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>  \n> -\tbufferCount = ret;\n> +\tbufferCount = std::max({\n> +\t\tdata->outStream_.configuration().bufferCount,\n> +\t\tdata->vfStream_.configuration().bufferCount,\n> +\t\tdata->rawStream_.configuration().bufferCount,\n> +\t});\n>  \n>  \tret = imgu->allocateBuffers(data, bufferCount);\n>  \tif (ret < 0) {","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0096161167\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  6 Jun 2020 23:20:36 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 947F930D;\n\tSat,  6 Jun 2020 23:20:35 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"OXZ4ytTy\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591478435;\n\tbh=nguN7IIfLH8g6ARHac5bHLSCGXS7oLNcBcCAJdVc28A=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=OXZ4ytTy2FY1lhqXZfXLAt2aMP0Ec832fe2J7syzJYqX3P/G51A/beOnDONPVZ744\n\tnYtpMxWcqxmuiw2lpYUn6nuAwn8xk5tp4JtxRSRKcOFg05LWD29thA8H1hpA5wsbhX\n\tivoHhrCpoGYwkEdMar4nf8D2DNB2J4HegbtKwFNA=","Date":"Sun, 7 Jun 2020 00:20:17 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200606212017.GE7339@pendragon.ideasonboard.com>","References":"<20200606150436.1851700-1-niklas.soderlund@ragnatech.se>\n\t<20200606150436.1851700-6-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200606150436.1851700-6-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH v2 05/10] libcamera: ipu3: Calculate\n\tnumber of buffers for ImgU","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>","X-List-Received-Date":"Sat, 06 Jun 2020 21:20:36 -0000"}}]