Patch Detail
Show a patch.
GET /api/patches/19646/?format=api
{ "id": 19646, "url": "https://patchwork.libcamera.org/api/patches/19646/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19646/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20240308110056.453320-3-julien.vuillaumier@nxp.com>", "date": "2024-03-08T11:00:56", "name": "[v2,2/2] libcamera: camera_manager: Add environment variable to order pipelines match", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "7b528d61a9947c977d8d43c7f9f44f08ae3e85cb", "submitter": { "id": 190, "url": "https://patchwork.libcamera.org/api/people/190/?format=api", "name": "Julien Vuillaumier", "email": "julien.vuillaumier@nxp.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19646/mbox/", "series": [ { "id": 4207, "url": "https://patchwork.libcamera.org/api/series/4207/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4207", "date": "2024-03-08T11:00:54", "name": "Add environment variable to order pipelines match", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4207/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19646/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19646/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B2102C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 8 Mar 2024 11:01:39 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7567C62875;\n\tFri, 8 Mar 2024 12:01:39 +0100 (CET)", "from EUR04-VI1-obe.outbound.protection.outlook.com\n\t(mail-vi1eur04on20601.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f403:2611::601])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 91ED562865\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 8 Mar 2024 12:01:37 +0100 (CET)", "from AM9PR04MB8147.eurprd04.prod.outlook.com\n\t(2603:10a6:20b:3e0::22)\n\tby AM9PR04MB8683.eurprd04.prod.outlook.com (2603:10a6:20b:43e::23)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38;\n\tFri, 8 Mar 2024 11:01:36 +0000", "from AM9PR04MB8147.eurprd04.prod.outlook.com\n\t([fe80::3fdf:4cf8:d542:1b49]) by\n\tAM9PR04MB8147.eurprd04.prod.outlook.com\n\t([fe80::3fdf:4cf8:d542:1b49%4]) with mapi id 15.20.7362.028;\n\tFri, 8 Mar 2024 11:01:36 +0000" ], "Authentication-Results": [ "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=nxp.com header.i=@nxp.com header.b=\"cvpY9zxx\";\n\tdkim-atps=neutral", "dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=nxp.com;" ], "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n\tb=M6dcF0gil9D1qBg3dKGtLE+gWfWDImRve7r/MbtWcCS/H8x6dqj4Z66DB39juoA26QtdjFDD1juHF6Sezb9fkCrOoSROSsLj3eWQuOMOh0dIl6GG6MEjnGlbwgi6ZDJ5gnhkTzT9XAZWtGzxczpqiFFpOr20PFvwlum+pppNX7BuCgnv1Op6hopTl1KNRVeyYBtrGp1ywlN4Qi5V9mol9VCV87p5ZAV9nWcCr/3l22UgNZVdG25h/WHVtKl3zfCoIxxI2RWD6k0l+7SA/3Ruy47IErK+qgYpm6BddgWdssgl9UNTYQRxL84ximjxLHCD30noCsHcCtjdIEl9Iu6EvA==", "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector9901;\n\th=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;\n\tbh=CqbfDMgXnG42hbsPTvU39oLRCo07hgHGY5JvaRvUef4=;\n\tb=YADLzYmr09k2SYVPLLOsumaTuHLiT6mZUpyzZLX83sZ/4TlHpuWHZt/hJxEYxNlIgpKvqKpF9zfFMM1XyHNKZHYvAFX/rA9fE/7Lnbmiegegf7pM+CSXWHUg6SDYmCXcYalvX5AioXUMAB6b46NHxQlhXxi2bfjz1Z2G/bPDCELiDLwbwrJttRYcuchboSOJUZYDqwzCw9EQhPSuv5fDfdGr17BmcHtecvnmVMTPx7toCn2DfGnT4uYqmL9OSL0DGXCAhtjgbM13/dDzdKO1xquLecXgPmY8jjHZpBkDBlHWhzfQkdFWKzEfTQNbl54iiOkWY0SHNNhjk9szaPaLSA==", "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com;\n\tdkim=pass header.d=nxp.com; arc=none", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=CqbfDMgXnG42hbsPTvU39oLRCo07hgHGY5JvaRvUef4=;\n\tb=cvpY9zxxDFUBE35fhnCTUf4bDhyle83Mnu5pL7Jn2mcUKUl2NL4nxwmieiurp9SrukMBZOFeG5MCcbzb3QKSpOqsmT0qbHUoZ61o6k4aJkkW61vItS8vrS+C6kVfWowY/fRQ55jXHNknbdA8mhMwGXoRaCI5lAX6X9vmVdwxwmI=", "From": "Julien Vuillaumier <julien.vuillaumier@nxp.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH v2 2/2] libcamera: camera_manager: Add environment variable\n\tto order pipelines match", "Date": "Fri, 8 Mar 2024 12:00:56 +0100", "Message-Id": "<20240308110056.453320-3-julien.vuillaumier@nxp.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20240308110056.453320-1-julien.vuillaumier@nxp.com>", "References": "<20240308110056.453320-1-julien.vuillaumier@nxp.com>", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-ClientProxiedBy": "AM0PR04CA0052.eurprd04.prod.outlook.com\n\t(2603:10a6:208:1::29) To AM9PR04MB8147.eurprd04.prod.outlook.com\n\t(2603:10a6:20b:3e0::22)", "MIME-Version": "1.0", "X-MS-PublicTrafficType": "Email", "X-MS-TrafficTypeDiagnostic": "AM9PR04MB8147:EE_|AM9PR04MB8683:EE_", "X-MS-Office365-Filtering-Correlation-Id": "7e988057-3e17-4ec0-ee5e-08dc3f5f1f82", "X-MS-Exchange-SenderADCheck": "1", "X-MS-Exchange-AntiSpam-Relay": "0", "X-Microsoft-Antispam": "BCL:0;", "X-Microsoft-Antispam-Message-Info": "rPu54LixYkyrquPxrkqkA8MnvQHruN43X+FzBnEB/qM+EssJAiO0xeFcbOrlsVlRcekgtUoXsAfJ127hHINOcB8aqkyygXuutOuVbIEZfYqIfccsD/LVplTlPgAV+QloMInc1G+mgS1vaxHigx4uwBDFzAsdUW/Amcsp8DDjkL+PTmI89pcmB27VhLqKuwZ/iWvzcNZ3BCcQDlMpp23RXCqQT81S01IR+E9aOeP1j7q3H9DjZrGiSTnHrh+KeMhrx0P150wag8RN0sFHVsiO4yf4jGUVXEv1RJhuN281M8Icxsb+6O+v1JSQS/oaDJyYOekMtraN6DMSHOQXmzq/g61dWohpS5YuxqpHNM3V3Qr9oy4a6OSgthOvzRqGbWSSnWq+kJYnB7yaVQYhgtReF5HUro5II9OwUp6FSO3l1A0T6JIliTFTTJuibSzukNNmyF0h5uVghOQvT57wwrm0kFkeCCGhYkPMwuMpgd267vm+cXmFCbtq7RaZTHlp5bZadK6GNjpAkCS7mz7YP4TmcAFjo9uUbrp7fKJSMBcAaey/1ZTeEPAFUhTNXj/bW7z/g0ykVjpyeXfCoY+i6PPTrCOnIcmFwI3kRyxFytqu0SHEDacCKzKIXpoKRa4z0AI4gR/sOE+yUNWE+ILZx3eVKpvncni1zjCAXg/6fKgZJuFcBUbouH/TVdyY6R2XV2+fp5tjDL/hxpaOaWyiGRvErg==", "X-Forefront-Antispam-Report": "CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:AM9PR04MB8147.eurprd04.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230031)(376005)(52116005)(1800799015)(38350700005); DIR:OUT;\n\tSFP:1101; ", "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1", "X-MS-Exchange-AntiSpam-MessageData-0": "Q8jFnLkTOZQwMYppqMpO977PoAYKdITAIZEZ4qBRtW6NI78wU5+ityvKrm/+YhwcKPSegaTnNmKpI6mmpMDEIDySv6Ao2Z+IT4CMiYXwgtXTh96AYGayV+g137GRyGET8KaEENiAfdRKNwFyv8giGGXKa/4PlXyWLIw+RMHcDnaCzdfejeOvUVuyvnN9chKZ8RYAFLjqsxzJz8jFlvcTZ8PTMbV3O6DKlRiHtODbxxqoItvznie8xhrBrRHUbayVk19y76bRtkJc82AMI/c/u6TE6kcNtRFUPFFvzRJm7wd96KlG+i8OOnlE2fBjVzIBdb8ZHUwCCThNA8yzbcNSUpuwwOA7auNANvy77MwzGonNAzsktA3Rb+sRmLxKCq/+9rxrEpCSn09NdSRsDr+cQEv1AoSjmqYyW+wiaxpMShRrK9AEw9b8VXHsqsTPvkjPTXvorf7Zbnl21/EOd1gX2iabrX11QHBKQLD/7J5l6GAZxGiM4UZ1vpthUlRkMSm4XWQ4ayiC+xutBHuUYuf5teqD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/eXQYQXfQ4+1qZJjWA2Qr8c+WkTg==", "X-OriginatorOrg": "nxp.com", "X-MS-Exchange-CrossTenant-Network-Message-Id": "7e988057-3e17-4ec0-ee5e-08dc3f5f1f82", "X-MS-Exchange-CrossTenant-AuthSource": "AM9PR04MB8147.eurprd04.prod.outlook.com", "X-MS-Exchange-CrossTenant-AuthAs": "Internal", "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "08 Mar 2024 11:01:36.4206\n\t(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": "n2azlw/UpKzt0NvRrr/ot3zdz17xJ6VL6piYkpzC28fVqEKzRvJgKH8AnMZ5fox0Es1VB5EZlmlfJ0l7K8gi6XdXFHculkXSBAtEgdLgJPc=", "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "AM9PR04MB8683", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "To match the enumerated media devices, each pipeline handler registered\nis used in no specific order. It is a limitation when several pipelines\ncan match the devices, and user has to select a specific pipeline.\n\nFor this purpose, environment variable LIBCAMERA_PIPELINES_MATCH_LIST is\ncreated that gives the option to define an ordered list of pipelines\nto invoke during the match process.\n\nLIBCAMERA_PIPELINES_MATCH_LIST=\"<name1>[,<name2>[,<name3>...]]]\"\n\nExample:\nLIBCAMERA_PIPELINES_MATCH_LIST=\"PipelineHandlerRkISP1,SimplePipelineHandler\"\n\nSigned-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>\n---\n Documentation/environment_variables.rst | 5 ++\n include/libcamera/internal/camera_manager.h | 1 +\n src/libcamera/camera_manager.cpp | 57 ++++++++++++++++-----\n 3 files changed, 51 insertions(+), 12 deletions(-)", "diff": "diff --git a/Documentation/environment_variables.rst b/Documentation/environment_variables.rst\nindex a9b230bc..ea4da3c9 100644\n--- a/Documentation/environment_variables.rst\n+++ b/Documentation/environment_variables.rst\n@@ -37,6 +37,11 @@ LIBCAMERA_IPA_MODULE_PATH\n \n Example value: ``${HOME}/.libcamera/lib:/opt/libcamera/vendor/lib``\n \n+LIBCAMERA_PIPELINES_MATCH_LIST\n+ Define an ordered list of pipeline names to be used to match the media devices in the system.\n+\n+ Example value: ``PipelineHandlerRkISP1,SimplePipelineHandler``\n+\n LIBCAMERA_RPI_CONFIG_FILE\n Define a custom configuration file to use in the Raspberry Pi pipeline handler.\n \ndiff --git a/include/libcamera/internal/camera_manager.h b/include/libcamera/internal/camera_manager.h\nindex 33ebe069..c57e509a 100644\n--- a/include/libcamera/internal/camera_manager.h\n+++ b/include/libcamera/internal/camera_manager.h\n@@ -45,6 +45,7 @@ private:\n \tint init();\n \tvoid createPipelineHandlers();\n \tvoid cleanup() LIBCAMERA_TSA_EXCLUDES(mutex_);\n+\tvoid pipelineFactoryMatch(const PipelineHandlerFactoryBase *factory);\n \n \t/*\n \t * This mutex protects\ndiff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp\nindex 355f3ada..620be1c8 100644\n--- a/src/libcamera/camera_manager.cpp\n+++ b/src/libcamera/camera_manager.cpp\n@@ -99,13 +99,36 @@ int CameraManager::Private::init()\n \n void CameraManager::Private::createPipelineHandlers()\n {\n-\tCameraManager *const o = LIBCAMERA_O_PTR();\n-\n \t/*\n \t * \\todo Try to read handlers and order from configuration\n-\t * file and only fallback on all handlers if there is no\n-\t * configuration file.\n+\t * file and only fallback on environment variable or all handlers, if\n+\t * there is no configuration file.\n+\t */\n+\n+\t/*\n+\t * When a list of preferred pipelines is defined, iterate through the\n+\t * ordered list to match the devices enumerated.\n+\t * Otherwise, device matching is done in no specific order with each\n+\t * registered pipeline handler.\n \t */\n+\tconst char *pipesList =\n+\t\tutils::secure_getenv(\"LIBCAMERA_PIPELINES_MATCH_LIST\");\n+\tif (pipesList) {\n+\t\tfor (const auto &pipeName : utils::split(pipesList, \",\")) {\n+\t\t\tconst PipelineHandlerFactoryBase *factory;\n+\t\t\tfactory = PipelineHandlerFactoryBase::getFactoryByName(pipeName);\n+\t\t\tif (!factory)\n+\t\t\t\tcontinue;\n+\n+\t\t\tLOG(Camera, Debug)\n+\t\t\t\t<< \"Found listed pipeline handler '\"\n+\t\t\t\t<< pipeName << \"'\";\n+\t\t\tpipelineFactoryMatch(factory);\n+\t\t}\n+\n+\t\treturn;\n+\t}\n+\n \tconst std::vector<PipelineHandlerFactoryBase *> &factories =\n \t\tPipelineHandlerFactoryBase::factories();\n \n@@ -117,15 +140,25 @@ void CameraManager::Private::createPipelineHandlers()\n \t\t * Try each pipeline handler until it exhaust\n \t\t * all pipelines it can provide.\n \t\t */\n-\t\twhile (1) {\n-\t\t\tstd::shared_ptr<PipelineHandler> pipe = factory->create(o);\n-\t\t\tif (!pipe->match(enumerator_.get()))\n-\t\t\t\tbreak;\n+\t\tpipelineFactoryMatch(factory);\n+\t}\n+}\n \n-\t\t\tLOG(Camera, Debug)\n-\t\t\t\t<< \"Pipeline handler \\\"\" << factory->name()\n-\t\t\t\t<< \"\\\" matched\";\n-\t\t}\n+void CameraManager::Private::pipelineFactoryMatch(const PipelineHandlerFactoryBase *factory)\n+{\n+\tCameraManager *const o = LIBCAMERA_O_PTR();\n+\n+\t/*\n+\t * Provide as many matching pipelines as possible\n+\t */\n+\twhile (1) {\n+\t\tstd::shared_ptr<PipelineHandler> pipe = factory->create(o);\n+\t\tif (!pipe->match(enumerator_.get()))\n+\t\t\tbreak;\n+\n+\t\tLOG(Camera, Debug)\n+\t\t\t<< \"Pipeline handler \\\"\" << factory->name()\n+\t\t\t<< \"\\\" matched\";\n \t}\n }\n \n", "prefixes": [ "v2", "2/2" ] }