From patchwork Mon Jun 30 08:11:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 23690 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 CB320C3237 for ; Mon, 30 Jun 2025 08:11:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6C10468E11; Mon, 30 Jun 2025 10:11:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cQsWLDaO"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4879368E0F for ; Mon, 30 Jun 2025 10:11:44 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:883b:eaf8:7aec:d1d4]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id B2E721352; Mon, 30 Jun 2025 10:11:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1751271082; bh=gaAqoFHAde8LKprVSI5/jyKy39lo8PbGwa7J1cmkfuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQsWLDaOAF/YX6Dd8yeEjlyUNhj0MpFipNenyhZYEn0u36SMBO92wfUvUYitI7iVt z7CAJtfQlshkoaTX3epYJsP6uymnDbeu+I7QcKmyXGcok7xPQKFHfa3YMYqsPmP40S P37RLAXWbngS7xax+JF+WhU5NBoBezxumX4Wp8Ss= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 4/6] pipeline: rkisp1: Properly handle the bufferCount set in the stream configuration Date: Mon, 30 Jun 2025 10:11:19 +0200 Message-ID: <20250630081126.2384387-5-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250630081126.2384387-1-stefan.klug@ideasonboard.com> References: <20250630081126.2384387-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 bufferCount is reset to a hardcoded value of 4 in RkISP1Path::validate(). Keep the default value of 4 but do not reset it, if it was changed. Signed-off-by: Stefan Klug --- Changes in v1: - Removed todo comment that was solved by this change --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 +++-- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 7 ++----- src/libcamera/pipeline/rkisp1/rkisp1_path.h | 4 +--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index bd14ab237064..9d7b05490af6 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -790,6 +790,7 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, return nullptr; cfg.colorSpace = colorSpace; + cfg.bufferCount = kPipelineDepth; config->addConfiguration(cfg); } @@ -1123,14 +1124,14 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL } if (data->mainPath_->isEnabled()) { - ret = mainPath_.start(); + ret = mainPath_.start(maxQueuedRequestsDevice_); if (ret) return ret; actions += [&]() { mainPath_.stop(); }; } if (hasSelfPath_ && data->selfPath_->isEnabled()) { - ret = selfPath_.start(); + ret = selfPath_.start(maxQueuedRequestsDevice_); if (ret) return ret; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 64018dc5b2f4..8ea5500d4080 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -249,7 +249,6 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size, StreamConfiguration cfg(formats); cfg.pixelFormat = format; cfg.size = streamSize; - cfg.bufferCount = RKISP1_BUFFER_COUNT; return cfg; } @@ -383,7 +382,6 @@ RkISP1Path::validate(const CameraSensor *sensor, cfg->size.boundTo(maxResolution); cfg->size.expandTo(minResolution); - cfg->bufferCount = RKISP1_BUFFER_COUNT; V4L2DeviceFormat format; format.fourcc = video_->toV4L2PixelFormat(cfg->pixelFormat); @@ -480,15 +478,14 @@ int RkISP1Path::configure(const StreamConfiguration &config, return 0; } -int RkISP1Path::start() +int RkISP1Path::start(unsigned int bufferCount) { int ret; if (running_) return -EBUSY; - /* \todo Make buffer count user configurable. */ - ret = video_->importBuffers(RKISP1_BUFFER_COUNT); + ret = video_->importBuffers(bufferCount); if (ret) return ret; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h index 430181d371a7..0b60c499ac64 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h @@ -58,7 +58,7 @@ public: return video_->exportBuffers(bufferCount, buffers); } - int start(); + int start(unsigned int bufferCount); void stop(); int queueBuffer(FrameBuffer *buffer) { return video_->queueBuffer(buffer); } @@ -69,8 +69,6 @@ private: void populateFormats(); Size filterSensorResolution(const CameraSensor *sensor); - static constexpr unsigned int RKISP1_BUFFER_COUNT = 4; - const char *name_; bool running_;