From patchwork Fri Mar 24 18:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 18458 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 02469C0F1B for ; Fri, 24 Mar 2023 18:12:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B33BC6271F; Fri, 24 Mar 2023 19:12:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1679681577; bh=U5cOumwJWUQzf5/M1Y4/y9j/OC4cOqbsk5+8n4Bg84I=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=A5Ng8nT/P+8lg11WG3xt5ZagRnoBg27Xi9FrvlnpJzK+kJmCPosP4T0LRG5Jv5jCv gCS7eVxCGtALSKqaoYPs69jw9LyjsSdQ1XDXJYPMUgJf1i/bOlF8iX7CQ+LWgLvn56 94Mf46AkbXT2XI4uSAaEiI79lrqt/IBbpQT7YRU1sYRyl+exghvFW1J+8bv94PQ35k Ot+mYSWh1G4YKNmn+lDrAkH+ubB9MAIewqlIP33LkNiCFtRGGfDP2UkkLrQn2BpmUT ezwekV6nCiTRPFMtiScSkYACwdpjfbePinsFChZjp2MMcfOC1mKIi1PfINTPpRJYpq rUSMoBP8Q7CGQ== Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BDC6C61ECF for ; Fri, 24 Mar 2023 19:12:56 +0100 (CET) Received: from nicolas-tpx395.lan (192-222-136-102.qc.cable.ebox.net [192.222.136.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nicolas) by madras.collabora.co.uk (Postfix) with ESMTPSA id 3C968660312C; Fri, 24 Mar 2023 18:12:56 +0000 (GMT) To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Mar 2023 14:12:44 -0400 Message-Id: <20230324181247.302586-1-nicolas@ndufresne.ca> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 0/3] Add sensor mode selection to GStreamer 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: , X-Patchwork-Original-From: Nicolas Dufresne via libcamera-devel From: Nicolas Dufresne Reply-To: Nicolas Dufresne Cc: Nicolas Dufresne Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Nicolas Dufresne Sensor mode selection is needed to achieve specific framerate, or select specific field of view. The currently implemented method to do so it not portable, but works for M2M ISP. It consist of creating a stream with Raw role and forcing the width/height/format configuration that is unique to the wanted mode. Enumerating the modes is done by doing a validation loop. This has been tested on Raspberry Pi with an Arducam IMX477 sensor. This sensor has four modes: Modes: 'SRGGB10_CSI2P' : 1332x990 [120.05 fps - (696, 528)/2664x1980 crop] 'SRGGB12_CSI2P' : 2028x1080 [50.03 fps - (0, 440)/4056x2160 crop] 2028x1520 [40.01 fps - (0, 0)/4056x3040 crop] 4056x3040 [10.00 fps - (0, 0)/4056x3040 crop] Only one of these can achieve 60 fps, though at the cost of a smaller field of view. The pipeline manager does not take the framerate control into consideration when selecting a mode, since you need a configuration in order to set the control. It also does not know anything about the wanted field of view. To solve this, two new properties are added. sensor-modes is a GstCaps representation of all the modes. The sensor mode caps looks like: sensor-mode,width=1332,height=990,format=SRGGB10,framerate=[1/1, 120/1]; sensor-mode,width=2028,height=1080,format=SRGGB12,framerate=[1/1, 50/1]; ... The user can select a mode with a filter set to sensor-mode. The sensor-mode value can be the exact mode, or could be just something to match to. If an application want to ensure a 60fps capable mode is selected, it can do: libcamerasrc sensor-mode=sensor/mode,framerate=60/1 ! ... Note that on cameras like UVC camera, where its not possible to have multiple streams, sensor mode enumeration (which is extremely slow on these) is skipped, and the sensor mode selection will have no effect. Changes in v2: - Fixed missing merge conflicts - Retested with UVC and RPi Nicolas Dufresne (3): gstreamer: Add sensor mode selection doc: gstreamer: Add missing queues doc: gstreamer: Document the sensor-mode(s) properties README.rst | 18 ++++- src/gstreamer/gstlibcamera-utils.cpp | 4 + src/gstreamer/gstlibcamerasrc.cpp | 110 ++++++++++++++++++++++++++- 3 files changed, 128 insertions(+), 4 deletions(-)