From patchwork Thu Sep 8 18:48:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17342 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 E69C0C3272 for ; Thu, 8 Sep 2022 18:49:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 57B01620A8; Thu, 8 Sep 2022 20:49:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662958; bh=AKQ2hAJQStmjUXDSZ/ifkiZHUW95YGioMun7Elj+vtQ=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=uqXhKiP1fHcjixF3WppTOr1hw2p1/nubpN5NkIRjJMj1qGhuvWi5eCHt+aYxyg9Tz N2ly+ulYtTAXDg5n34Ph0uQ/yRJwQJmkBRLRZ6vEF7Ibmevu7tBfatY0QBFR1rXer6 ZH1Uc2WXUX4tGLlVym+ve8yuxILxUwI1aqqfCv5ow2KiPAY6O6vtfxEKy7+lLMc4Ey ku4lo8VokqWHd/pTfx1LVREKtzS50VTokAk46LRFEuBfZV11mprJttk95boAdyd6R5 KPdbaI3rZXQLPswiKaFlZPsHz8HqYoryyFyEhnAc/eB7lKkGDAJat897hlBn42UzrD qno+5m0eb2P8A== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60058.outbound.protection.outlook.com [40.107.6.58]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5423C6203B for ; Thu, 8 Sep 2022 20:49:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="IkmdYpB4"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WVIFIxMUiT0290vBzCEN13wZ07wXEr2rUoHbcn5YtsrJgg5Erzkw7pHL/8HT1ADOWpDjqSP/VEjJQUaMv/p6TnDlfPKFTAz4w7nTMmj0ANhZfNZv1cT191JNB8mGqCkDHDlu9VnrtjgCtpH0bp7nzXV1xuO2daMjv+gVMfRnWVNsYc5dnfXItVnyhAPU8rYaPsP5U/eM03j/TobqgiOCPC7yEv+iD+KW47y36tMyl0OWZDQR3cE9ZXamhoPj67wHbINAi5/T875icRz+1xVkYtAmN3R1lDTeBmp+kYNM1iv+/MeLjNWKOJwg3xbJw76R8gzKXfYEuBlAUYJ4Jip96A== 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=+5OQVr+F/viyNerCOsm3Z5nk0txaeCckn0hDMDOcx8c=; b=ogRfqSI3YL+SZFoe7u35aw+hZcb1fKlG6Iiz7fLFEX26kBJVaNsVxIyImAMndHvW/1PoT3cYOIEL1jIDv0Z6ZsfpJ/NEQZwVsL7SHymT2pN4gcO/hR6AYXO/5V56Raj1Vq8M7jZwB9uAgjxsymfueUIlu/6cwrgogW4GXOK23pAJCMb3Qhv/4J+w0cSsDXGTAX6GfoVux4WUz2tK5j8uXZr5vv2XrCa8fVK2XX4kyAixyDWXPxfDqwK0n4Mf2+FfvTzx2qzHmPj8f7ms5VAzlYsV066PkkyaCwt01EqiOun+qhGDLhWh3hk6K7zxyMyhDFDoInSJKGVnkpsvGhLfXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+5OQVr+F/viyNerCOsm3Z5nk0txaeCckn0hDMDOcx8c=; b=IkmdYpB4ErO5MHONQY5fBVIm3mL/IjLVrrHWpTlwh7AdTW7xVcN8flHP+tr04PAnuTQOV8+MKR288S1ZxlZC5mPwPiweF5PTOLk69rdsN3CgCHH5H5UfZ/CGviKQdlQAVQXFFkEdmXMpE3aiUSKP4t//3w9tAbFlwrXmDYQhcbw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AS8PR04MB8852.eurprd04.prod.outlook.com (2603:10a6:20b:42f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Thu, 8 Sep 2022 18:49:15 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::485:adba:7081:715a]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::485:adba:7081:715a%3]) with mapi id 15.20.5612.019; Thu, 8 Sep 2022 18:49:15 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:36 +0200 Message-Id: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 X-ClientProxiedBy: PR3P250CA0001.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:57::6) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8703:EE_|AS8PR04MB8852:EE_ X-MS-Office365-Filtering-Correlation-Id: c9e301df-7162-48dd-5050-08da91cad3c5 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: euCBBZwcz7bw0ZIe4S+blu4GZu/qEiNoekI8FFa/u6BEKI9Jd0U5QNfELJHf/dyowPJSsuwBBjEZZ167Ekj1eN/TUeMarJjUWcudFqlinsfEHECWpzJY76nluV9BF0CIxPbubLkA5ICGKzJY34sc4ca9KnGN5/MqAIA3/gWXAurL90JVJyUKjbFREc58mRrdyiZ7r/CxQ3c7dO+ylrJIjjb9ag+19QZHCY/IXy6Jr/TZAbEJMWP2y20VYJIqiz5NF73vYKUT3vSsl689yShkZS6277sDklIEM8it1qF9pjRnIAaRPq0goA/SjNwlPTJsMKi1y+IzolG74hjuSKWLb0d3GNRXJOwJSBaPz4DIR5yQMPDGwfTMn9xENayE0BtvzWZTQKG23frHTS+YbBRDfpFIpDCcYFJL3SD/+rQq/7rL3piE5GgU2EPt/lrwd8D3zlErk75nb2Qyl+NANvzi/wlSJZEq98le9VbGgRU+4UE+NgJKC4TUm/SRlY2ylKqq+dA8rAHGhoZHHQGhWWNbUT7XaYzUNUnbcyyJyPJNCKNAPSAj2FO94fR/ohJEr8IyGdrGIUg4/yXjQDaERLemHGv+27dTcayMDRw4AiT3AntNQSZXMf6m80Szr39fJLjXblRzH4oqzBD7F8P6tSTXec9skbMbS5YUXv2ouj9SmX+zE/QwuSmjppY3sKy3wM8GLliVkT95uk7oE792+2u39e+Cwyv5XEL/jmtJeLVaP3c4MTjYwtmLKjxxiOcoH5DQ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8703.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(346002)(376002)(396003)(136003)(366004)(38100700002)(66556008)(66476007)(66946007)(8936002)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(966005)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(83380400001)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n+zX94vb/SKHNz05nJ5XdoCQAdk+4PfU/mz4CVEN9vzTtLnr8PUGk6+K3f+hDa1MO0H9N2eFLfDZ4O5tl0Nu1WgqGXoOtVpbcuk5B77p58B3Sz+ukTqQhpvs5ZYTt+Er/QyAxrD2wzqe+7TnsDK72ZXHwMe0Jn79Mbt+WfoEIY2fCgteDg35XOE3TcE6+6OTC1hgWpgoCEyISH3FJUYxuPX3W6cNUjo/a+93iFqMlJP4n8PgOsiFPlW3ZCbJYuSeeZ+fj+wrzIIhnuEFROX8RrIPm3vRDsm8BBXSTslAFWKT+NeJcW51P8eEGhKnqt0plwU+aRKZYz9ln4ZYC8+ifPwWzmAnGX09gdbo6hS0iC4zY2/7gSvg99BtqWno4xzHg/9HV1221WtTgMUkfHRuf2pSdr0wgAcgDJJpkiBGE2h7pKHQcV6MhpW/22DkQ4BFnArk2Bb+Sy4lrDNYNFpzpjOqpC3j01AT6uTIOz8tSoHN+Odaj4Ow66Nv8/6ri0Jnki34Aa4ZFm+PAt+EMfmbYzsap3/2g+0R0RAjSHwM3FdVZkJvB4yWPZJxYmi5Bs1XQnBZxkvtoeQ+TIMAYvjBv2bXTMk/2QFyojPC91s4rYTxGVj3RJbqce+jBg3Iiz8xotjHg8dCrGOLQGhe7H/Uol01S/3PpBcE5M2L+SbUEKNLzP8PO2s3N/7qj/n+P7O3q11jQQjdiXxVE5ilHsJfXc+hHCKi54qgNXZX6Ae5etFQUUJLZfLvtamb4OE6ZDdE3ppZ6ztORP/ZXfNII5mIpdMbzBzGfpVn4PwhWHatyxr+OR4r98EEexDCuxqLT18/c+D1KulJDLALjfs84iQMQLXaqNL2wfhXJTPvhct/1UnxUwAp/nZAV/QuJQzsWcZKn+ep04lqeDjAt+dmikbulNThttrMPcAI0NINeqcl2hDuEp8WndMJuAvhFUnlwe9NnWLhkFp9PcKLGjn5vvkKm+nAvzOiCqoufAMEupgEtXiE7xQsf4ydihprVQ7r/zI4mz7jx6CCTBl7lJ4TUT7uvU5G4bxZznW84MSI0Dp8QIbj2X2svN1onYdfQ39SAKkF4TRqyFP1/+9jl/T6POQupt2YKMcnijVliq9YcaLCfglMz4Ohuk84dzY9hlzxS7bfOPWk3dFHfUck6ElSGDpZm1HgIO3NHyjKEyy1yaZAd5OZKpLmpzJS1P04aCBVCBpHjVs+cD/gLdWs/QAkLwiAlt1cImPCRrCc/lUd7/uE2FnyBKszIND68K8AnzMiiLE53w9xe4qD4+Y3aUmQL8XgErxAwwDw1ozBzDbi1aYD6B5qas+C/i1iUMKoo0+c1o3Ar7IKZvp8kVKICepYsB01oZeZW3HUjr/eYL1mmI45WiL/FAKuWSgZCQ5JVvuO2sf7DbBciox5jqc2Qmlx0IhuzPMeViC06MoGPMP3Fmhjw8VYmT7emxmR9K7in2aFtXACtqEtHhPU+g93qMCvIGqJZEK4d9lbOusItClG36FaaReQQXrb5qWHj2vuY8nF62/7ni8d53sCFTEcm6fRvUdts3wkfIECZHvm+AEO2O2KSdJLT8cfFc/YSR7nVNA28fEBiClQnqYW0LO2DrKM5JCJRf30gUyRU9+W6tk95YuH4JhSChkPe0WIJtomqJFvz7w8u1K6SlWWcwSYhLwNoHqUbQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9e301df-7162-48dd-5050-08da91cad3c5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 18:49:15.1659 (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: WbON0auM20RjHIhFsLn8j6Wtm0xYHl+OupD+UALYVoegLTqb15TRRIqTojUiFgkNnCp74hCWB01psJc9DhPamg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 00/14] Add dw100 dewarper support to simple/rkisp1 pipeline 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: Xavier Roumegue via libcamera-devel From: Xavier Roumegue Reply-To: Xavier Roumegue Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello, This patch set adds support for i.MX8MP DW100 dewarper in simple/rkisp1 pipeline handler. The dw100 can be used as generic size and format converter, and/or as dewarper engine in case a configuration file with vertices mappings is exposed to the pipeline through an environment variable. An abstract base class converter interface is created based on the existing converter implementation in the simple pipeline handler. The v4l2 m2m converter implementation found in simple pipeline is derived from this base class and can be used in any pipelines. The application can load a configuration file to apply any runtime settings on derived class implementing those methods. The dw100 converter is derived from this v4l2 m2m converter class offering the capability to load and apply vertices remapping on its incoming streams. An example script to generate dw100 remapping configuration file can be found on NXPmicro github site [1]. For example, to generate mappings file applying a hflip/vflip transformations on streams: ./bin/generate-dw100-map-blob.py \ --hflip \ --vflip \ --sourceResolution 1920 1080 \ --destinationResolution 1920 1080 \ --yaml \ --outputFile map-dw100 ./bin/generate-dw100-map-blob.py \ --hflip \ --vflip \ --sourceResolution 640 480 \ --destinationResolution 640 480 \ --yaml \ --outputFile map-dw100 bin/create-all-dw100-mapping-yaml.py \ map-dw100-1920x1080_1920x1080.yaml \ map-dw100-640x480_640x480.yaml \ --outputFile map-dw100 A map-dw100.yaml configuration file is created with those previous mappings. This configuration file can be instructed to be loaded by the pipeline thanks to the environment variables below. export LIBCAMERA_RKISP1_CONVERTER_FILE=map-dw100.yaml export LIBCAMERA_SIMPLE_CONVERTER_FILE=map-dw100.yaml I tested this patch set on i.MX8MP on both pipelines. As i.MXP8MP supports only one path (main path only, no self path), dual path configuration with active converters on both streams in rkisp1 pipeline has not been tested. Regards, Xavier [1] - https://github.com/NXPmicro/vtec-cv/tree/main/bin Xavier Roumegue (14): libcamera: v4l2_device: Add support for V4L2_CTRL_TYPE_U32 libcamera: v4l2_device: Overload open() to duplicate File descriptor libcamera: v4l2_videodevice: Move FD duplication in V4L2Device::Open libcamera: Declare generic size and format converter interface libcamera: converter: Add queueBuffer() helper libcamera: converter: Add v4l2 m2m converter implementation include: linux: Update headers for dw100/dynamic array support libcamera: yaml_parser: Increase sentinel to 100k libcamera: converter: Introduce dw100 converter libcamera: pipeline: simple: converter: Use generic converter interface libcamera: pipeline: simple: Add dw100 converter to mxc-isi configuration libcamera: pipeline: simple: Load a converter configuration file (if any) libcamera: pipeline: rkisp1: Factorize errors handling path on start() libcamera: pipeline: rkisp1: Add converter support include/libcamera/internal/converter.h | 107 +++++ include/libcamera/internal/converter_dw100.h | 25 ++ .../libcamera/internal/converter_v4l2_m2m.h | 88 +++-- include/libcamera/internal/meson.build | 3 + include/libcamera/internal/v4l2_device.h | 2 + include/linux/dw100.h | 14 + include/linux/v4l2-controls.h | 6 + include/linux/videodev2.h | 2 + src/libcamera/converter.cpp | 102 +++++ src/libcamera/converter_dw100.cpp | 32 ++ .../converter.cpp => converter_v4l2_m2m.cpp} | 205 +++++++--- src/libcamera/meson.build | 3 + src/libcamera/pipeline/rkisp1/rkisp1.cpp | 171 ++++---- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 374 +++++++++++++++++- src/libcamera/pipeline/rkisp1/rkisp1_path.h | 54 ++- src/libcamera/pipeline/simple/meson.build | 1 - src/libcamera/pipeline/simple/simple.cpp | 16 +- src/libcamera/v4l2_device.cpp | 35 ++ src/libcamera/v4l2_videodevice.cpp | 12 +- src/libcamera/yaml_parser.cpp | 4 +- 20 files changed, 1060 insertions(+), 196 deletions(-) create mode 100644 include/libcamera/internal/converter.h create mode 100644 include/libcamera/internal/converter_dw100.h rename src/libcamera/pipeline/simple/converter.h => include/libcamera/internal/converter_v4l2_m2m.h (64%) create mode 100644 include/linux/dw100.h create mode 100644 src/libcamera/converter.cpp create mode 100644 src/libcamera/converter_dw100.cpp rename src/libcamera/{pipeline/simple/converter.cpp => converter_v4l2_m2m.cpp} (59%)