From patchwork Fri Mar 24 17:40:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 18454 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 3B238C0F1B for ; Fri, 24 Mar 2023 17:40:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 697F3603AA; Fri, 24 Mar 2023 18:40:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1679679625; bh=kGyiU+gHB37rMb9A9auY/CrpymC/j2Vz/UUU1LEYviQ=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=4Dqx2NrYr1eufazBti+5iCxLQOLMhZscqaPtbLiGHLJHlBFcE/YCVL/rn9WyFISR7 KkNZchuDHZtmB3RJ695ZRqWsnBSeC26J6l5hDITwAxd4h/9C5Ce7/y1FfkXjNadZJ6 9okxV4NYg7NDrTgA9cdaFu7W9UgwFVpjBojYwbZ4nkVV9gcXG8ey02PAPkUYk4fEWc yO0y2aIziemuP7uEMCnmoAh8m4/e55+qCikzz7iAtTEl9Y5+majNNdkFGrpY1mJUxH lj6uaRFkmATX01Ma8ZW3AAkCmHHQ6J5SXa4mIEBN0w3B/7m/EYgC3andNASN7mrsTT 9toku81dB0Ptw== 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 6FA06603AA for ; Fri, 24 Mar 2023 18:40:23 +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 D23DD660312C; Fri, 24 Mar 2023 17:40:22 +0000 (GMT) To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Mar 2023 13:40:06 -0400 Message-Id: <20230324174009.300123-1-nicolas@ndufresne.ca> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 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. 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 | 123 ++++++++++++++++++++++++++- 3 files changed, 142 insertions(+), 3 deletions(-)