From patchwork Thu Oct 23 14:48:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24742 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 265DEC32DB for ; Thu, 23 Oct 2025 14:49:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CD76460811; Thu, 23 Oct 2025 16:49:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Y9ZZdY27"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D693960805 for ; Thu, 23 Oct 2025 16:49:27 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:7328:357b:4ce1:72b6]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id E15F1177F; Thu, 23 Oct 2025 16:47:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761230863; bh=HVD73afMb0bw6wU4gD7q2miON5ah/pqLM5Z7zL2MDUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9ZZdY27+ZR6uQv1R2zXKZmia+/ABJiuhq4jp1mB77Tjri0QbbBrE0ReTwoPxEwq/ ybUTNiSPtpPh5yL9XDhyqp8FG6dlU6vLTmkafgKM/6azv0h4HxLvTPWZAovD09zswh UjFhKxOi9IUdGwz95ZpOhVRukSBGW89JXwHLLuEE= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v2 14/35] libcamera: rkisp1: Move useDewarper_ flag into RkISP1CameraData Date: Thu, 23 Oct 2025 16:48:15 +0200 Message-ID: <20251023144841.403689-15-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251023144841.403689-1-stefan.klug@ideasonboard.com> References: <20251023144841.403689-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 05409bc46ee3..241c83f4125b 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; @@ -1153,7 +1153,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"; @@ -1208,7 +1208,7 @@ void PipelineHandlerRkISP1::stopDevice(Camera *camera) LOG(RkISP1, Warning) << "Failed to stop parameters for " << camera->id(); - if (useDewarper_) + if (data->usesDewarper_) dewarper_->stop(); } @@ -1304,7 +1304,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_); @@ -1474,7 +1474,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() @@ -1579,7 +1579,7 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer) info->metadataProcessed = true; } - if (!useDewarper_) { + if (!data->usesDewarper_) { completeBuffer(request, buffer); tryCompleteRequest(info);