From patchwork Wed Apr 19 08:58:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 18540 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 5CA42C3274 for ; Wed, 19 Apr 2023 08:58:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AE2FF627C1; Wed, 19 Apr 2023 10:58:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1681894712; bh=xbimLW7IfavOO4wvlCRojtdOMlUfxGpZjZ0RbDIgzMM=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=B822mngYtkiz+VItbAeATzVhY2TrJLC+oDZRa41xKFTwDGsVRbrUbYo2myq4kORKD S5UIaE/YEc8mCTEkCukGQxFyqA+275wH2eyqi9RSo015C3Jcq18xdl54r8+merLgrJ stqkx+HDcjSu8qahEKc9PexLVcfCwhlANARQnDybSpeLEr9AtxzU3iv2IXW88fuwQF fFYyfOW86BwGb5qY8htLHjDruNkRAgJOvLv3d6238FWY8z4qT2dgUpoZZV2aJakuaz V6pSdeB+oDIe0HaB3OSOD7X4g+286qIrd2wo9zsTY0BEaNdajq+6j2WQpWlDJbZJJh WpD852B0Uxifg== 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 97A3A627B1 for ; Wed, 19 Apr 2023 10:58:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="pRotODtG"; dkim-atps=neutral Received: from Monstersaurus.tail69b4.ts.net (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DFEFDF07; Wed, 19 Apr 2023 10:58:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1681894704; bh=xbimLW7IfavOO4wvlCRojtdOMlUfxGpZjZ0RbDIgzMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pRotODtGocr/mJliAl0hJhw+nAPXPe9oS2EwJaTQ5TDbrM5cCGcl6pyM86S3OM2F/ WHSKK9puGNoBT+oVPbImY/xk3npLdruO0SQDAbkPUT6NB3FUQDiRhMnDHLekeOqGaI +pEt0viKA4Z3T0LQA1h0y3an906+nrJuU9WOLM0A= To: libcamera devel Date: Wed, 19 Apr 2023 09:58:19 +0100 Message-Id: <20230419085821.2682901-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230419085821.2682901-1-kieran.bingham@ideasonboard.com> References: <20230419085821.2682901-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] libcamera: controls: Support dev_t in an Integer32 type. 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: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Allow dev_t device numbers to be stored in a ControlValue utilising the space of a 32 bit integer. Signed-off-by: Kieran Bingham --- Note that dev_t is typedef'd as an unsigned long, and this allows all unsigned long types to be mapped to a ControlTypeInteger32. I'm not sure I like that bit, so I'm very open to ideas and suggestions here. Ideally without having to duplicate the devnum vector just after it's created, just to retype it. include/libcamera/controls.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index cf94205577a5..84033babbcd5 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -62,6 +62,11 @@ struct control_type { static constexpr ControlType value = ControlTypeInteger32; }; +template<> +struct control_type { + static constexpr ControlType value = ControlTypeInteger32; +}; + template<> struct control_type { static constexpr ControlType value = ControlTypeInteger64; From patchwork Wed Apr 19 08:58:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 18541 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 47AE9C32A4 for ; Wed, 19 Apr 2023 08:58:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4558A627BC; Wed, 19 Apr 2023 10:58:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1681894713; bh=JS0aK5EJnbYvFpYM5ottKPKOfn/6KsgdlR8Suygsv7Q=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=yjICudSdq/bBXha+JecrdoGuL7MFR1z8z0eae8CZWb5Lk9rkfQv4bOS/21HxEPSie keUzawaquqvaLCzOtlNW8Riv3kF8PxBcvz8+oFEDbjjt3u6m3d7xFLzD7B4a1LxWqw aFoKlxRuHED/NhG96L/yJgGmT1UgMLrJIPCPDs97vZc/AhS5Y5ttK6661NI0rphqvg KTjQ0gNu8G3DkIrhVl+RkZDY4ZwVxtbAOSAtm7TRF8wmOr/YTAzRU9pgcIx/2vdIMM FhYe8/8/EZoPFGl89eSoI/t2TwREhipzFN0U3ind1NhOSPDep5TTSJoVNppx66hV8i 3h/6LRw7XGTew== 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 CBAFD627B7 for ; Wed, 19 Apr 2023 10:58:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cUdQNjj8"; dkim-atps=neutral Received: from Monstersaurus.tail69b4.ts.net (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2CE4E1180; Wed, 19 Apr 2023 10:58:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1681894704; bh=JS0aK5EJnbYvFpYM5ottKPKOfn/6KsgdlR8Suygsv7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cUdQNjj8B59N8/E6oFnyGyo02bnKMoC0J4L6FmYfd/BlZ5eNWsj8NILKCmZt+Ne1W D6+92AWoyhcarY+m1fzeSk1JHygj3noJTcpwiTJ+PNyWqeQzrcein13/nMPlMpjLV1 S3zpV5fn3ee63v0mCWnXbxaRQvquSqXp3BVpBS7I= To: libcamera devel Date: Wed, 19 Apr 2023 09:58:20 +0100 Message-Id: <20230419085821.2682901-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230419085821.2682901-1-kieran.bingham@ideasonboard.com> References: <20230419085821.2682901-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] libcamera: properties: Provide a Devices camera property 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: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Provide a new Camera property that allows pipeline handlers to list any devices used to operate the device. This allows other frameworks and daemons such as Pipewire to better understand the resources consumed by a Camera and consider ignoring those resources when enumerating camera devices on a system. Signed-off-by: Kieran Bingham --- src/libcamera/property_ids.yaml | 8 ++++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml index cb55e0ed2283..5b511ea934f7 100644 --- a/src/libcamera/property_ids.yaml +++ b/src/libcamera/property_ids.yaml @@ -690,6 +690,13 @@ controls: that is twice that of the full resolution mode. This value will be valid after the configure method has returned successfully. + - Devices: + type: dev_t + size: [n] + description: | + A list of integer values of type dev_t denoting major and minor device + number of the underlying devices used in the operation of this camera. + # ---------------------------------------------------------------------------- # Draft properties section From patchwork Wed Apr 19 08:58:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 18542 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 BA424C32A5 for ; Wed, 19 Apr 2023 08:58:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DBF95627C4; Wed, 19 Apr 2023 10:58:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1681894713; bh=H6kBlsFt1NnH5Lv5onqRluHkOb6OG781rOzuvIckdeA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Y53fj45Y8qvTP1MaFD3lXRf0md7RyXrXoj2uWPTV66hJgAEodVctYDQYLE2FukV7q ZlJMuDXBxDvdkQ1IFEqhK0QlebJfaObQ/qusvdy94zSJPrmvoft2nU5YsMx4PL1H20 YuWKQ7qwhjm3nZ2nikTydqE4Dy9R/vfTbZilu0J0DH4WJylAKWlmsHJcJtCwJVtHnB 37EQeX00B0P/xTSrZr7VvUz8P5c/hGtRA5Gd+/bwiix1kiB5LP9dGx+xQmK9E5CHKN bjKF41id9EtdQclVloedSzsv0Jn+sHYpbEdToLcAlD2fNmO3vhRaQZ+MXXWjVs7NlU bgQUh7rqCZWyA== 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 0823F627AB for ; Wed, 19 Apr 2023 10:58:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GLOUqCqX"; dkim-atps=neutral Received: from Monstersaurus.tail69b4.ts.net (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6D5D612F; Wed, 19 Apr 2023 10:58:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1681894704; bh=H6kBlsFt1NnH5Lv5onqRluHkOb6OG781rOzuvIckdeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GLOUqCqXZQ+LWqzB5/IEyxRHLEW+aoI7uifbbt+tCnd06KGZidqrLTMLQrHfBaGaE uavzna/4OizKqRWWTGFceNUrlMXrSp4adYrSuW/SVEHWZxLGJ2a430zsrzAaZnfi8x /wIk6ZyC2AkzroAS05RJYWargy6Oi5+lrIVzYOy8= To: libcamera devel Date: Wed, 19 Apr 2023 09:58:21 +0100 Message-Id: <20230419085821.2682901-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230419085821.2682901-1-kieran.bingham@ideasonboard.com> References: <20230419085821.2682901-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] libcamera: pipeline: Register device numbers with camera 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: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Register the identified device numbers with each camera as the Devices property. This facilitates camera daemons or other systems to identify which devices are being managed by libcamera, and can prevent duplication of camera resources. Signed-off-by: Kieran Bingham --- src/libcamera/pipeline_handler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index f72613b8e515..66e7def51cd1 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "libcamera/internal/camera.h" #include "libcamera/internal/device_enumerator.h" @@ -624,6 +625,13 @@ void PipelineHandler::registerCamera(std::shared_ptr camera) } } + /* + * Store the associated devices as a property of the camera to allow + * systems to identify which devices are managed by libcamera. + */ + Camera::Private *data = camera->_d(); + data->properties_.set(properties::Devices, devnums); + manager_->addCamera(std::move(camera), devnums); }