From patchwork Tue Sep 30 12:26:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24514 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 788D6C328C for ; Tue, 30 Sep 2025 13:04:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 657F16B606; Tue, 30 Sep 2025 15:04:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Spb5jC3b"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 027BE69367 for ; Tue, 30 Sep 2025 15:04:05 +0200 (CEST) Received: from ideasonboard.com (unknown [94.31.94.171]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 96F42169; Tue, 30 Sep 2025 15:02:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1759237356; bh=Ka5l8jCVBgIEWsigXaUrubAdjbRqFAwcWR1C4LgeCZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Spb5jC3bvXmk0iBl63PzyhDpQFXFA1uYjFCMF5cb5jXKR7VtNWQ330SlZbCx3zY+v HQKjIw2+Q+cLec+LjrSi3PcXhKp7Q3AJqm6qLQn/KZUisFbU1Dr3fiES7yaqQs7mGw MsZXnRF7+QzRZezP6eioxWpusKIBejlHED7BSlTQ= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 15/33] libcamera: rkisp1: Move useDewarper_ flag into RkISP1CameraData Date: Tue, 30 Sep 2025 14:26:36 +0200 Message-ID: <20250930122726.1837524-16-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250930122726.1837524-1-stefan.klug@ideasonboard.com> References: <20250930122726.1837524-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The decision if the dewarper shall be used is not per pipeline but per camera and per configuration (raw streams can't use it). Move the corresponding flag into the camera data class. Rename the flag to "usesDewarper" which is easier understand when we later add the ability to enable/disable the dewarper on a per camera basis which will be expressed using a "canUseDewarper" flag. Signed-off-by: Stefan Klug --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index d5790864d026..6550469842e1 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -123,6 +123,8 @@ public: */ MediaPipeline pipe_; + bool usesDewarper_; + private: void paramsComputed(unsigned int frame, unsigned int bytesused); void setSensorControls(unsigned int frame, @@ -234,7 +236,6 @@ private: std::unique_ptr dewarper_; Rectangle scalerMaxCrop_; - bool useDewarper_; std::optional activeCrop_; @@ -285,7 +286,7 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req statBuffer = pipe_->availableStatBuffers_.front(); pipe_->availableStatBuffers_.pop(); - if (pipe_->useDewarper_) { + if (data->usesDewarper_) { mainPathBuffer = pipe_->availableMainPathBuffers_.front(); pipe_->availableMainPathBuffers_.pop(); } @@ -715,8 +716,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate() */ PipelineHandlerRkISP1::PipelineHandlerRkISP1(CameraManager *manager) - : PipelineHandler(manager, kRkISP1MaxQueuedRequests), - hasSelfPath_(true), useDewarper_(false) + : PipelineHandler(manager, kRkISP1MaxQueuedRequests), hasSelfPath_(true) { } @@ -879,7 +879,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) const PixelFormat &streamFormat = config->at(0).pixelFormat; const PixelFormatInfo &info = PixelFormatInfo::info(streamFormat); isRaw_ = info.colourEncoding == PixelFormatInfo::ColourEncodingRAW; - useDewarper_ = dewarper_ && !isRaw_; + data->usesDewarper_ = dewarper_ && !isRaw_; /* YUYV8_2X8 is required on the ISP source path pad for YUV output. */ if (!isRaw_) @@ -893,7 +893,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) /* imx8mp has only a single path. */ const auto &cfg = config->at(0); Size ispCrop = format.size.boundedToAspectRatio(cfg.size); - if (useDewarper_) + if (data->usesDewarper_) ispCrop = dewarper_->adjustInputSize(cfg.pixelFormat, ispCrop); else @@ -934,7 +934,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) streamConfig[0] = IPAStream(cfg.pixelFormat, cfg.size); /* Configure dewarp */ - if (dewarper_ && !isRaw_) { + if (data->usesDewarper_) { outputCfgs.push_back(const_cast(cfg)); ret = dewarper_->configure(cfg, outputCfgs); if (ret) @@ -999,7 +999,7 @@ int PipelineHandlerRkISP1::exportFrameBuffers([[maybe_unused]] Camera *camera, S * It has mainpath and no self path. Hence, export buffers from * dewarper just for the main path stream, for now. */ - if (useDewarper_) + if (data->usesDewarper_) return dewarper_->exportBuffers(&data->mainPathStream_, count, buffers); else return mainPath_.exportBuffers(count, buffers); @@ -1033,7 +1033,7 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera) } /* If the dewarper is being used, allocate internal buffers for ISP. */ - if (useDewarper_) { + if (data->usesDewarper_) { ret = mainPath_.exportBuffers(kRkISP1MinBufferCount, &mainPathBuffers_); if (ret < 0) return ret; @@ -1158,7 +1158,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL } actions += [&]() { stat_->streamOff(); }; - if (useDewarper_) { + if (data->usesDewarper_) { ret = dewarper_->start(); if (ret) { LOG(RkISP1, Error) << "Failed to start dewarper"; @@ -1215,7 +1215,7 @@ void PipelineHandlerRkISP1::stopDevice(Camera *camera) LOG(RkISP1, Warning) << "Failed to stop parameters for " << camera->id(); - if (useDewarper_) + if (data->usesDewarper_) dewarper_->stop(); } @@ -1311,7 +1311,7 @@ int PipelineHandlerRkISP1::updateControls(RkISP1CameraData *data) { ControlInfoMap::Map controls; - if (dewarper_) { + if (data->usesDewarper_) { std::pair cropLimits; if (dewarper_->isConfigured(&data->mainPathStream_)) cropLimits = dewarper_->inputCropBounds(&data->mainPathStream_); @@ -1479,7 +1479,7 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator) this, &PipelineHandlerRkISP1::dewarpBufferReady); LOG(RkISP1, Info) - << "Using DW100 dewarper " << dewarper_->deviceNode(); + << "Found DW100 dewarper " << dewarper_->deviceNode(); } else { LOG(RkISP1, Warning) << "Found DW100 dewarper " << dewarper_->deviceNode() @@ -1584,7 +1584,7 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer) info->metadataProcessed = true; } - if (!useDewarper_) { + if (!data->usesDewarper_) { completeBuffer(request, buffer); tryCompleteRequest(info);