[{"id":20257,"web_url":"https://patchwork.libcamera.org/comment/20257/","msgid":"<20211018041937.GD2066071@pyrite.rasen.tech>","date":"2021-10-18T04:19:37","subject":"Re: [libcamera-devel] [PATCH v4 03/16] libcamera: ipu3: Rationalize\n\tconstant expressions names","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Thu, Oct 14, 2021 at 07:41:55PM +0200, Jacopo Mondi wrote:\n> Following the previous patch that moved all the ImgU-related contants in\n> the ImgUDevice class namespace and that aligned their naming scheme to\n> the 'kNameOfConstant' scheme, apply the same changes to the other\n> components of the IPU3 pipeline handler.\n> \n> Cosmetic change, no functional changes intended.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/libcamera/pipeline/ipu3/cio2.cpp |  6 +++---\n>  src/libcamera/pipeline/ipu3/cio2.h   |  2 +-\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 22 +++++++++++-----------\n>  3 files changed, 15 insertions(+), 15 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\n> index dc62ab197acb..59dda56bdd3d 100644\n> --- a/src/libcamera/pipeline/ipu3/cio2.cpp\n> +++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n> @@ -234,7 +234,7 @@ StreamConfiguration CIO2Device::generateConfiguration(Size size) const\n>  \n>  \tcfg.size = sensorFormat.size;\n>  \tcfg.pixelFormat = mbusCodesToPixelFormat.at(sensorFormat.mbus_code);\n> -\tcfg.bufferCount = CIO2_BUFFER_COUNT;\n> +\tcfg.bufferCount = kBufferCount;\n>  \n>  \treturn cfg;\n>  }\n> @@ -338,11 +338,11 @@ int CIO2Device::exportBuffers(unsigned int count,\n>  \n>  int CIO2Device::start()\n>  {\n> -\tint ret = output_->exportBuffers(CIO2_BUFFER_COUNT, &buffers_);\n> +\tint ret = output_->exportBuffers(kBufferCount, &buffers_);\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>  \n> -\tret = output_->importBuffers(CIO2_BUFFER_COUNT);\n> +\tret = output_->importBuffers(kBufferCount);\n>  \tif (ret)\n>  \t\tLOG(IPU3, Error) << \"Failed to import CIO2 buffers\";\n>  \n> diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h\n> index 5fffe921f213..ba8f0052c5b3 100644\n> --- a/src/libcamera/pipeline/ipu3/cio2.h\n> +++ b/src/libcamera/pipeline/ipu3/cio2.h\n> @@ -30,7 +30,7 @@ struct StreamConfiguration;\n>  class CIO2Device\n>  {\n>  public:\n> -\tstatic constexpr unsigned int CIO2_BUFFER_COUNT = 4;\n> +\tstatic constexpr unsigned int kBufferCount = 4;\n>  \n>  \tCIO2Device();\n>  \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 76fe9edb7dbc..11ac55c02681 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -39,10 +39,6 @@ namespace libcamera {\n>  \n>  LOG_DEFINE_CATEGORY(IPU3)\n>  \n> -static constexpr unsigned int IPU3_BUFFER_COUNT = 4;\n> -static constexpr unsigned int IPU3_MAX_STREAMS = 3;\n> -static constexpr Size IPU3ViewfinderSize(1280, 720);\n> -\n>  static const ControlInfoMap::Map IPU3Controls = {\n>  \t{ &controls::draft::PipelineDepth, ControlInfo(2, 3) },\n>  };\n> @@ -93,6 +89,9 @@ private:\n>  class IPU3CameraConfiguration : public CameraConfiguration\n>  {\n>  public:\n> +\tstatic constexpr unsigned int kBufferCount = 4;\n> +\tstatic constexpr unsigned int kMaxStreams = 3;\n> +\n>  \tIPU3CameraConfiguration(IPU3CameraData *data);\n>  \n>  \tStatus validate() override;\n> @@ -119,6 +118,7 @@ class PipelineHandlerIPU3 : public PipelineHandler\n>  {\n>  public:\n>  \tstatic constexpr unsigned int V4L2_CID_IPU3_PIPE_MODE = 0x009819c1;\n> +\tstatic constexpr Size kViewfinderSize{ 1280, 720 };\n>  \n>  \tenum IPU3PipeModes {\n>  \t\tIPU3PipeModeVideo = 0,\n> @@ -218,8 +218,8 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \tcombinedTransform_ = combined;\n>  \n>  \t/* Cap the number of entries to the available streams. */\n> -\tif (config_.size() > IPU3_MAX_STREAMS) {\n> -\t\tconfig_.resize(IPU3_MAX_STREAMS);\n> +\tif (config_.size() > kMaxStreams) {\n> +\t\tconfig_.resize(kMaxStreams);\n>  \t\tstatus = Adjusted;\n>  \t}\n>  \n> @@ -356,7 +356,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \t\t\t\t\t      ImgUDevice::kOutputAlignHeight);\n>  \n>  \t\t\tcfg->pixelFormat = formats::NV12;\n> -\t\t\tcfg->bufferCount = IPU3_BUFFER_COUNT;\n> +\t\t\tcfg->bufferCount = kBufferCount;\n>  \t\t\tcfg->stride = info.stride(cfg->size.width, 0, 1);\n>  \t\t\tcfg->frameSize = info.frameSize(cfg->size, 1);\n>  \n> @@ -444,7 +444,7 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  \t\t\t\t.alignedDownTo(ImgUDevice::kOutputMarginWidth,\n>  \t\t\t\t\t       ImgUDevice::kOutputMarginHeight);\n>  \t\t\tpixelFormat = formats::NV12;\n> -\t\t\tbufferCount = IPU3_BUFFER_COUNT;\n> +\t\t\tbufferCount = IPU3CameraConfiguration::kBufferCount;\n>  \t\t\tstreamFormats[pixelFormat] = { { ImgUDevice::kOutputMinSize, size } };\n>  \n>  \t\t\tbreak;\n> @@ -469,11 +469,11 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  \t\t\t * capped to the maximum sensor resolution and aligned\n>  \t\t\t * to the ImgU output constraints.\n>  \t\t\t */\n> -\t\t\tsize = sensorResolution.boundedTo(IPU3ViewfinderSize)\n> +\t\t\tsize = sensorResolution.boundedTo(kViewfinderSize)\n>  \t\t\t\t\t       .alignedDownTo(ImgUDevice::kOutputAlignWidth,\n>  \t\t\t\t\t\t\t      ImgUDevice::kOutputAlignHeight);\n>  \t\t\tpixelFormat = formats::NV12;\n> -\t\t\tbufferCount = IPU3_BUFFER_COUNT;\n> +\t\t\tbufferCount = IPU3CameraConfiguration::kBufferCount;\n>  \t\t\tstreamFormats[pixelFormat] = { { ImgUDevice::kOutputMinSize, size } };\n>  \n>  \t\t\tbreak;\n> @@ -1004,7 +1004,7 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n>  \t * Either the smallest margin-aligned size larger than the viewfinder\n>  \t * size or the adjusted sensor resolution.\n>  \t */\n> -\tminSize = IPU3ViewfinderSize.grownBy({ 1, 1 })\n> +\tminSize = kViewfinderSize.grownBy({ 1, 1 })\n>  \t\t  .alignedUpTo(ImgUDevice::kOutputMarginWidth,\n>  \t\t\t       ImgUDevice::kOutputMarginHeight)\n>  \t\t  .boundedTo(minSize);\n> -- \n> 2.33.0\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 47623C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Oct 2021 04:19:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C4B5768F59;\n\tMon, 18 Oct 2021 06:19:47 +0200 (CEST)","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 CE2A960128\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Oct 2021 06:19:45 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2271012A;\n\tMon, 18 Oct 2021 06:19:43 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gjbs1066\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634530785;\n\tbh=aFzXh+y6lHoA0lf8PnhrtMSuDD09A1vxvOI2yKRRCwE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=gjbs1066u5JJ29Zk3WqLgwOsZNKLhR4gVMM/1UGqEV6d52wpeuVZeUrHdoqcWAbO3\n\tf38fCs8uXozk8Qoffiw9duZrupXwYnMA6CQ5kdOkvvxm8j/GfMEbBMxcMFmeQPBwbe\n\tQJeQUw/GKiMYO1OzZxc1REib+TfgEbJKX6LzCTzU=","Date":"Mon, 18 Oct 2021 13:19:37 +0900","From":"paul.elder@ideasonboard.com","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20211018041937.GD2066071@pyrite.rasen.tech>","References":"<20211014174208.50509-1-jacopo@jmondi.org>\n\t<20211014174208.50509-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20211014174208.50509-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v4 03/16] libcamera: ipu3: Rationalize\n\tconstant expressions names","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":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]