From patchwork Tue Mar 16 15:52:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marian Cichy X-Patchwork-Id: 11592 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 8D16CBD80C for ; Tue, 16 Mar 2021 15:52:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D43DF68D4A; Tue, 16 Mar 2021 16:52:29 +0100 (CET) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 98CB068D48 for ; Tue, 16 Mar 2021 16:52:27 +0100 (CET) Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMBze-0000V0-R9; Tue, 16 Mar 2021 16:52:26 +0100 Received: from mci by dude02.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lMBze-0003DL-HC; Tue, 16 Mar 2021 16:52:26 +0100 From: Marian Cichy To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Mar 2021 16:52:05 +0100 Message-Id: <20210316155211.6679-1-m.cichy@pengutronix.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28 X-SA-Exim-Mail-From: mci@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [RFC PATCH 0/6] Add propagation of sensor frame interval 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: , Cc: graphics@pengutronix.de, Marian Cichy Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This patch series is meant to demonstrate my use-case and to start a discussion. The main target is to have a mechanism where the application, e.g. libcamerasrc can read out the frame interval set by the driver. It is generally useful for applications to know the framerate, e.g. one can build pipelines with Gstreamer where the framerate is used to pre-allocate a proper amount of memory or to compute the latency. It is also an useful debug-information in general. this approach uses the frame_interval ioctls which is for my driver the only way to get the frame rate. I suspect there is also a different approach using controls::FrameDurations which I find in some parts of libcamera. However, it is not clear to me, how I would use this and what the driver needs to do here or if it even would be the better approach for my use-case. Any comments to this are welcome. Marian Cichy (6): libcamera: Add fraction.h libcamera: stream: Add frame interval attribute libcamera: v4l2_subdevice: Add methods to get/set frame interval pipeline: simple: Propagate frame interval through pipeline pipeline: simple: rename setupFormats to setupStreamProperties gst: utils: Add framerate to caps include/libcamera/fraction.h | 34 ++++++++++++ include/libcamera/internal/v4l2_subdevice.h | 4 ++ include/libcamera/stream.h | 2 + src/gstreamer/gstlibcamera-utils.cpp | 2 + src/libcamera/fraction.cpp | 60 +++++++++++++++++++++ src/libcamera/meson.build | 1 + src/libcamera/pipeline/simple/simple.cpp | 31 +++++++++-- src/libcamera/v4l2_subdevice.cpp | 43 +++++++++++++++ 8 files changed, 173 insertions(+), 4 deletions(-) create mode 100644 include/libcamera/fraction.h create mode 100644 src/libcamera/fraction.cpp