From patchwork Mon May 26 21:42:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 23445 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 4A6D1C31E9 for ; Mon, 26 May 2025 21:42:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D95E368D9D; Mon, 26 May 2025 23:42:38 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="g6oSTfAo"; 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 6204C627DA for ; Mon, 26 May 2025 23:42:36 +0200 (CEST) Received: from ideasonboard.com (tmo-070-11.customers.d1-online.com [80.187.70.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D32AE581; Mon, 26 May 2025 23:42:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1748295731; bh=Q78ajOhjX3CB/ZJEjCDbm4BL5dqxXe+e+h+yd2gTfx4=; h=From:To:Cc:Subject:Date:From; b=g6oSTfAo9eVDjRHvDp3OCqaXkScz+8xvVYJaKhXTg4JlcoP9EcsNzRlgno97tyXZF cHjBoSoWkuS6hdu0WKW5x0xccTT8mrnVHgI6cWWuuiBrv9nmS1ntebT+QsWmAGV414 k99TM6iQWhoMMz2VaXS+2fB5r0+RNYGGZYHpE2G4= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [RFC PATCH 0/4] rkisp1: Allow usage of more than 4 buffers Date: Mon, 26 May 2025 23:42:14 +0200 Message-ID: <20250526214224.13631-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 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" Hi all, In the rkisp1 pipeline the value of StreamConfiuration.bufferCount is reset to 4 on validate(). This effectively limits the number of buffers that are in the loop to 4. As soon as the consumers (gstream/pipewire...) of the buffers need more than 1 buffer at a time, we start to see frame drops. Sven resurrected an old series [1] that solves the issue at the expense of an additional control and breaking changes in the API. In the IoB code camp two weeks ago there were some discussions regarding improvements in the rkisp1 regulation and per-frame-control (PFC). PFC has been an ongoing topic for quite some time now and it seems to slowly converge. Still we were hesitant in breaking the API or introducing new controls before the overall concepts have stabilized enough. To mitigate the pain mentioned above we came up with a minimal changeset that allows to request more than 4 buffers. Only 4 (or the pipeline depth reported by the pipeline) buffers are queued into the device. This has the same benefits as [1] but doesn't require an API break. I'm not available this week so I post the patches as RFC only for others to try out as these were not thoroughly tested. Any feedback is greatly appreciated. Best regards, Stefan [1] https://patchwork.libcamera.org/project/libcamera/list/?series=5148 Stefan Klug (4): libcamera: pipeline_handler: Move waitingRequests_ into camera class libcamera: internal: Allow to limit the number of queued requests pipeline: rkisp1: Limit the maximum number of buffers queued in pipeline: rkisp1: Prperly handle the bufferCount set in the stream configuration include/libcamera/internal/camera.h | 2 + include/libcamera/internal/pipeline_handler.h | 8 ++-- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++++- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 6 +-- src/libcamera/pipeline/rkisp1/rkisp1_path.h | 4 +- src/libcamera/pipeline_handler.cpp | 37 +++++++++++++------ 6 files changed, 46 insertions(+), 23 deletions(-) Tested-By: Sven Püschel