From patchwork Wed Mar 27 17:27:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Vuillaumier X-Patchwork-Id: 19817 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 A04C5BD160 for ; Wed, 27 Mar 2024 17:27:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 506AA63331; Wed, 27 Mar 2024 18:27:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="BxN+g8Ew"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0610.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::610]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8303461C35 for ; Wed, 27 Mar 2024 18:27:54 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mofuAWTPBbXQ65w+bvse6Q+uLayZUjpXRodXv9x1G8sLLyWKgyaRtabMqOZsCY2mzYyhcAMorpUaiJFCaCfZa2WaTX4zoRP74A9Xysl3GgQh0256IoaHtxjAyfmNyzCtjYIS3jM+zzNoRRs4I05Doi0ffDLPlNNCJoSQtbDaWWk66GzVmMzZzvYs4Yb6hhz6Qr9UYgKguAdm6TW3BFlKXo2+NWWSXo5MwOoO8ztl7NkTIJ37JLFMq1PSQtLFJo1WT0XVAEQ3lIttY/UtngF77sFbXl3wpFsNBHFOob8xDyFf+BGbUABYbHrmrwLfVpyHix90Mpi522axNchjaXWqhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ausHyENyFmSp6Jn2RyD+RkqbRUxltVl9ICUhURik/UI=; b=LWkKMqeKjZ+IFWp7ERomR7RVBYWVcJ1k59nypnE8eKiztvqfAUyu7cQymoD3l4q2lnhIMM4djIuxIQZWAarTRwjrlwdDNcxC62lbcPNy5OEl1n3g5kMnvoHQ64onTTQfPKFFj/2aAhHsbn4gMa2B6wtV+tgqj/PKr6v8RrA9A+AWJYlW4BhGE+BgQi0wQKYU5BQWDh7X1brCYh+yw6294I+y7BeHyzsDNUCrjw77McANZ1ny45y09auCBtfm442xfTJxVd6MO6k8j0jHt2o1TNjCVVjMluKrdPsxLtwlHbSpmwPxT5bDtSU6yWVLK+Y4oylXLNuvemclUipqv6jcFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ausHyENyFmSp6Jn2RyD+RkqbRUxltVl9ICUhURik/UI=; b=BxN+g8Ew2DxvjUUB0eE4FkdlSEy1J53mpIyynUmvIt8mjaM2Wg+I+vL+TaH/2rwfQWTDhYKmHvBMltP5ZUdn/cvyZS47GxoroBoPVbUsPEBFi65ABgsSYNqey5QyalEuhMt0J1YmI76UZKk1ncjVIIS3/dfPJgtV4St+WO1cFek= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) by AM9PR04MB8796.eurprd04.prod.outlook.com (2603:10a6:20b:40b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.25; Wed, 27 Mar 2024 17:27:53 +0000 Received: from AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::2208:ff47:a8fe:dea6]) by AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::2208:ff47:a8fe:dea6%5]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 17:27:53 +0000 From: Julien Vuillaumier To: libcamera-devel@lists.libcamera.org Cc: julien.vuillaumier@nxp.com Subject: [PATCH v3 0/2] Add environment variable to order pipelines match Date: Wed, 27 Mar 2024 18:27:29 +0100 Message-Id: <20240327172731.434048-1-julien.vuillaumier@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: AM0PR02CA0167.eurprd02.prod.outlook.com (2603:10a6:20b:28d::34) To AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8147:EE_|AM9PR04MB8796:EE_ X-MS-Office365-Filtering-Correlation-Id: 68359147-9e55-4cd7-592f-08dc4e833bd6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lYMHbbtRK0uDn397gEMzQrPL+ajRK4x8sGRswjh4h0H0PCp+dfq+MA26OpZe87skq4dhhk5fKKWO8fHoiUEH44fK/4Li/kO7lQCm7I3R4PoLCjCnXz+JfczJ59kcKYGbAQVv++xgz6eb0SAJPDxe9o6Ho306sgklNX5dLrs+3LWCjKGJpnWXTFRO7nCImpUiTUfb+4Q1EFvrqdCPVSHmRo6L/8Kn293F/fYBFH2i+7fv/NNJzL0FNsxdpSIv9TpzBGaj3mDgtvgh9puArYiMmBBJn4/axFfAbE2nqP2nh88gTO9Qq06UGJOk4qLcYZTgnoU+I99wcXNfpHt44D9PdT6gJa+69n3DZupXumLhn5KGgVR782RtzZvwJQo8e100DaTc+w+KFpDrxCaJLS6yBJcwZukOKzuIWZc2IWA8eLIMbLrC/EOQTkNI2Q9FG+TZEWyHepwnrC9GnoCL8mwfQmsITHoIZ30UIGfVqixixpUKlb3UXx3hq/8Sz1pYr9YCQr0dUz9LRTcY+VpYpYQqCSu2nqqjvjP/EmS/iilrhQx6RROAdn3B25FcDbcWAqSWaS1S2i0DcWPcVLR4IC7iN+6pOX4K7JwEgazJZcGEX4xo2HkRuyCt499AMkD4xnZJYFsPVmvFENc/713RKGaYelRcYxKAVHfFmpt5BlIAp2I= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8147.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(366007)(376005)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UGIqFNx14PEhOwVBE8s9DRfqrrNOETcwxBzHiUivs75udkCZ5FrA1ULtrn/+1yT2uXHZdr7/4+5nOhUaYYy/9QxISmM+4Uxc+yctjV9meA1wE6/7xVfQ8AYSIdmjcccw/TEkfjZYDWWFyKza26fPNCJsJjTc/ZNRwY5f8cXD+k1oX3bpMMFbSyGGU65SzpqC0OsAmqvxgr2sn3ktgSfbFGT4tTLBFdHOGlL4BKxctoi/GhwkrqwdjBfGCMd7lPtblPadxYSWWySl+5CIl1rRjsEqG/5wej9MGnCD8UTiD+Wm1EyIFZ8kiu4pbMNZCxzdBCOvtjtuCWCEgnJI4AEQKPJCtZVDx7A3+i1fsPl8H9X8K7VoxT1x3XI3Ew39askh2KbtWPn9PTqevQL+RH21eGv7Tyx9jIJgfNeOlKEzdJKd6fAmxDZBhX/2m6LnmFdq3tQp28tvbRoclx9ePCEJeEWwUHSNI4ozh7QF6TPfBs4KloaZiUW926pQTrNf+T20Fjq3EOGce+NpUTDAuTHslt50Gulvp0t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-MS-Exchange-CrossTenant-Network-Message-Id: 68359147-9e55-4cd7-592f-08dc4e833bd6 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8147.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 17:27:53.2952 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pZtfh8BoE7niWi2pIx533l89naTobZC9Yte0QsSL/Z4ILcDCC398prSR3dn1y634ogrg6DbIJ1sVb3A19X6zFLFK9JqqIC+fghyULmnZRMY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8796 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, This is the v3 of the change to support the configuration of the order of pipelines match, by using an environment variable. v3: - PipelineHandlerFactoryBase::getFactoryByName() unnecessary 'else' removed. - CameraManager::pipelineFactoryMatch() declaration moved to match the position of the method definition. - Add to env variable documentation the information about how the pipeline handlers names are defined in the source - also breaked long line at 80 characters. - Fix and complement commit messages. - Fix and complement source comments. v2: - Add 'get factory by name' helper to PipelineHandlerFactoryBase as a preceding patch - Move lamba pipeMatch() to a private class function - Remove unnecessary string empty test - Inline lamba nameMatch - Update comments and variable names per v1 reviews Link to v2: https://lists.libcamera.org/pipermail/libcamera-devel/2024-March/040859.html Thanks There is currently no way to configure the order used by the CameraManager to select the pipeline handlers to match devices from the DeviceEnumerator. That is a limitation when multiple pipeline are compiled in, capable of handling the devices of the platform. In that case, user can not specify the pipeline that will bind to the devices and handle the cameras. This change adds an environment variable, optionnaly initialized with an ordered list of candidate pipelines that CameraManager shall use to match the devices. When the variable is not set, CameraManager behavior is unchanged: every registered pipeline is selected in turn to attempt device matching. Using that variable, user has the option to explicitly select the pipeline or the subset of available pipelines that CameraManager shall consider for matching. Julien Vuillaumier (2): libcamera: pipeline: Add a get factory by name helper libcamera: camera_manager: Add environment variable to order pipelines match Documentation/environment_variables.rst | 8 +++ include/libcamera/internal/camera_manager.h | 1 + include/libcamera/internal/pipeline_handler.h | 1 + src/libcamera/camera_manager.cpp | 53 ++++++++++++++----- src/libcamera/pipeline_handler.cpp | 22 ++++++++ 5 files changed, 73 insertions(+), 12 deletions(-)