Patch Detail
Show a patch.
GET /api/1.1/patches/19628/?format=api
{ "id": 19628, "url": "https://patchwork.libcamera.org/api/1.1/patches/19628/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19628/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20240304181816.2361334-2-julien.vuillaumier@nxp.com>", "date": "2024-03-04T18:18:16", "name": "[v1,1/1] libcamera: camera_manager: Add environment variable to order pipelines match", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "7c07a57ac254b5db6e680c8ffc53122d2a07ff4a", "submitter": { "id": 190, "url": "https://patchwork.libcamera.org/api/1.1/people/190/?format=api", "name": "Julien Vuillaumier", "email": "julien.vuillaumier@nxp.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19628/mbox/", "series": [ { "id": 4201, "url": "https://patchwork.libcamera.org/api/1.1/series/4201/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4201", "date": "2024-03-04T18:18:15", "name": "Add environment variable to order pipelines match", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4201/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19628/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19628/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 0CEC5C326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 4 Mar 2024 18:18:50 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B64BB62867;\n\tMon, 4 Mar 2024 19:18:49 +0100 (CET)", "from EUR05-AM6-obe.outbound.protection.outlook.com\n\t(mail-am6eur05on20601.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f403:2612::601])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 044F2627FC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 4 Mar 2024 19:18:48 +0100 (CET)", "from AM9PR04MB8147.eurprd04.prod.outlook.com\n\t(2603:10a6:20b:3e0::22)\n\tby AM8PR04MB7394.eurprd04.prod.outlook.com (2603:10a6:20b:1d1::10)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39;\n\tMon, 4 Mar 2024 18:18:47 +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.7339.035;\n\tMon, 4 Mar 2024 18:18:47 +0000" ], "Authentication-Results": [ "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=nxp.com header.i=@nxp.com header.b=\"ZgOqS42u\";\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=RGB/4wTeIJUiFCaedC4T5YKZ0yv+xpdDW61hw8n9adlVGTWPsR1uaP2ErRiGMdCAmtIjJVDy0BlxmroloJ2Q8os/VMUS6PG9pKytU70LFaxzmDR/jvTKnlnj45ckDO/EuPBr1Kk4jXXEkC61tyyu61vH7eFt4PpkQ363EWaiXOfine/7yciQcumuhzg9HJk7oGQyW/nyALJOxjp/33rfGhqZgeRkiHVbBqyA294xgs+3BwOem4nPWsaNReEZSfwzNjStBDuhlFxyZ4CfHTfGlTNIlyLevFiRYUG2FZ4AAqgRg/XC53+l81UZVnEqtbMvQJ2IIfeps/qlbEWiK5sjGQ==", "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=gwObTKw9+MxjEWFrUG+zgt/jcwhAF0/g7RIJ0SN5B9M=;\n\tb=E5ckG8UNkEGozftJkjl3WZ82XfP1s64Rr7y/PJn2EF1cFIoySSTvwpN5wtHqE+Dj9p8OuJHXa9enZmHrfQXdUY984aYiZ/2CUeOHfocj0f38qI8S+nUzgwF7Uot1dIv3ki1lvRt6W4MUgR4QSHjFq1nKJzyLOFOOY6489u5FCpdQ0dCHep2Zc2Vhh9vKYPO8aXEfJaxRdazWjJWNb4QCnPc1xG8hFsulCxLU+HGrni8yHlD3z+l4M0Ii7fVteASPtkgtJhVSodEzFQRRj/pO7L5MGvPX/1twatvMz80/LyNz3GHmRsHdO/a+ThmcASGyn3NTFCJXXQQUkWN9ZArRwA==", "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=gwObTKw9+MxjEWFrUG+zgt/jcwhAF0/g7RIJ0SN5B9M=;\n\tb=ZgOqS42uU4KFNscXMJ/7JHJ9hAR0RXzLPY5HCbOjM9BeGcYVjOuLq2fi4P5JR5hNyD5TOC7vwxWxX4R4rhHWu+qYHUlRFblZOv+xt6aI3ZHRbs1jUsHQnP4WD39m5Lozcg+SHWLFwg1wYvIkIZaV/L7hrbHVY1Zl2gbKNY9rR+A=", "From": "Julien Vuillaumier <julien.vuillaumier@nxp.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH v1 1/1] libcamera: camera_manager: Add environment variable\n\tto order pipelines match", "Date": "Mon, 4 Mar 2024 19:18:16 +0100", "Message-Id": "<20240304181816.2361334-2-julien.vuillaumier@nxp.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20240304181816.2361334-1-julien.vuillaumier@nxp.com>", "References": "<20240304181816.2361334-1-julien.vuillaumier@nxp.com>", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-ClientProxiedBy": "AS4P191CA0015.EURP191.PROD.OUTLOOK.COM\n\t(2603:10a6:20b:5d5::12) 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_|AM8PR04MB7394:EE_", "X-MS-Office365-Filtering-Correlation-Id": "c134b2cc-5940-447e-49f4-08dc3c778894", "X-MS-Exchange-SenderADCheck": "1", "X-MS-Exchange-AntiSpam-Relay": "0", "X-Microsoft-Antispam": "BCL:0;", "X-Microsoft-Antispam-Message-Info": "fc8bBXjykYxyKbZrmEj8nUJiZg7Fyc7fK7lNYEDEN7hNs8FhL0fSRD4nhIZldQCP1KPv6JwZ5heqqHdIGhMseOp+dIH5tnJTN0urcX8EoDNL8yeOzKrI7WImzX4N4X76frzZmywlpwEBTFt5/oZmxE68xAofP3dMAM+loCXcwzOJAaSj5o0rvzQ5/G5tw5kneVnCgJAsC0DM//TiW6KAORpswE7c0h6bn+/9VHRoxEONP6/0XVAq8zGIbY+Vr1VzoQUTmiBPpScWf9qGhPso8uQ0tzy832hxmNDFnhSjQZbSjxQezBDqeJO44inQfwAxb1ngUPDff2FYM0zJPkB+pQ7JAu/hjuxX0OxYVVz3T3058UKX53hRG28+LGurbs2lCxFBZWiYCADgZIRYDTax9RH4RMTAmg0xINcXZx6SuemCDt5cQAD5IYZhHXFWa+TeGnaOL0nxdLZKNcSe5G0IFPfmVjMdmxYS6LrrtPpChT6arRujKw7WKvYGdbhxG6if0OgohjFdyPWYWYWAcX46kW4PnP9v4GZfdjr/MCuZ4pcOYjbXa22c6MMuAhdfYg3QbmUF95zRP+6xuejSZ4pxC+fgtVCeDJ5wcL0zOkVmrm4VmJrXxWS+I+JkCmVYhmP8DdBV/oLqrkiuSrq9/es8Q/Z87Ph0BlfxOH1LbHtHMk1/Qs0Jo2eJ60dEjLUcaGUGQTBD8oYnBJvG64KVcitXww==", "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)(38350700005); DIR:OUT; SFP:1101; ", "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1", "X-MS-Exchange-AntiSpam-MessageData-0": "38q9msaBLPb8/PONnyMQ3iN0SwY9G2AmHKRX0gUtdk+BlQzDw4lJ+40AKe80yMXOGwnEklQP2gJ235Ai896CViHl62FAD/G8N+uo9Rhs6jCit1o0vPl1CBH31rrDWQ+Gs75x6vhA448bIXKfUl9XRQf6unKpNfF5JDe8G6fnEGZzJFA1ElG8hl9LdsDVu3GrUz/LRSdQZiq7k6sERCFDZHpB/4KR7ntwgm0SfYahVJ/RDdlrCSv0XIOlkBvQLd/Ud2YeY1q0i53gC+gzM7NlxlrZ9rsw8uiN/ECWExrOWkfhR3YvWODfH1BlTWAEHZy1ao/8gWcBX13PUaWJ9MaN4cAKkbVIiu7T34z7knjSyNUy0vWYlMK82BDuJCt5r0tVDum1CwrSBtOC7hKusAmBFkjstByxqg/hRxpJobGtn7/bZqSz/kcToRzJPRmNbZ+t0d7Nb6sGlxM/cioJrmRzkbq2EWkKSlS9LHn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rQNfEQAERvaZvWMYHqAUTnjDf/LDFf9eExhYkNq5ss18sVNKUlg==", "X-OriginatorOrg": "nxp.com", "X-MS-Exchange-CrossTenant-Network-Message-Id": "c134b2cc-5940-447e-49f4-08dc3c778894", "X-MS-Exchange-CrossTenant-AuthSource": "AM9PR04MB8147.eurprd04.prod.outlook.com", "X-MS-Exchange-CrossTenant-AuthAs": "Internal", "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "04 Mar 2024 18:18:47.1466\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": "l+UUrAsxeq0ZinMOB+jIjhDePpJDwrqYn/74Tk4dLDoD8qnOr79rFBXDXDP6F/RebbCsVyHgFWWHghQyl63mUkpDB4Q7rB0reRYN2SnOWxQ=", "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "AM8PR04MB7394", "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 src/libcamera/camera_manager.cpp | 51 +++++++++++++++++++++----\n 2 files changed, 48 insertions(+), 8 deletions(-)", "diff": "diff --git a/Documentation/environment_variables.rst b/Documentation/environment_variables.rst\nindex a9b230bc..f3a0d431 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 ordered list of pipelines to be used to match the media devices.\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/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp\nindex 355f3ada..9568801e 100644\n--- a/src/libcamera/camera_manager.cpp\n+++ b/src/libcamera/camera_manager.cpp\n@@ -109,14 +109,7 @@ void CameraManager::Private::createPipelineHandlers()\n \tconst std::vector<PipelineHandlerFactoryBase *> &factories =\n \t\tPipelineHandlerFactoryBase::factories();\n \n-\tfor (const PipelineHandlerFactoryBase *factory : factories) {\n-\t\tLOG(Camera, Debug)\n-\t\t\t<< \"Found registered pipeline handler '\"\n-\t\t\t<< factory->name() << \"'\";\n-\t\t/*\n-\t\t * Try each pipeline handler until it exhaust\n-\t\t * all pipelines it can provide.\n-\t\t */\n+\tauto pipeMatch = [&](const PipelineHandlerFactoryBase *factory) {\n \t\twhile (1) {\n \t\t\tstd::shared_ptr<PipelineHandler> pipe = factory->create(o);\n \t\t\tif (!pipe->match(enumerator_.get()))\n@@ -126,6 +119,48 @@ void CameraManager::Private::createPipelineHandlers()\n \t\t\t\t<< \"Pipeline handler \\\"\" << factory->name()\n \t\t\t\t<< \"\\\" matched\";\n \t\t}\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, devices matching is done in no specific order with each\n+\t * pipeline handler registered.\n+\t */\n+\tconst char *pipesLists =\n+\t\tutils::secure_getenv(\"LIBCAMERA_PIPELINES_MATCH_LIST\");\n+\tif (pipesLists) {\n+\t\tfor (const auto &pipeName : utils::split(pipesLists, \",\")) {\n+\t\t\tif (pipeName.empty())\n+\t\t\t\tcontinue;\n+\n+\t\t\tauto nameMatch = [pipeName](const PipelineHandlerFactoryBase *f) {\n+\t\t\t\treturn (f->name() == pipeName);\n+\t\t\t};\n+\n+\t\t\tauto iter = std::find_if(factories.begin(),\n+\t\t\t\t\t\t factories.end(),\n+\t\t\t\t\t\t nameMatch);\n+\n+\t\t\tif (iter != factories.end()) {\n+\t\t\t\tLOG(Camera, Debug)\n+\t\t\t\t\t<< \"Found pipeline handler from list '\"\n+\t\t\t\t\t<< (*iter)->name() << \"'\";\n+\t\t\t\tpipeMatch(*iter);\n+\t\t\t}\n+\t\t}\n+\t\treturn;\n+\t}\n+\n+\tfor (const PipelineHandlerFactoryBase *factory : factories) {\n+\t\tLOG(Camera, Debug)\n+\t\t\t<< \"Found registered pipeline handler '\"\n+\t\t\t<< factory->name() << \"'\";\n+\t\t/*\n+\t\t * Try each pipeline handler until it exhausts\n+\t\t * all pipelines it can provide.\n+\t\t */\n+\t\tpipeMatch(factory);\n \t}\n }\n \n", "prefixes": [ "v1", "1/1" ] }