[{"id":37052,"web_url":"https://patchwork.libcamera.org/comment/37052/","msgid":"<176409036206.567526.12395396951746829047@ping.linuxembedded.co.uk>","date":"2025-11-25T17:06:02","subject":"Re: [PATCH v3 11/29] libcamera: rkisp1: Move useDewarper_ flag into\n\tRkISP1CameraData","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-11-25 16:28:23)\n> The decision if the dewarper shall be used is not per pipeline but per\n> camera and per configuration (raw streams can't use it). Move the\n> corresponding flag into the camera data class. Rename the flag to\n> \"usesDewarper\" which is easier understand when we later add the ability\n> to enable/disable the dewarper on a per camera basis which will be\n> expressed using a \"canUseDewarper\" flag.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> ---\n> \n> Changes in v3:\n> - Collected tags\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 28 ++++++++++++------------\n>  1 file changed, 14 insertions(+), 14 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index b56b306f1ad1..a3b92804c69f 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -122,6 +122,8 @@ public:\n>          */\n>         MediaPipeline pipe_;\n>  \n> +       bool usesDewarper_;\n> +\n>  private:\n>         void paramsComputed(unsigned int frame, unsigned int bytesused);\n>         void setSensorControls(unsigned int frame,\n> @@ -232,7 +234,6 @@ private:\n>  \n>         std::unique_ptr<V4L2M2MConverter> dewarper_;\n>         Rectangle scalerMaxCrop_;\n> -       bool useDewarper_;\n>  \n>         std::optional<Rectangle> activeCrop_;\n>  \n> @@ -280,7 +281,7 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req\n>                 statBuffer = pipe_->availableStatBuffers_.front();\n>                 pipe_->availableStatBuffers_.pop();\n>  \n> -               if (pipe_->useDewarper_) {\n> +               if (data->usesDewarper_) {\n>                         mainPathBuffer = pipe_->availableMainPathBuffers_.front();\n>                         pipe_->availableMainPathBuffers_.pop();\n>                 }\n> @@ -710,8 +711,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n>   */\n>  \n>  PipelineHandlerRkISP1::PipelineHandlerRkISP1(CameraManager *manager)\n> -       : PipelineHandler(manager, kRkISP1MaxQueuedRequests),\n> -         hasSelfPath_(true), useDewarper_(false)\n> +       : PipelineHandler(manager, kRkISP1MaxQueuedRequests), hasSelfPath_(true)\n>  {\n>  }\n>  \n> @@ -874,7 +874,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n>         const PixelFormat &streamFormat = config->at(0).pixelFormat;\n>         const PixelFormatInfo &info = PixelFormatInfo::info(streamFormat);\n>         isRaw_ = info.colourEncoding == PixelFormatInfo::ColourEncodingRAW;\n> -       useDewarper_ = dewarper_ && !isRaw_;\n> +       data->usesDewarper_ = dewarper_ && !isRaw_;\n>  \n>         /* YUYV8_2X8 is required on the ISP source path pad for YUV output. */\n>         if (!isRaw_)\n> @@ -888,7 +888,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n>                 /* imx8mp has only a single path. */\n>                 const auto &cfg = config->at(0);\n>                 Size ispCrop = format.size.boundedToAspectRatio(cfg.size);\n> -               if (useDewarper_)\n> +               if (data->usesDewarper_)\n>                         ispCrop = dewarper_->adjustInputSize(cfg.pixelFormat,\n>                                                              ispCrop);\n>                 else\n> @@ -929,7 +929,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n>                         streamConfig[0] = IPAStream(cfg.pixelFormat,\n>                                                     cfg.size);\n>                         /* Configure dewarp */\n> -                       if (dewarper_ && !isRaw_) {\n> +                       if (data->usesDewarper_) {\n>                                 outputCfgs.push_back(const_cast<StreamConfiguration &>(cfg));\n>                                 ret = dewarper_->configure(cfg, outputCfgs);\n>                                 if (ret)\n> @@ -994,7 +994,7 @@ int PipelineHandlerRkISP1::exportFrameBuffers([[maybe_unused]] Camera *camera, S\n>                  * It has mainpath and no self path. Hence, export buffers from\n>                  * dewarper just for the main path stream, for now.\n>                  */\n> -               if (useDewarper_)\n> +               if (data->usesDewarper_)\n>                         return dewarper_->exportBuffers(&data->mainPathStream_, count, buffers);\n>                 else\n>                         return mainPath_.exportBuffers(count, buffers);\n> @@ -1028,7 +1028,7 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n>         }\n>  \n>         /* If the dewarper is being used, allocate internal buffers for ISP. */\n> -       if (useDewarper_) {\n> +       if (data->usesDewarper_) {\n>                 ret = mainPath_.exportBuffers(kRkISP1MinBufferCount, &mainPathBuffers_);\n>                 if (ret < 0)\n>                         return ret;\n> @@ -1131,7 +1131,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL\n>                 }\n>                 actions += [&]() { stat_->streamOff(); };\n>  \n> -               if (useDewarper_) {\n> +               if (data->usesDewarper_) {\n>                         ret = dewarper_->start();\n>                         if (ret) {\n>                                 LOG(RkISP1, Error) << \"Failed to start dewarper\";\n> @@ -1186,7 +1186,7 @@ void PipelineHandlerRkISP1::stopDevice(Camera *camera)\n>                         LOG(RkISP1, Warning)\n>                                 << \"Failed to stop parameters for \" << camera->id();\n>  \n> -               if (useDewarper_)\n> +               if (data->usesDewarper_)\n>                         dewarper_->stop();\n>         }\n>  \n> @@ -1282,7 +1282,7 @@ int PipelineHandlerRkISP1::updateControls(RkISP1CameraData *data)\n>  {\n>         ControlInfoMap::Map controls;\n>  \n> -       if (dewarper_) {\n> +       if (data->usesDewarper_) {\n>                 std::pair<Rectangle, Rectangle> cropLimits;\n>                 if (dewarper_->isConfigured(&data->mainPathStream_))\n>                         cropLimits = dewarper_->inputCropBounds(&data->mainPathStream_);\n> @@ -1452,7 +1452,7 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n>                                 this, &PipelineHandlerRkISP1::dewarpBufferReady);\n>  \n>                         LOG(RkISP1, Info)\n> -                               << \"Using DW100 dewarper \" << dewarper_->deviceNode();\n> +                               << \"Found DW100 dewarper \" << dewarper_->deviceNode();\n>                 } else {\n>                         LOG(RkISP1, Warning)\n>                                 << \"Found DW100 dewarper \" << dewarper_->deviceNode()\n> @@ -1557,7 +1557,7 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer)\n>                         info->metadataProcessed = true;\n>         }\n>  \n> -       if (!useDewarper_) {\n> +       if (!data->usesDewarper_) {\n>                 completeBuffer(request, buffer);\n>                 tryCompleteRequest(info);\n>  \n> -- \n> 2.51.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 7FD8AC32DE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Nov 2025 17:06:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 95B6F60A9E;\n\tTue, 25 Nov 2025 18:06:07 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B8C0E609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Nov 2025 18:06:05 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 73AC5524;\n\tTue, 25 Nov 2025 18:03:56 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"SspXLmr2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764090236;\n\tbh=Q2SGUheCk73Ae6GxY/xQp6krHndsjZrb7bZKZL3/SNc=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=SspXLmr2x0WPzemQ/EAm83EI6/Wb1lWgkZm9WZoZrwZtEF0oDuj2Wtba9BJIPKBRV\n\tJRR3TeTJi9qj3csECGDodZYUtK8k/RRWWObos8GX0yrL+1sQCMj1Phql9QVS1zAznn\n\tu6iuYzl57L/SaTFrFlQJ2COpDTzzaEsSD2VXcPUU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251125162851.2301793-12-stefan.klug@ideasonboard.com>","References":"<20251125162851.2301793-1-stefan.klug@ideasonboard.com>\n\t<20251125162851.2301793-12-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v3 11/29] libcamera: rkisp1: Move useDewarper_ flag into\n\tRkISP1CameraData","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 25 Nov 2025 17:06:02 +0000","Message-ID":"<176409036206.567526.12395396951746829047@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]