From patchwork Thu Sep 8 18:48:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17343 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 36976C3272 for ; Thu, 8 Sep 2022 18:49:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C9BEA620BF; Thu, 8 Sep 2022 20:49:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662961; bh=GjZG7Zr4RAvQ2vrBxqdRvCzU74VAXmJcSDAaU66lHHQ=; 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=SaUM0e8Bi1zwtwjvcqIst6ECmotrlCQGK8R4sowwAY13pYlswcuTPsNxEhqT+ISTG QRxlwUVuXoSnGvAyIZ0sLNTOqubFc9SpH7MbC39FjGpugGh2JMDmxp5CN0+NNN/OWI MQBp52bCJpKcAUfiqlR48RRe6gCoinZ6rCtaItBuLDeAcFdrDieEM4OBQOJ61XdMIp +9lmLDK8BvYaWUgEXC3oOO4pWzESfPWcAdOY7il1yn7TnEaF16P6r5POHjUzemRV65 OUYOoVBjcJI6jmV9kpC079CiqumFJds6L5tv4rFWW/Zic5Vlikx3oggqF6YS3UTNFI CT6dfZ1itqHdA== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60044.outbound.protection.outlook.com [40.107.6.44]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E6419620AD for ; Thu, 8 Sep 2022 20:49:18 +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="I9Yq0McC"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BRF2KUGhR8z4BG1UY+LI/vDHa9vk8j0uoVhs/GTO8LL5YeKv6bjlVdTR9/Or+a7tIeOceI0bfCS/Nf9WjVOFuSFpjWy8Y31Qj9EDwSk+hFuWNy/HbPC9GPojEnE7yjE9if+pGcNFpvrJONf692cAqaxo4qhKwt0OpLeODZY6fSx06XuR6fQmicG9PxqnnC7Wk6P1EO1r5hNnSV4pA495FVlY19FIuEolp0OV9mBtBzLdHE5HhKIjsS+BIqlWnY0SNcurbiY5Wyec4QLIlCUzhjv6JvRBX6cUQYJY3cde6KBB7/wToSe2A2qQ27sNZihG8sTu6hQiGh8D8lxTy8TBUw== 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=1ZXsCP8HwHye/Qq3B5OZdfFxT5MuYodaX7KX0EaNGe4=; b=G1C8K88sTQvgT1l8WvZf5Ikkv0ncht1Vsg5ofIwsMTMH5k8dJdV4umg1Df0LFoaZxhzUCFcLTAA9FEhpvUqI/lLxnWbJqkovk89jZU8FU6tdeRHQs2mMoWZATesKT2xfUJEEPkaMmMsjcmmWe/HFcQ4bQ2alx9ErVDQN/jABrLX8JSjFx2ftvQ4C4XrA7dJ1i3ubVHtxyh2dTabDYq11zzq1aiaDKD6VBoxz0kUL8I99wJt99mPdMkjpOLnnp/tYT4EWb0n1O+D/+2UACLL6CQP04JnNvbm79TbiFJ+8yopBPRZJOnXSNaJYApcDcnDQfbvV/t3GKC+wu02QjT3Gsg== 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=1ZXsCP8HwHye/Qq3B5OZdfFxT5MuYodaX7KX0EaNGe4=; b=I9Yq0McCycSzy5p+KIka9MlKQOLyxckIM8Mdx9mnPBvrn7TWL3atLNBNYeLe1kIYerSYt7lTc4S5sD4rqZnKEDQshZAZmcsHvo6e5lvMHgut+0OUW7n4DNJUdbo+Fo3WUDO7UgLxAL6OPgfILl1ibXe+Ea9obyirQDYTxafvLNI= 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:17 +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:17 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:37 +0200 Message-Id: <20220908184850.1874303-2-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: 9a8ca04c-6f38-4893-163c-08da91cad532 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: YgKZp4X+sePyIfEdN8e6fWWENkSJLR+OVJTRBYHIA6BRNi+B7Xrz5oTQI+JIflcXIpO5kdfFLoWrDg0mw60/HX+OAM0mGAyVhLh68SCWgSBTy5ODZ7ItLYPxH9pnXDESDWTqgkh6Otv4NqMbxjZNFh475w+g9C+ktpOacjc6Sj7lQrJGwyhbqB88EICjmDBJ874muP9jqP8+UFKR0F5Vt6QxZ8jchgaTSYnBudr8i0Wl/xFkFxt0GYXcZGYWRfuZ7Mm2jhh96BiPtxfSXrH+8jy4qgIJK/C0obEIVHlgd2sQfFC5PFDiFOPIzKaPbJBdiNpoueum4r7eCuBVVdIm7TAuz2MJ0vaNBEZfwM7oKS3amNRDWX6zRSBP+gyIeUcEbvAmU+fPjl4NvzQVW3Y1UfAyTzOfbEZoQnL/C1aj3IUY8n+8dm4YDZnBbBJj5dKhqGUCA3QGE1OHKpR6kXD5Jrb2uPgXXQMliiOpWrYKqHc99Ku9wU73chq893bi4i312GIo1FwWPMMqbFtYTktWUUfaxdG/wecAklBFn01cAjx1UpBabkypOlx+4lp1kje6Naimg78m0CRaqswLK4btpJq5/yu5GdDRCwsOiNctf0g94iDbhsOBL6FOuD3i25K/PkIIojpTIMKsISWYoe/pcMEhvHmwgaIGeR7DFPViBEeXrAoau8rowyma0l5to5Io9XC927+kkou4wfFCstTH/w== 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)(4744005)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6+rkVPfdt016oE5dM3lUZN+wrFSw6/pC3jXl3oDJr6Jbm/24KtaY5YQkeK74UsjKuHSsvK5vxlWKpAg0VBtnudd17oGxWas0/WagU8AGaJQgkL8RZuZukg6ODVv4JjFIgaj+k06uxDDE7nWBW+XkzxZCsGCJXnUA5DKdIHqvp9NjmuMNH/Afu9Jo0b2J0Ptiq1kyB7DfOCFmrEZGZw5qh8GLY/D+eMFW8jlS3NJUR5kx01vZOr7F7942Xw1u3lVtcGje7u4RTQGa05X6RO7x4PFu1v7OHs1dc/L7tDqmDkz5Zd41AbBsXNCfb4yNmJMNUpeD6KF2kbczQK7CfGXxM908CH0k8z/diJiwmNTY3L7+wfxvCq6tMVt+Lmx7p41vx4GA1WNUX0UCL56bD2BH5Oq+hZJJRiDFhXl/gH7IYjuBaeOGg1ZxxBWtsFCv/RHxpVgcg/Bf77HY+IQVcrhK8rrNGnNRo/WVjgvl3rq9awzLmMePNTKYOBtR8K9LnY3RSuFxQKUleJsdyhKoIRgwxAowYVKh6SCL/cUw4KE8aGhwwrFN8JXD6FBaA/zGzlhdHI+9YPBjXDuNAeVN4L9g7+euXxl3DGRI7d/CazlahyDMRI7QpYj0AIv/+evGG+KRoi0HSWa/VlCXZ1m9zGfeMQf2qAiWZ3FPFbB+uocpTd1dQuTu4+SRRZEO4uLVx0OKrHK4OOodLxOeIpaoaOiIeGbIFc9YyFSsqr2Kbk4c8eAUjHpm5jU4uyFSUzi7hFrdG16rGvu1ohyXJb1dKfIg18s/mh1R8JeYBs12Gyi4l7ZsztXFhIBQF1CnRkv6iXUfDZMUSd4Vf6WDDSRXrUiQzSCEHA2pY9FP+Pgp9bNhHzyyzubE7HoGNx6Xnm/Fj4ZtiPJTsdymOudwJvZlhFnbIWQaqMqzMqihUxfsLl6E3cqKPT+ERMhuMggzs8C+bO3y6urEz9wG0mwrlPrAQLI/T3JXKO2V4IQgAur7bhFzqNL8b25KOBpFAnFL+Vcd1sZ1Ojn4jHs3g7whAsyCpYboC1kwfyCDasyGub9EFj/V+m0lq7nca82Wx2ZOeeTsMbj0a8Mdvfjfl/fizQ0ZooEhbWY8fs3hcShMT4qlxYMQCrkswxSS2qFAfyGRPORETW3ebZo56kwG1BdMuc/RzexQBXzI49m84bfKy51o3FokKMW7MlG0skRNPxK3MtFm3MSGtyFnvMLYDZmKDVjXt/w/BSyI7unUtznfpqX4WoBZs99CNaXLNVLvFz5IrIMChX8/rhnuNy/SN5rJM/XLRYUkZFkmZjCSjXvqTFh/JtiIsHR/gaTWbgig5sWuuvMlPdTb1zhep8aUwcwhrp65g3G0L0J4G2XaSi1bbPdSH3BNZ4u8VafDSjVzRTrNZ6A0sUOWVv5aTKZUQ/vWrxofI9YgaE0xX/5aLE6DW7RiyiRkSBnt0qu1+g0x2wCMgX1WDUJNEj0YucfQv0DNF+gJPPsErX3yqv+XudBoVOU/iJPbwWK04EMXoHE71Spp4SGbOo2FWaOmSKNBPnQ1B3DanyMeCW3Ly3bxoLe0B3qhlilPGFzW5bSs5VsHm/7H2ptVoyjfjFjvLZo/wOy9xUUvbRv94d7SZFhs6227Cs69B7JeZ/0QzrYo90JstojMFwmjtqKM1PqpjAi4FQRPkuk4x4BPAQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a8ca04c-6f38-4893-163c-08da91cad532 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:17.5565 (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: +lYZYaLuXEokabM21DI83raRWqdJFvOIQVPPqeug56vJLPmUbOdtOk3e6p91W+eoKronNRgsTqGrAkUk7kUMOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 01/14] libcamera: v4l2_device: Add support for V4L2_CTRL_TYPE_U32 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" Signed-off-by: Xavier Roumegue --- src/libcamera/v4l2_device.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 83901763..756188ea 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -488,6 +488,7 @@ ControlType V4L2Device::v4l2CtrlType(uint32_t ctrlType) return ControlTypeBool; case V4L2_CTRL_TYPE_INTEGER: + case V4L2_CTRL_TYPE_U32: return ControlTypeInteger32; case V4L2_CTRL_TYPE_INTEGER64: @@ -613,6 +614,7 @@ void V4L2Device::listControls() case V4L2_CTRL_TYPE_BITMASK: case V4L2_CTRL_TYPE_INTEGER_MENU: case V4L2_CTRL_TYPE_U8: + case V4L2_CTRL_TYPE_U32: break; /* \todo Support other control types. */ default: From patchwork Thu Sep 8 18:48:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17344 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 9619FC3272 for ; Thu, 8 Sep 2022 18:49:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C122A620C4; Thu, 8 Sep 2022 20:49:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662962; bh=3x7KzvX7XDJbMgRoaGYt3ecsjkSrqldEa1pjj/q9nHM=; 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=daUa//m7PhHhvG0G89VzWlnhKESXcVBlbICtJgPM97Ub85H3HbUpfq/gn8lqchsn4 c4wyVzzYk+8xLlmVPhEJBVbYYXty+Xg+LdZKGx+o5Cor6cmvbjdgGLprahq33jfWyV fKR+bV+7MBbrKOPsv+OCcv92eZa0H4i2WXcRwfIk7w6oPDYc4WdU9qeB7G6jreVQOa 9mv6ISLl5T+qtWNszUMRLt0ytCHxRPQqxXcGHlNZ5yxj4EQLp8Yizd5OCHRvFAELB0 C0dlq0NbeSGDZKeK51P0SZJ274wM044m5ybf3cQu0b/FRxaSgqkmTGz/UEm0dxKyFi itYJdazGGxKyA== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60044.outbound.protection.outlook.com [40.107.6.44]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 14F65620AE for ; Thu, 8 Sep 2022 20:49:19 +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="iCGAM2pU"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nND6tEUmnD2j7uScxLMvyES78GZLjdl/V4krF3xKGblBaJPukUc9hxohNlMfDAQQ7osvXTy/ZuF0QbPElodt5Dt2SJHZBJ7jPtHUAj3hVqw91nlckjrFPQADiHkKBprg24xTjwGKDq3RjFVamJwLpb9efxkCMr5TpiuzSzGqN0B7nOROf9iKqH8PT2PH1JArmiSibuDtgJusrejnlQFL6NSnAAM2UkSCp0TAkuqoANuUBGkTpDfydbrQBemAXZZ97jNQAnJo5kMbirHW9gHBSvNTa3Fl+OFp1zkB0WRM2t5VTwTCB3NuLa72kVGPTLJH2fohE2mIwoU5zcqjBQ/FTw== 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=GzuJLk+Y+tr0Y/Xb2ZGRc42XgILlqpSH7wv3nhAFr7U=; b=e5pIz0V+SpATz/lZUk7m1+FmAZGJWGXxIDnOA3gQjDRTtA1zUMdfmL4BkBVkSh6pp+3+om8Utkmdr7Bmr/+mwSCrOJSxahwt+/jDugppbypFIQ+xIagd1jppvV4/RSTLuyGuQb/u99uzyJ3LS/915KatxjRF36KVWB4E08pReNokTT6thmGoH2bsyrGtUCYS/33oA+bEVaRQ7ZNnvzOJBOho0M2HF5nj3otTj7mgCMb7OEZfP3vLz6LAs21iG6dmHoQTPS8Buff1ksaTH9It4TFVUfmdrhOwL/HnMTNCYgxIzQYRZAfBfPpI1dWpC4olGZjV/0YjRl8fEkGq6CwfYA== 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=GzuJLk+Y+tr0Y/Xb2ZGRc42XgILlqpSH7wv3nhAFr7U=; b=iCGAM2pUqTtSLt1QMRJTzPi4Ta7PQ3wotxn17+n+n51XX88OlWPfZPmSueiI/eD/FdsujUZ4xmgRgqDKeqW3O9+2FSkCpz7RB/RoJGquk+WeAES34mGZ9VeGkFfJYV/5799xWcc/upKHmLLVZ+ukr7OhIFtbXvxW4VspDonueyU= 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:17 +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:17 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:38 +0200 Message-Id: <20220908184850.1874303-3-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: 8b968efe-8abb-4a55-2f99-08da91cad57c 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: aiyl9Z95u9uOHvdckUk0QUnqN4f8ghc3Zk1FjGzuOsuZN/FEVViPlBig/+ULBIWoPHMfprAeHjxzxOSU3TmOq4RV8cbHRvNDYp0/H0wlz6inlmdJHekQIxK0oNnM8ySZfqAt/9y805QXSZG71C70f9fjbIYv7DqqnFZRsFwDj85sQFJRdvvG1z/xHiyjfWdlhaRRzFM4KmWPII6i6eQEVtE/3zT9/VRaKEGVTf7UVk5NJHbFGzEG+3xIqhp7pDlBh/aa6/RxLrYn2pAjgDi0kZ2+sOQNCaLJXh3tiNviKVI3A+R3c7CGYeI47CZBeFCP3EeUQn9dI7RknoYWPwofnMOSEGMMCTN2Vv9zBOfsBN+uKH3ZrGdTg7bJ4KnNZMRfVDm+EuX1iHNNda2+dVkOq4Dy1kg/EF/p1Lu6XtZS/OfsByitzhzUj+ZG5UhbhqToDaHC32UiIdbI0jjRDqppG/A2QV6gQSXPo8VgXC/V7V7921AvOachS1uM3LhyLL48dmpxRnMtvE/f0dmF1+eZ8+x6/a0yCYLTwsZ/stcwYWbNa2TJKPILDkrUuln4Ctmya6iUCo1/ggjBzEv1yCZluhWoen1ZE4pvMe/di4mPE2RZMgjW4vMD8g6dzZMuNKOOxyJLj8eK0BMt1FIim0RsLUruo6Tk7LwIq9vbuo0ej0CP28N2ogGwZT9eFQQnU6Y841mIiuCPtlrkjUSY0p0GoQ== 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)(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: h1SnFAzWjxd0EhqKaE6Kqk2b8h1TNzPeQOwqoKJRm1GuBu6JYO4MLm2lxWcqNzfK5fe6H2biJHpIPqABxA5oVvOCmoQKGpAuz2fo7eI/INrluM+1WArAjQ2tWoWKW/6LYOP/RX2EBLrDVgHTvnUSv/Gh+ZWcOGdnsUxY26D6NLx0UA42qZpTIDcfG+odcHaWFsZ4AL2TGMybRW04yrd7/O9gmECVi5VdMqpAgCXeMdIp+YmMAcLSxDdfOG15GV1mrBrCtvOvW3QRnerI+pLnhYimUVlbK1xVE9dmvJPgIhKt2fn5GbyQDnp4XkgVqa3RP+W7dctVojnPDCp3YwEqkSvuUG1AndovTVUDif8YmJVouBd7LJ+iwD7xy2Mg62YqFpAiH2QQsQvs+yuO66MfhZC6VW8sWYN0B+VRNqe9h4RFHQNzw4NChdAfkW8TlZSS9ubnhXwQl4ZUL47eLN2oOC8eMOuBdskzvSkSmyIOoq2oQbi+vYCLYzqMc7ZudhZQKWpLvgFZVgT6rt+El/vpCRxQBfutfMKsJhBk9cCU3m7oyB9dLFyWL+pi1BPd1UKfYLP7jAkiLTR5UzL37YNz/QkCDfi3qTZXSarIrHCXXXzhaZHaoXmpMFkSEn7aHOBNGLSSeTeGJ+zU6ChtEdTATt9tZEJT8dkAiaj7oCOSGxbRfIYBytrmAkJwuRfXvInxCQtQLY1Clj3vZwzNWaNMah42HtaAw8ZoB2HZLv3DKVToqVNTXrDwFywX/aGick3g2CR9R1YcBEItg9KXVx2gjokAI++4ODdBTiBrVU0+spyXJ9/4By/W0rp2synE9182iyCh/RV2EEECUEnVZbOL1nV+mK9CKhZOhdrn++ttWvRwg+srPuvMghGImKAdr51IEyUniVZnQ4lFrDPVfA9aVbVks5ETfn7uxB8DFBWuLxJDHsCMNBoVz45RXze15KZLEeRcRTxJXj4sUuYk1cnjPmUwVEu1MMkEVK/dL57sBMWZ9UMOyJ9ZRC9Sq/iGDhcPeLShS89iJF8bmB/coGk6nZgGnDzs7yacLnLWps9h01V711l5wQI8eFz2Q+NmrrZJC6SNfp6o+kIzzljL1bvlTm2SuTBmr70xRxU3iTmguRcIsS9rp8j+BIKYn0dtBwzoS3Z7AfIxNbN1vbV4BTrQ7xAl52WOTJWLvzypZhIFnXKCh2aJ6IjlgWhQxNPRvnJjqPyUZbdXnpOi4fT3ZgPVxZcWMJM2KiQUIlqWOv5AT4JDeF05Wn9ToR1VTZGckOEBMydtxd4sXVHB9utEKg2g4pjyKcKqgnv2NbEQlqRQVLvnSTjTA6/ZneuIUBxab6Fac2lYecoAk7XPj8SYn3RH5Yj5/V2rPIBqhTaJyOhsTO2qO9Xd6nhdSkPEY66Df9xA18RBPaggj3jOwJ4NFMo1bWTtqtfIq0sCpGSrjjTC8RplrutamWKfBk+2W7i25LxdKQ6yXsNv0rl91GGr+nEuZLyq3GxT4qR12DLElo3DzhvdjZqqS19KtqnRwwcIseRZGxlpZ/mX6mvLBJdaGRM3YaLL2kgYRf3eQkOmEhUvjGlZ0wZ6aGCMbfoFCD/n4OCHQ2f1GuevuQ6WsAyp14qfAk8w273iFJ0GIsGd5dCDn/BnQZAcYmmE9iTOspYfnKImrHoULzBabGgdtVcd1XJ34g== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b968efe-8abb-4a55-2f99-08da91cad57c 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:17.8390 (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: o7sXf0/ovFHVtl1GLDZh7MmvQarPkWW10UejTBKQdBFO+kpRhALHuf6XLSRRiLeyCT++h0LJJzWyOj2JhRCUEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 02/14] libcamera: v4l2_device: Overload open() to duplicate File descriptor 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" Signed-off-by: Xavier Roumegue Reviewed-by: Jacopo Mondi --- include/libcamera/internal/v4l2_device.h | 2 ++ src/libcamera/v4l2_device.cpp | 33 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h index 75304be1..8b759311 100644 --- a/include/libcamera/internal/v4l2_device.h +++ b/include/libcamera/internal/v4l2_device.h @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -54,6 +55,7 @@ protected: ~V4L2Device(); int open(unsigned int flags); + int open(SharedFD handle); int setFd(UniqueFD fd); int ioctl(unsigned long request, void *argp); diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 756188ea..67847bb0 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -102,6 +102,39 @@ int V4L2Device::open(unsigned int flags) return 0; } +/** + * \brief Open a V4L2 device node + * \param[in] Shared File descriptor Handle + * + * Duplicate a shared file descriptor handle and use it for further device + * syscalls + * + * \return 0 on success or a negative error code otherwise + */ +int V4L2Device::open(SharedFD handle) +{ + int ret; + + UniqueFD newFd = handle.dup(); + if (!newFd.isValid()) { + ret = -errno; + LOG(V4L2, Error) << "Failed to duplicate file handle: " + << strerror(-ret); + return ret; + } + + ret = setFd(std::move(newFd)); + if (ret < 0) { + LOG(V4L2, Error) << "Failed to set file handle: " + << strerror(-ret); + return ret; + } + + listControls(); + + return 0; +} + /** * \brief Set the file descriptor of a V4L2 device * \param[in] fd The file descriptor handle From patchwork Thu Sep 8 18:48:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17345 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 AA1D8C327D for ; Thu, 8 Sep 2022 18:49:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 55483620BE; Thu, 8 Sep 2022 20:49:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662963; bh=zgZH8Ud1QBu1xD7M2DCpYNGntybT46spNyErOHPDvlQ=; 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=4epVjx4GfijiHhDxvYmxWWcwa+QaCjHmeWJqMbzKXJqxk0aGHE/PEELlLZtdJFXiv 6r6m4ttkrOpq9pl1rC4p4lKT/Ij2VAi0X7RSmO7xgU78zWIOSlJbO+rER1VUqJzwUk hclks68UhSAUatUfHmhC4NlC5VXL6treGlSmqS3D1RLX4Fw6bTepqmiKat1OKAmC8d nPCDlFAKhDTdR24kMp9KMFRlF6Uzhm+qega1GBWuCGnID7BmEL+b9EP57jMjaZLh2H EtI9ffIFZimljOGdhirzns/muT8ww4Xo8llg1uL5p5wNdBeUdK14aQW2kWJQ92ZtQa H/Jr9JlA292iA== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60044.outbound.protection.outlook.com [40.107.6.44]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 37AE66203B for ; Thu, 8 Sep 2022 20:49:19 +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="EzRYpuwm"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KV6/IsxpiCXc1mQvDx/FVhSLCTT2h1OPN3X63cveZ8tmVNC86gMJlGJA7/BnJXqVhRfj5/AKWkO4o92wACLApZ1YSoJrErnxbLHxWWm9U3IsmGkKxeCR4yTc9TthyhBAwrunYl1Z8qo/nLxslyq7YdxO9ZrvrlBdWI0RfuAh41ooUv63iOQE+EeBbV1Gnu0qerVCTN/qrNkUDEROs1KN3bqjXgtdW4wDcb2elJAzKJXD4xCFBSjr8Y8bC045U7/0TtAZplPOcAUSqE4mi5jXDF3TW1qTPGaGqsu1MrcoUIK08cavLi3m2EKjUNli04ywQm721QoMg65J8dYb2q+KoQ== 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=L5g+ekA+WISt0BkRLuugcQsCZXYoZGWDZs0QaQsUWxQ=; b=L0mPI5DFB/78IEWpJZp4P+F9h2Fgo1J7cYMS83BOrwSC5EgfuU8P0WhB9uQ8AhntEs89eIymfvh6RtOnbeBq0O6obd3hq/io/9naTj3QCY0Rz7XKjq9+7Ps2cHzAAEavyq4zxyeSqhCa5a5LSOs0Dzc6cU09elk0brIzzzZH2ePmOR8AONqm8C1b1UsxAfGoP04lK/gOKOami3iEIGpCaAPkHMSxSwLnfAq1r6DKC4MRRAUs8VdqEBHxsABjc1nXhNcTWhD0eVlZUFM50dOIpGK/L+xi0ATE508DW2f6PjmDJl4xQSeJXp9uA+rfK88+JjckJJ9Z3YU7Dy5JMgDACQ== 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=L5g+ekA+WISt0BkRLuugcQsCZXYoZGWDZs0QaQsUWxQ=; b=EzRYpuwmbeUt1KsPxlkReeV7I14TiynlfWrTAlpTWZqs2pyBTMphmErEjlQY5l+v0qdXY4V3ZiTzipRw8+ZFsNCkCW3DkV/yvz1xGvVwJtdv6bHj47Fv2mNrzenGmS9FREAWv78gfoT9I6/MwyT5X1op/TCHEs82LDyc2ZEYPts= 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:18 +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:18 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:39 +0200 Message-Id: <20220908184850.1874303-4-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: e323ea3b-f179-430d-3e58-08da91cad5ae 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: 0+SQFajJMjHwCcx6HIKkrOzCqa79jEaqe8MZgsbkum4+XGu6m9M+jAC6Vd5QjPtOt6KK6cMnqNWlrMd7GligJ6QqMGjC7WOsYn2Ai+NXI3ysSiuxMIHp8GDIbYCSqVJrU7r8UQXvbF4uPKsQJedc9snvmjoIxNQaPKB/wbk0fEdW5G6BaSodVGX4yTkRqF5Rq3XQeFzAfFzCrkQKGY4IJuNC/GA7SkECxWI3fA48ub9IPgwOUKr4aTj+tBhlaHm80G7uz2NIbln2hy0JiQmiGCvapB7QEEIS/0WsIS/3ImzxQj5RTMfEBRnYZqDlt0TZp1lXeOvRZFRjolpOS47Lyzqn7viWLWs48Zsis4bk/g/xN0V2J0qGyBMjk2SU7zXAJvxQmoVpDpgJKTOvwxFrWZn48nGRe5XIVN1wW5+OxqFXnViVv1kg/G9y7JtOpM21DBgMmv2/Fpvdgz3hyAirOTspa4XOxQhuSkwaqcRgV+l5O+xm1GVvJhSNWkZwsgBMD74tD1XHzdp0iLDbf9jM2DPb7KYarHo3Vzs+8/igHms5hBBW8ALyKnFMKxKl9K4gznAFnIlqhns6For0TnLoywnYwlDEt8Gidcaw/3Rm6AKvusalPpAInYYMwDEvglkCwYrihj6mv4wR1GSICIQ6dzlurS3EOE8csn79/WkqNNtqq9pmliATXhCyN8K+tkIhZEe29GU9jheiZCM+X+lN1Q== 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)(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: HxlB8WC/NgGKbgjYTrCzVF2z5x1z5PiqgJyKiiHOzrLdKDmAwghw8iMCes66n+0+NDlQSagg4IKj0iDrjf0kb3GdQCx0VNZlIv/qpxVcRy6PUZ5zBUAfP5LBj2pyb7UyRPgKUI4EbyqAARyOkit8GN0C40A6o92JKYsXcR8tXDcLzXwZESXSWLTevCvNM2G697M/r5yDpRNfq/0jC8jQ7pHWymRpmjGS8sdRnDj5HPe+STYOdjToQqYbhjvlHR8EQHFobmNKYZiGKjzs4nrNiL570ZrvVX1C8Icfm4yCdioCmFs3FrJ8fcqQAqT9gYP/VEaP3M+t+bwINXQ5tDIVoMlJt6rSocxtIrDyiCVs7kmXTYQwtcK/Pk9q+bRd+776u7acqNR55ZaM8aG21dDts7P4WYziJwOIUhM/Mru5rKVN6On5vF4oEAEeGuumuALdF0l/3g+zvsXpKCGLQLu5ciPJJ8/qb1pGFVrAuKgQUQKISqq8Jywbapx/xG5tv734ICvD3a5ZyY3Lz7pBNoyNlcOnrrMM3L5yOKUwZQnhxP/v5BvbtH7z06Sgdw30or6QEWzomcGe4VBCtCtWqxZRQNu2n8cIu1MLpKg+mDEpPcVLCBZK8ro4OOPXOMuWXW4gXLb5VK9rE1COWAEYjysCmO8jDGfCxnT5AYETOIoNNFRzUICMpVZ+HmiMW6r4GvEIui1o5dG3jqmNaM2PQPH6sb9qgQHBZrvJcQoVHXt4X8fZr2M3usHHQBWHt1DbDbBz0aibU7LEpU7hpeW+e/0KPQzpR8bQJ+MkVpQYXH0oz7/J/vEtklDm9VMg41F+McjxWiX4Zf91CpMw9tqbAMKX+29bX4pXr21bWSb2zO2ml5l2aaqIEQrxM37SnR3D4vWNwUgXBfprbImVlX8epKVHlG4o9FFh+yjb+xbgdfRQUYflMic2OGQnOisNYux+Pb+X39P40LVepItn3yqPvB6ZO/PRBQXtBmnHKca8jo0GucYAEbD7x7AUEOV8kiEojvGcnJ0KBTBdFx2n2nyQPz4nAk8Lm8T5wcCBX64YueqN/yBc0AmZsKYOauBMlyJ4bIGWaiXK85stMRLzn8ONHUclQWf+3XBJAtYOWOm68VnN3KJItHGaY8Olo9+TMMqCBWk/nHDYCU6x+XagHF49Qwf0id6uj7U8kMbY69RnxmQu4pmHXTp3MZuATNUT8Qu89kIsmjEXubdj78T3M+CT0GBWqGOPmjSa34dlks6m5lmal0Kq9sgJzdleg/MZ9EKncIEJUMdL2uU/HJLy0H/CiKdh/9pZhzqF2xlq6c3k10FwoYaza+4u8sQVhiDOYl3iJ+H+jJ/0aZhJgt/cfsxhsquSKtrxS+0JrDjAM1qt2yuRPIKqJVCG8IJVs3arzgcPwkMhQgL/K8DtWlb7FUn0OQuTZeVFdxBDkAu2guDQDTsrTwUlDonRwsQm177sQ5NkQyElYRzbBCzSWpy9CuwG2bktvevZiX8ND/4Hvcl13U5+vsKJyi69qc1mWvRn0W1JncAd/t0Ax4H0X2Wqc0CBVsOJI6F1kfIN2PCx7zD/sMiycgY2lOzpoPr/0Wer3NbKYvHfDmjP1caytzDvE1qTxFsun92Ggk9kAtdbbPmXd44WTdtmPDUzyas8TIxF9RdaiDxlfQhgj4zoVWYYWTBtZNxbVg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e323ea3b-f179-430d-3e58-08da91cad5ae 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:18.1983 (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: v5ff3ZR2QwXqfBf13kmDB9lFtaBm0yB8XAGNwxf3zEf5rfPyN+ULH7prEpJXhOfdBm3MOUOWeJMKbFaQgD6Wqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 03/14] libcamera: v4l2_videodevice: Move FD duplication in V4L2Device::Open 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" This ensures that the V4L2Device controls attributes have been enumerated in its open() method in case of file descriptor duplication. Signed-off-by: Xavier Roumegue Reviewed-by: Jacopo Mondi --- src/libcamera/v4l2_videodevice.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 955e1508..d0427fef 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -661,17 +661,9 @@ int V4L2VideoDevice::open(SharedFD handle, enum v4l2_buf_type type) { int ret; - UniqueFD newFd = handle.dup(); - if (!newFd.isValid()) { - ret = -errno; - LOG(V4L2, Error) << "Failed to duplicate file handle: " - << strerror(-ret); - return ret; - } - - ret = V4L2Device::setFd(std::move(newFd)); + ret = V4L2Device::open(handle); if (ret < 0) { - LOG(V4L2, Error) << "Failed to set file handle: " + LOG(V4L2, Error) << "Failed to open file handle: " << strerror(-ret); return ret; } From patchwork Thu Sep 8 18:48:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17346 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 59AEBC3272 for ; Thu, 8 Sep 2022 18:49:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 07D7F620B3; Thu, 8 Sep 2022 20:49:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662964; bh=o187exn0iRru3cc77DWztNSBQqaSJ8ZbzcWssCaAtw0=; 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=0ICSR3QmKsYb6cROVRV7Bc4ruvfGmOaVMOFfMLL/eThz+BpjBpxqiUDYnaIK6MT7y 9RxVWBPK0EpYn825s4F+GSc/wr/cQz+JMdaiX7CVEYIkVSU4jWOvxaC3D0/edIeH8w t3eT4ysgSIZjCh602p2xiHYt6z3OkcXZBFEO/I9lJVxGtQ2s+BMnuts4mK81uhalEf NOhVdu9//j++t+nvy2P1qBKg3sUCk3DOd02g/g+fzgMfjXKSULlzjx54lke8+uF5Mp Azp4La7KDOCuegZMtPw+9I6LtzkOA5R5ctIoZ8/PNiQV2/94dUA98b9LKZr2aRZgy8 3MHRwNKbBiSJg== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60064.outbound.protection.outlook.com [40.107.6.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F1BA620AF for ; Thu, 8 Sep 2022 20:49:20 +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="YGayduta"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dlQAc/s+UUt6lhunECAVEFqHGWYL0tBXJfYwiOr2IcLqHHuK4voTb6VDXOPr6EGGDXgmcemOTtaQEYMkrE9HLRiJve7lzqk7mOoZPO36FexQz+kBQlewHiWEG43dH7RR5H0GYL8yfY+ff2nC2VzMvYxuOleuGfdMgUEUGPWlwLlcmx0FE3oCzdqRuwGLmrXGsYFYqA0vGN3LwcHtbW2YzIlwBhpjGWd0fK/66JCIeojwazjsZz386PEiGEMKMZwbTr0FKRnn6QHqgtynHWVootCxlCKeGF6nt9igmXfdidnFO2X9y64EeB7sbDT7dFqE2joFSvfql4BR9a/4Anu0xQ== 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=S2sNuxMIzSdlEJJoNgfqntq4XAIKjQDfb11cjwNMjfE=; b=f8X5JZCJakiVnt6hWg5a2hbdG3bPLcb4hxf6+d0Ygbw2EoxXs1GJRWuWl2h+lmc7kkfxxxGAi1MStjqRAofk356CCfBycrsrn3jis1Nh+Pxxu0P2qrIxlzmEvGeyaUvgaeoBbGC0YgY7qA2U5pJhgn1ShXxkfi9zVqJ1k2CmKVPVf+OZPgfo78/Qv7O7/dC9dv/l2xNLmZN801R9/vQLuVrvkBcKop55886slGxeErEe/nkvGN2/QyxdtzpuBgAqRZYe2ldNlib1Pj67S4GOhpU1Owwk0Y6TOulJGiltFKNmKI3BUjAxFKnS3USUG2MEXH91kdtNdtYehJ+wMhIuBg== 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=S2sNuxMIzSdlEJJoNgfqntq4XAIKjQDfb11cjwNMjfE=; b=YGaydutaSbmy0wHv7HpWPlFbwESZw51OzGwAsoo1yyO4rT5zHmY6c5bn6MCeBUOHAiTk+zmT6zl7NHwvotxtG6wkaVgvmIYqx5ERodL5rstm6pewLZncBK1gvkKvPKjy7G3IExDWNjRoN9qk5aYRxTmI66UIPInWpcWhyRloGz0= 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:18 +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:18 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:40 +0200 Message-Id: <20220908184850.1874303-5-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: 1092cc32-246a-40ce-11c8-08da91cad5e5 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: Mb93W/cwXJp1AnF/HRP3h/f5BJcJOAr6NaVFuGNAh6iaIwfzl8RA1yAdKfjefb4jMUbk7OF0W8ekYcZC4X1PVQYk8vYlNPb3TKweG2IM77wr9HRlKx/BvOZnuqRxUb90S8jQ/lATvoVxi36JelZwL9EIcMBYVzghaqsh5p1J/rCJKrxQo4R6daFWJAoC01eqOiVtqq04v5NPe9UOHkaw/+MdyMAqadoHHk63OKtqU/cV0CkKUd9UgNA8oQAqUa+Mpsik1BRLXDpUSwNRVOpwIXYZzq1ka5Do7Jaup/2swAqdJ00NigVCqwhsyGsW8L3SHwNRXWZOfpVpSDAeyChF/4/Y+qebWZbDRSmXKs9hfUlYpvkGIv0UPK5JSAQB4cbOlYA4gLFOpAPeheCW5h5vyzfFPaoJvRq8qpVovWWyPNoqRBL236hbbBXljAnL1GwbCTeFHUTkTIXori02HSD8dAnx3knJJRaUyM+ihgCWzSzfVRoEY14NPU0qsra6QkyAO+4r+BIRIAHSYq6I9UwGx+xH37myAoXcVIzJwysjj9a3CMmYV6FLxDpofkAMO94XYzqnbBYGNCB18ahpvyhnvdKRCC+LVHbQf2PI8XUhqPSFmhVFTdWqcxUJPkQp4pTo2puE4w58oLeTt91/PmHvKxeUvd+RmGlJxxwRPqjND2XcHOL29vxPXwKgG1dPb1es7lEiyNJE4ebOdNBF25RhHZxElKTBx7rjKloM8bw2JfNw2AhHEId342T+Ivb+PuYl5PfmD6Qfp/ior5gNTF9dNg== 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)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(83380400001)(6486002)(41533002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: btF8Hl4mui7pFKKzpKKrewkpqlMwEZusPbSts9EZu6l2Y1z9X9n6f36PwMNFjQoMglvq6P6+hltOfLnIL9hjVuHoP2lG8bPnM9iDtEiUN3dTyqxPSgig/GgIwvaVgcJo2EVr95ic8UytL5+5eOuyLO7WZGWQmDVvukUwQTTs1D0HtcJPhwtd+/68moiSruGVoo+dgWY6DHOYvrE4vnjTnWaHuoPo23GLZZZ2SugMxdXcop2akKM0KpUgd9fjb8UJDH/0p1MQ7YwV4pVOJf/Ims1M7mbKFynM/If4SjH0Yo90v8cKV0dDOMRP70+pce1jxYFOrNfaNKT7wm+t6CJxdnqRQ0UJiNO3HPM0wV+vdwAyuCc6mR1sKuQjgKYi3nzaJ5H1mykTRRTaVeZfv0uaQzofaSm8xkU+Ut5/tenakd7NIEQg8NvG4Et2mFDat5A0xI4SOJN15seiGhLQvQNCt3HZZYFE7xT0xB9+6meF/FS+ybFWurUzjkPnhICZFyKDzI20AE2MVwXEPv/8rYUIUQ1cCCqz1DjUEcD9QyRuFU7QR+da/pStvUrzroj/njMeMJTGY5sv2I9h7eGhr7+AQq/MhZIiu4cjuUQOf6miWSU4ygZ1/kped1iZxkSEB7Pdn4GLd/cOpnwSM8fugBCjsy8AL33wtReRo0xqjnb9d+Q8KgmMB6H/1/Bpn5sSJFgAVevzXZm4YdHcrpRyacBprt/jekWGfE80TP/fCPxlCZ3ty/fF9L+kfEPsUs9ufRJlhQXepsopQW1JMYz82emg9vAp+RgKkkl7dev0p6yczOiPG58M/UqxAS7FYJLdL93oysrzoOg2S1W1qjcacpO8ZiVOxQ7kKSF6Tq644ZyoU0mOG6o6OBCsUuk0zV47HlWjGLDiLF3FRgFW1UvlbiypYd4N15hzRXOqIPcfDdBBlj6thCKIV1LUz38uCUbY555kKf1g806SJLb32v5KTQvrEAWP0WBG7ETe8Iieng0x88X7HtqVZjF8mb+bi0L5rID91+LvlbBi2CzqbvEX/0mtmQu49pWilTmNFICoF7xffSDNOmWfXuTu4OQWFj3MwFBOKrh/cIR6EcTF+YZGRaIYAYsAWnXsxBRMrr180x8bfMC/ohCEOwEblAS/EVXlQx5glmRjibIxPl6crPoewn4tHPxqp78vrLuneyAYTkjd6+KGwIL94HnwmCW+jHaQYxfI6h4WOKBhZ9uiN1ES9jKxI5V8lYk841UdvvfELPZ6KlKcjfMVh0C7ysZrK/nkUqlWPfqTqOgQeOJuosrSTR1DZ1JewdHv6OWrrGFiBS81YVbjdzidDM2n1WnpWzOQsIS0ERlf6QHgOnodyJ56waa/tsm9yu1TYpS0B6MnoG/YONpVg4Gf5dvSUP2IYSCoPOvmxcQQOybgxFD0r/kY5vHsz7JDLwmhrfoGcZJuo5z+7rd8QaHuUibBRniiNicJwIIalUro39W7Tlv2CDlmbxtgxkH8RJfyG39XRNep5BJuTZfwOYjAwgRk637efOQ6SqKcN0Sv9mGo1I8RUQLLE+eCfa9nD3hAjuY8osAgXYbeEY+MtBqkrYjdl+Y9sIM1JZJDFFTwKIxCRTMVOIqL4jiDX/O7e5NprhMLuLqXKY8DaUzh0O3sSc0dC4mVQBZmA8hoORBB0vJEjQU0Ky+1UE70zQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1092cc32-246a-40ce-11c8-08da91cad5e5 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:18.6514 (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: 70jmuE66fDy2Nrv96o8VyotLDKG63ZKmwstpx6tfc9Akqh0S192QhbAsmuw0iM7fZnx9gHwtbge4JE6aBbENCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 04/14] libcamera: Declare generic size and format converter interface 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" Declare a converter Abstract Base Class intented to provide generic interfaces to hardware offering size and format conversion services on streams. This is mainly based on the public interfaces of the current converter class implementation found in the simple pipeline handler. The main change is the introduction of load_configuration() method which can be used by the concrete implementation to load hardware specific runtime parameters defined by the application. Signed-off-by: Xavier Roumegue --- include/libcamera/internal/converter.h | 101 ++++++++++++++++++++++++ include/libcamera/internal/meson.build | 1 + src/libcamera/converter.cpp | 102 +++++++++++++++++++++++++ src/libcamera/meson.build | 1 + 4 files changed, 205 insertions(+) create mode 100644 include/libcamera/internal/converter.h create mode 100644 src/libcamera/converter.cpp diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h new file mode 100644 index 00000000..e2237c57 --- /dev/null +++ b/include/libcamera/internal/converter.h @@ -0,0 +1,101 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2020, Laurent Pinchart + * Copyright 2022 NXP + * + * converter.h - Generic stream converter infrastructure + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +namespace libcamera { + +class FrameBuffer; +class MediaDevice; +class Size; +class SizeRange; +struct StreamConfiguration; + +class Converter +{ +public: + Converter(MediaDevice *media); + virtual ~Converter(); + virtual int loadConfiguration(const std::string &filename) = 0; + + virtual bool isValid() const = 0; + + virtual std::vector formats(PixelFormat input) = 0; + virtual SizeRange sizes(const Size &input) = 0; + + virtual std::tuple + strideAndFrameSize(const PixelFormat &pixelFormat, const Size &size) = 0; + + virtual int configure(const StreamConfiguration &inputCfg, + const std::vector> &outputCfg) = 0; + virtual int exportBuffers(unsigned int ouput, unsigned int count, + std::vector> *buffers) = 0; + + virtual int start() = 0; + virtual void stop() = 0; + + virtual int queueBuffers(FrameBuffer *input, + const std::map &outputs) = 0; + + std::string deviceNode_; + Signal inputBufferReady; + Signal outputBufferReady; +}; + +class ConverterFactory +{ +public: + ConverterFactory(const std::string name); + virtual ~ConverterFactory() = default; + + static std::unique_ptr create(MediaDevice *media); + + static void registerType(ConverterFactory *factory); + static std::vector &factories(); + static std::vector names(); + +protected: + virtual Converter *createInstance(MediaDevice *media) = 0; + virtual const std::vector aliases() const = 0; + +private: + LIBCAMERA_DISABLE_COPY_AND_MOVE(ConverterFactory) + + std::string name_; +}; + +#define REGISTER_CONVERTER(name, converter, ...) \ + class converter##Factory final : public ConverterFactory \ + { \ + public: \ + converter##Factory() : ConverterFactory(name) {} \ + \ + private: \ + Converter *createInstance(MediaDevice *media) \ + { \ + return new converter(media); \ + } \ + std::vector aliases_ = { __VA_ARGS__ }; \ + const std::vector aliases() const { return aliases_; } \ + }; \ + static converter##Factory global_##converter##Factory; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 7a780d48..8f50d755 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -19,6 +19,7 @@ libcamera_internal_headers = files([ 'camera_sensor_properties.h', 'control_serializer.h', 'control_validator.h', + 'converter.h', 'delayed_controls.h', 'device_enumerator.h', 'device_enumerator_sysfs.h', diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp new file mode 100644 index 00000000..89a594d1 --- /dev/null +++ b/src/libcamera/converter.cpp @@ -0,0 +1,102 @@ + +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright 2022 NXP + * + * converter.cpp - Generic Format converter interface + */ + +#include + +#include + +#include "libcamera/internal/converter.h" +#include "libcamera/internal/media_device.h" + +namespace libcamera { + +LOG_DEFINE_CATEGORY(Converter) + +Converter::Converter(MediaDevice *media) +{ + const std::vector &entities = media->entities(); + auto it = std::find_if(entities.begin(), entities.end(), + [](MediaEntity *entity) { + return entity->function() == MEDIA_ENT_F_IO_V4L; + }); + if (it == entities.end()) + return; + + deviceNode_ = (*it)->deviceNode(); +} + +Converter::~Converter() +{ +} + +ConverterFactory::ConverterFactory(const std::string name) + : name_(name) +{ + registerType(this); +} + +std::unique_ptr ConverterFactory::create(MediaDevice *media) +{ + std::vector &factories = + ConverterFactory::factories(); + + for (ConverterFactory *factory : factories) { + std::vector aliases = factory->aliases(); + auto it = std::find(aliases.begin(), aliases.end(), media->driver()); + + if (it == aliases.end() && media->driver() != factory->name_) + continue; + + LOG(Converter, Debug) + << "Creating converter from " + << factory->name_ << " factory with " + << (it == aliases.end() ? "no" : media->driver()) << " alias."; + + Converter *converter = factory->createInstance(media); + return std::unique_ptr(converter); + } + + return nullptr; +} + +void ConverterFactory::registerType(ConverterFactory *factory) +{ + std::vector &factories = + ConverterFactory::factories(); + + factories.push_back(factory); +} + +std::vector ConverterFactory::names() +{ + std::vector list; + + std::vector &factories = + ConverterFactory::factories(); + + for (ConverterFactory *factory : factories) { + list.push_back(factory->name_); + for (auto alias : factory->aliases()) + list.push_back(alias); + } + + return list; +} + +std::vector &ConverterFactory::factories() +{ + /* + * The static factories map is defined inside the function to ensure + * it gets initialized on first use, without any dependency on link + * order. + */ + static std::vector factories; + return factories; +} + +} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 63b47b17..a261d4b4 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -13,6 +13,7 @@ libcamera_sources = files([ 'controls.cpp', 'control_serializer.cpp', 'control_validator.cpp', + 'converter.cpp', 'delayed_controls.cpp', 'device_enumerator.cpp', 'device_enumerator_sysfs.cpp', From patchwork Thu Sep 8 18:48:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17347 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 361EBC327E for ; Thu, 8 Sep 2022 18:49:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 87A56620B5; Thu, 8 Sep 2022 20:49:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662964; bh=FB3nfyXG1YQcIC5wBNUpIeHSm6djyUS5KTbtuPULw1k=; 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=o4nq0t0aetVOct4Gfsj8yb5DceXGlfzNbaV9EfYmRF9o9aHU7B3s13CXdBAxD81MK GI2qy+dOiFp4wE4WYN25kKMgjMZKBOU5NtP+jRieSfzFAmL6rVhi3dwcsFPNlFCPa2 /nhKhlPanHQEJLdVw7YxSKr7ikjV5hCrs4qu3h0VwZqVwvqYJh8ceTIXgZyCtcjhNR q5zHdZEsvzSTA73+gHLArne7mZAHFEjxfJYf34IFFbOmyAPS1/bZbVz3QAcnv2SdGu C+v/QQ/iL8M/Rcf4nMcV5s4tmdqLbFYdcrUKfue4+FAsSZLcpwkwZqu6aVvCRmZ1/O KKmGPt+nUYmow== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60067.outbound.protection.outlook.com [40.107.6.67]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6DB26620AE for ; Thu, 8 Sep 2022 20:49:20 +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="YodUHMCo"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OnwrPdqvVlCO1mRwwztKLD1Do8GT+ZrYH+IeRn1FcIjz37KeoNOWCGKq1ekjqdCGkF17QATeLIUKlU4OnHck8eFLzgwP5UsRNfwldXVeqalZT1NRLMChhJsjpJ9m6jOdCYorHC2HjdVCjmimTDs69XiiX1MiN6/B6LEH6Cpdsq7Fy5dmRbgi9O4bm3nIQoP9k1eIeXsWjQGmzA155BYfST8a5irfqSaJhWRnUbdYAvhh8JIBhIHp28upJ9eoQNVzrwsPxuLT5E5uHBOzdiv9caVIzLJ3jNz4/1rhpLR3y6v3DXPtK4hOnmLn53kS7t0zhggOu5LypO+7rysHbVSA/Q== 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=8jKM5ZP5uwYAwjwiCv1bawvH7kctQWX4l2NUDOkGw3M=; b=S0Lm8rniBRBUbLoH5KjZtxjG0/jNWBkLWq4GGT0fioz6crVWg3bv0a37qV80hdmPAUL6M2N92h+fsw528nBuAd2AyEgBnM8yosSpaNwY9Il55G5yNu7vpjeHaiP7tZuQElF3iIbplUnkDo+PLrWMxwN50Z0Xa2bDPPGyZRtrbdMp0pCSDCurB8DDHf8jDL6Q3UFpgU/ttBonFla7d3Qf4L2/unjUVVtauMAqqzkALknuzNEose7hoqsiK+Ndeyf+KyM6I8w/ZEMwJbouULSsR+qJybjJGGhq3iIoSnHnaOS0FXcUpbqiVkXPzaIkvojaAhfY0UhXbl2j4yLqVvEcAg== 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=8jKM5ZP5uwYAwjwiCv1bawvH7kctQWX4l2NUDOkGw3M=; b=YodUHMCo2pH1IEBVi8F1+rN1jI2DXJIYMAqM/j5Fg2AwJgU2F9SR6yaWFIoQ9vozkk5Inc6OVY+pzSFqbvh6DM+GUUUWtZoKdgwJD6UBY9b+nBdPFEb7sDKqGlfARFbWTDfd5swlAXa3rd8vp1DJAcXtrDr7XWQTlTyaLXa1w+c= 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:19 +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:19 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:41 +0200 Message-Id: <20220908184850.1874303-6-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: 3cdfa62f-789b-46f3-3cb1-08da91cad623 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: j2wXAQGaQGhbivu0DlOLfEPybkD7bszmixXS1//e+ZPBZ3yp5+iD9l1viZKUXTJK7cPYOr1z1bX1Qc/VOfbmBKN5zZ1wau2xF3BIA67WO4G5PlcZr86RditWGre/hPBPNlFk5SCJJFZ7BnX20UezYEowJheF4cy5gtmDm0Iu1vAmTGUcIjqBmYqhxZwhztcl4kRWBGbySZQNGw7a7HwWshjT6/0RWZgBbGKo+j1Vh1zTAfdx/85y0VDSHhvrqi/2IhRcnMVelFCKv/ciOzX2aeHcS9wUzQq6FDPDIjNflroGwxEG00E/MORkHDIYNAY/EKSYfm6B2udGpOG/fA5iIMA2P808ffCWACpa8gbQiCUy2Ct60ECuYtkIuoJD/nVFjUNvO3gJwfc06qF1G40yGLW1f7kNTEWhHxic88LI5obH3BYXT+2/FSC6kGvP8HIUjF59878y/ZT1tIJ+9lEolwH0U9EoxSn+Uc7axZFuOhmLMknAHytyofVrYTHKTwri2LOEjtmCiM9P+RyY/cTVwPucEW+BXaIZbsW6npAeD2Y8OrA7+EunJM+xV8LGeZDOEScfwJDMtJ/1eZEiTZPlXXME5PvdUn57r0+dw51ygBXwHaj/S8Z8zG++oBw1V+nrtsXCxHjSo2qNey/O8Zp0ChS+e7dcbD6PtNbBglUUkibVBChuikT//wQquLAaLHWoio17OO+d7g1Xx9/DXJCzYw== 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)(4744005)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a/ubE7UXrzOdX/67/7zQ/xnnw+onlaijSEuYCG0FM/DGgSdD73TcCxoPVdkLkBKkBJSGXo5MdPE7+kvenvVo68d/o723BZdC2N/UxmYl9WCVd1W0uOXHrseIXcdhmf+Z+0DXpp09TeYTsVjqhp+NQrrQTkvbw1k+bB6lS7DxfAd4pfKrBFPG0cY8H5Hicqpk3Eg3DJn6p9WBIvWth6yD91p4T17Rpb8C/4ZXjHq6ghzMFwBQGhZvb95NwabtsDwLxwGdbicIGsgvNrtOtjn9A6rCB6RJIS2eiAZlh5oX9PoiQn5Nxlveizb1IT9Gn8/fWXHxWfxE/CDIbAiHDunQ33DDsZquMOeWwo5Cg9DKvN3FXl5A8eX7C/z2EiZFWNj4SUYQkkO/11y0k2wSEnr+VSM5Ga1erCktyKbb+wjm+Erc9Q65xFdSLUo63DMJkcRBGDsNXkZ0rslCoYyEFtEu8IKiUmKOcDEvhcL5y993nutxua48TeZcDK2GOUl1jFoq9/NUiVLqRKNtTM/NgM5aSzVIkHJL/TNcMsbZhxE2N2eFA1J7s0gXnqj+wbcCWRUTNtffGmJkY/iF1S5Y1HdBn/DfpaAUFcAWC1TcSmNLyi1yeKVKGchvthla3PuOH3ZhWZzhmkLO7RHfEJlL7EK/A0LuuwlH72XLlItEpRV0lZTqrN1+cXbl/o8OuuUgQCODycrLMU6mNNef27s1Vi+nPtpAll3fpj9Yo7hLYdl6fL0wKnuWm9Intnpno3TNYvhl11azV2r7HKpGcfwyzXkutz8os8AXWiK2jFhJPRo07oW0szRa/QOkJmlOF/ZnlARKH67/o3IkpCzCqLQmyiA+VufHhj9wIMdAAWeZAi5nlssgqY5ZC6dyXVIbtsK+SAqiaeyiLTGVHDukY6Gcm8KDN8oSdnQI1HGYROKuFL4rMvACWvLuPs6aRMrMwqiSaSJ70dYv7Qr4mbux9muijVSB3hSNOjoSy9EXxZImBPEV2NKq/NrQ3/wcUPxcAEardioVRbxtViWL4gBWC94mhV9tixJQPDBRSTZwHO4m1ya+rSWcw1jC77DzI+ENugxSae4TI2HoZ6p1xRKRWESO8f/ca9JypVoERchLl0WoY3ys7RFgsW/YnQu5nJSvrvlpilmuD5X0mQ2GK8/dCcpvPA6Y5vxvH+y7dH9D0Y67qNVrPuQBTXH8r0UM+ziPpP1cV+OOWUsJLoc8cw0Za6Uzfr716rIJgrJBzDNtwTmUrtWBel6zfXDbWRlrL1BI6TXkt/QDziopUZT4LSFVVUA70PFI2yNDfHGV/rkT937mPDUH5t0WzbvzGstN0qiZdMCPpscx/+eqmrRd76BWgwjKIahSRXeVLJ+aG8aCi+n0WW3gI5VNbahnVADUI6T2FPSpSr3WPEnOIjNftrCpFRztJaiP3d7r6VnFAY7t1UWURLqgCkui+ot64blsbtK0PhrVNpkrzzMvtxefsr1Ti3YljfyMmnoHdic7MnuSTOx386lCNnrHLnlD2PFnTqVCeb2okI5D/co6mK6X2KZRirAMheQ9+o/asXiHBEAfcmhFKrRFHMjst7HGQWesBpuzN8IBn0DeobNrRrComk4LOgGH3iR3BEv5/w7pfRsimnqaD0oDBvNIZ4pZYcNpSO9WNa9SQKao9CdQofn/G3uzmeEThNCNWA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3cdfa62f-789b-46f3-3cb1-08da91cad623 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:19.1213 (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: zFSGSUckNnwuJf2QiOJFj41THb94spl4Te0+u5AQpXfTCfE0jWNkwaaSXdsASokc3xwPV/dXIaMLbpn85ofcTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 05/14] libcamera: converter: Add queueBuffer() helper 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" Signed-off-by: Xavier Roumegue --- include/libcamera/internal/converter.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h index e2237c57..ea1deab0 100644 --- a/include/libcamera/internal/converter.h +++ b/include/libcamera/internal/converter.h @@ -55,6 +55,12 @@ public: virtual int queueBuffers(FrameBuffer *input, const std::map &outputs) = 0; + int queueBuffer(FrameBuffer *input, FrameBuffer *output) + { + std::map _output = { { 0, output } }; + return queueBuffers(input, _output); + } + std::string deviceNode_; Signal inputBufferReady; Signal outputBufferReady; From patchwork Thu Sep 8 18:48:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17348 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 C6CC7C327D for ; Thu, 8 Sep 2022 18:49:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3110D620B6; Thu, 8 Sep 2022 20:49:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662965; bh=EKlqKSFCmwmnPZXIXUE9x0XE7k7IhRmt+tOnU2YRQIw=; 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=1e674kEPqK4bZMhnezRZCkYerrNcqCBgHb/OqhEOe+nP20Tll5TzDGwzImjs5sSWu 6iq/ogPXXl7Xwwyc3zVAHh451GjwVLGYSCvyRB/7eDzqN+KA25Bzs8ZEmVAQHYFPGf f7q/RViLsF30qtq3SwvVG49zjo8bxkMhtwVbD+2KAAAo74c3J67MoUb9EIrb9oClXC dU3sOox5haMD28e7goMCT/nN8/fHLGiJ1ZahUZaMdnvE3z7A9o60qTK6ZJWrZN9owc MlQ5K4zHKAOzq/a547OhZigkZrJrZtOXXKbQjYNpj6IIwdQ1EIjkGZCmXIQR1gtEHU ffIrlzCxB055A== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60040.outbound.protection.outlook.com [40.107.6.40]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 22940620AF for ; Thu, 8 Sep 2022 20:49:21 +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="cdjhpENZ"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kufSDeHXOYZY8yWXt+jqlgG4Wpw1mwta2vYRLgf/OutzaeeMV2nC557OfkniOhFkwkN0ZAzddgb8BMZKiqPUqG99Gu9F05lGMYFzMWLM5P4wkV2wrS72BVuXSO19K5RelHZrgjlDDXYoDAdxkhsIfuh12/LiRpBo+cGKmWVn6CToBOyqARnXyrhkUkwrr7ArZ+fu5bmjprIjbapE1NPhP8kb+QdOSihS65/Vj1gffmIb6mrff2mRIIfBFA7pzWFazeuxiRZ8LtjaOTe6ZJa8A9bFl4Szzq+iZa+olYLCYxKxJ3TXQlhgOBvFL8mX13lHrPtNYRJ4Gv9L0RDmeG8wSg== 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=TEOyI1lC4MfDpLDLdSI+otafx7tIauV6bnWUh0XG0RE=; b=JM8gieQITMj0Jf7hJVQa5bwFoUdW8bvtFyEDaoP9okKPyK6tSS0V8QjhlfJuyJIeuQmRuK7jp6IzSB0ekGjJGPqsgKFYrnG/30j08sog4xtlnbXEcvjjbdQwgtNDJbdA7aEL2S8O3DPqXNNT2V2SU9GOjyGounoTgO0mMrLBwObaM7BKHzgHWfLnh/tyvh9CMSDgzdO5fDfZiLaA9j3EuNYeBBEMjLzk0DQSxq/DERyuZ2EFodOC9RKpZlBCKXkBOgOFxUadkA7OSPK1dhXGPyzWZPdk/nxx3UxmyaI0jb91LQeVz/Dnz980C63CWOycZrHkdgiEAd0guWY/rwYWdg== 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=TEOyI1lC4MfDpLDLdSI+otafx7tIauV6bnWUh0XG0RE=; b=cdjhpENZpACxanhD0OxtxDCe2geY86CyAUefyjxBkAkvjrTj3q3r9vqJJE0uAY4KSExIveZXZJC99s6RrLvyU674lUuJgcGgNKATPJzKUdjsysdtlYQwu4F6nb0hUd2mCFQ4l+j1SP9iCb+vobOu8ElGsIhEmiO2j6+AsaL8MeY= 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:19 +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:19 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:42 +0200 Message-Id: <20220908184850.1874303-7-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: a8f7b1cf-9893-453c-2213-08da91cad66d 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: YWGslAEETi+5z4LFMy3+v3MEOiba567Geob1Qklm8Xi9Rs2PRyfpyxhpiE95+vB9D1VDnesCNQl1LNf18uT0iezc5HVbntHIkCI2oAxPVcSRvH8N4Xvw9FuX3PgcK7MLYynomYSoEwcLp8I0l2wGYGBc4eJXWig8C51WumKxYzylidpnqBndDKgQLLFiRzN/8+CsQMwyfbBSSGXfdf1/bveqdMzvVc0zVdA1ctEC62mBogGZzDtLXz05BAY7TzCRf4gNWZI4Co6B6V44KyRSSUSkhR1AyYCxYKYPkq6frNYsY3DDxQyo7wi9Xhkr71SDTulPPLyZaqr62plmX+17iOoQ9W+HPrJmcCNOmpkA7tzrtE+pAApFgE3ZjndBnonHUNAuwmBzPEp5BAyPJoM37JKv7mPUWX2+RqS24H8t0RlMwYeDL+zAp24x3DDoPdWXUnT1w2yKNzzluUkSGT9GdpyZn5Z53OWZM15Dv/0ozg79lFBaAnu+XG8jYUcztA27SQD0Hg2U8xyo4aGV/nkGvCDpmsT8vY4dr3pXmosb/oJe3Mo9E4lMxi1pZYocUhieechFo+V26fQjqX/88ogcEy6QMD9XDFflPNqQWbcslBndLD9GN4hlleTBj9AN2WfRLP6vNqlkRuLeWGXhz0AemVZ0R3/jnQYiQsDdf4ijjmN8x8Xp6BKACojcljtmw3MZaJyEgajUEGQ+zaEzfDw9DQ== 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)(30864003)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(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: O4uORQXq0+hJce5oL9f8kcXXbD66plsL/kR4NNduqZmFN/uY/YDygVtizL3vIBHlBx36Zn6r1WvjGI/dzZeFiEEF/94ap2tWWOasP2dYvIeMwSiAtRgR7yzvicZ8nMX3FDRtRQDv4ETxwejAZj6N62KXPaj/rYrd0y0jClw9BSbY5ScSLA/EWGASsmYi0ZpuS0JLBsndTITPvmBrloP0O9C36GXqVG+w4Vn7TfD++/+UDe6l39Hc6o8Q1KqZh6hp5TrEfssd/S+qZ2lBf54KaFHzlVfaXFMwvB0x7QSM0ZDzNL3gSOwlsUcrCAxRQAbH0Ry2yiCybSV6ZFcVC9Zb0KvbG1e28ycYTfYNjTTyoKNrkBEDRb3PxzKVDynpm00Armf+kG50auF04l5z148oiluC4gyira80qrRu74e155PuPbtAk39Km0BOgmOtrjujooCjGycF7QnCMwbh1zBVRqzScBkeumJBfuUAQd+tRgAaNIcRWyAtOruFZ1E7egGhrtx9lkprwXKVEm1qa7OOww8+yY3QbMuvR239IH5552bc6cs+5CRjFPHgS7vSqnLg0RmBQnjBDnLll+x1CjhuktcSFrvCTz2ISYbs4n/91eKiEo79kbcGr+pbr6n1PIdC9TesVM37C5+YLqsErN/RJtw1OLlvC5PJ8CQeWFZDycYAUxR+wqEb/jmh4hgyKhYqfw01Zf4EHEVRInMbmnzBT20xlqon20qkwsSIeTSa9LjKwTEFPk+k9h7vkdGw1BaueKL17cA5ef6+cfmwDlbiPv3ajSBwF2sa9+ayqDNbfSnt/bx7U3H4syBunJ9IV+hnRul4dvUm3v7yvKjkHBYeADotdCvPvaXl5CVKy9nw5JRdOk+gxN9x4M1dsMcAx7t8NXRvsNmcZgtSnGT9sXed3xGg5jkyGLlb32MMNyeBza9GfXyMW+GPiTW+EoejAKKySt88hY1Xpaxm2cglNRKPE4Q3MTvOSDl1LMH2xMuK262kPfh42gukO6mFcdfaeutC0SRJe9PWD1sza1Lw5DpztLHVYxKUc3E9sIHJlAFDavkCXejvHd5YCVzORSFTdmentBegTtBcudukGCVzE7t/PKlQt8HiTOhg2/OpcMZGrvjsm74ZmpPkFXw0HbYbtVUJWRKOCM5D7qrK8ZJsmCLOSWQwhq5PxwyI985hRIB2nH+uYiVeEmRr+xmDL7pZLsvMUKpkNfGy15tlt88jjtjavWOpdmSXbYUAqEZ94ca5BvCH1tVaHZp/c6NK2KEolbsvXeS7y3a4AEwVnr7ZGNboL/2zkkw9minqLAMG2ERDz+iaIiXYWWjzeRchYu+utIZrsqugEonhBZ01FUxdiCLqLilWqAkeWH/dvfJKTWV4QFtrnOOvRCLdJzEwlGhYPCEzMUXMhimxNdYRILvRzu0HZ8JcBcWVwCcomm3lEoKVjf1FLw9wCVvTNThaR36uOhAIQA4MhLbG1rAFtSfETBr5Z91Kt/U/CVLl0UgXo85YXN6n7YggG8eAqTDzFYZrR9M7N5LILdD3KmHl4X36oWCSY+g7J3gyZIMQTpOhAHWGkoETO4SlJFHtrHBWH41YPVGElxMTkI2VlM/Yud5VVQMqdrFRgIf4yt4lmbUYVK2J42hgrf3+ptxiAnNsVub7VbaaHxhEiol9fKaygofmY6jL3Q== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8f7b1cf-9893-453c-2213-08da91cad66d 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:19.5431 (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: if0tn6tAML0yFK3d+AXErwAFpxwCmqjjYShIap3RfEXnQ1TtPnmtX1XuL7qYk/PxfWVZqj7mBDkrBoYkXyqtUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 06/14] libcamera: converter: Add v4l2 m2m converter implementation 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" Introduce a converter implementation relying on a v4l2 m2m device, mostly based on the current simple pipeline converter implementation. The main change is the introduction of Mapping object which can be loaded through a configuration file which define vertices remapping coordinates. Those latters can be applied by any classes derived from this base class which define the apply_mapping() method. Signed-off-by: Xavier Roumegue --- .../libcamera/internal/converter_v4l2_m2m.h | 120 +++++ include/libcamera/internal/meson.build | 1 + src/libcamera/converter_v4l2_m2m.cpp | 504 ++++++++++++++++++ src/libcamera/meson.build | 1 + 4 files changed, 626 insertions(+) create mode 100644 include/libcamera/internal/converter_v4l2_m2m.h create mode 100644 src/libcamera/converter_v4l2_m2m.cpp diff --git a/include/libcamera/internal/converter_v4l2_m2m.h b/include/libcamera/internal/converter_v4l2_m2m.h new file mode 100644 index 00000000..3667b128 --- /dev/null +++ b/include/libcamera/internal/converter_v4l2_m2m.h @@ -0,0 +1,120 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright 2022 NXP + * + * converter_v4l2_m2m.h - V4l2 M2M Format converter interface + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "libcamera/internal/converter.h" + +namespace libcamera { + +class FrameBuffer; +class MediaDevice; +class Size; +class SizeRange; +struct StreamConfiguration; +class V4L2M2MDevice; +class V4L2M2MConverter; +class Converter; + +class V4L2M2MConverter : public Converter +{ +protected: + class Mapping + { + public: + Mapping(const Size &input, const Size &output, const std::vector &map) + : input_(input), output_(output), map_(map) {} + Size getInputSize() const { return input_; } + Size getOutputSize() const { return output_; } + std::size_t getLength() const { return map_.size(); } + const uint32_t *getMapping() const { return map_.data(); } + + private: + Size input_; + Size output_; + std::vector map_; + }; + + class Stream : protected Loggable + { + public: + Stream(V4L2M2MConverter *converter, unsigned int index); + + bool isValid() const { return m2m_ != nullptr; } + + int configure(const StreamConfiguration &inputCfg, + const StreamConfiguration &outputCfg); + int exportBuffers(unsigned int count, + std::vector> *buffers); + + int start(); + void stop(); + + int queueBuffers(FrameBuffer *input, FrameBuffer *output); + std::unique_ptr m2m_; + + protected: + std::string logPrefix() const override; + + private: + void captureBufferReady(FrameBuffer *buffer); + void outputBufferReady(FrameBuffer *buffer); + + V4L2M2MConverter *converter_; + unsigned int index_; + + unsigned int inputBufferCount_; + unsigned int outputBufferCount_; + }; + + std::unique_ptr m2m_; + + std::vector streams_; + std::vector mappings_; + std::map queue_; + +public: + V4L2M2MConverter(MediaDevice *media); + + int loadConfiguration(const std::string &filename) override; + + bool isValid() const { return m2m_ != nullptr; } + + std::vector formats(PixelFormat input); + SizeRange sizes(const Size &input); + + std::tuple + strideAndFrameSize(const PixelFormat &pixelFormat, const Size &size); + + int configure(const StreamConfiguration &inputCfg, + const std::vector> &outputCfg); + int exportBuffers(unsigned int ouput, unsigned int count, + std::vector> *buffers); + + int start(); + void stop(); + + int queueBuffers(FrameBuffer *input, + const std::map &outputs); + + virtual int applyMapping([[maybe_unused]] Stream *stream, [[maybe_unused]] Mapping &mapping) { return 0; }; +}; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 8f50d755..132de5ef 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -20,6 +20,7 @@ libcamera_internal_headers = files([ 'control_serializer.h', 'control_validator.h', 'converter.h', + 'converter_v4l2_m2m.h', 'delayed_controls.h', 'device_enumerator.h', 'device_enumerator_sysfs.h', diff --git a/src/libcamera/converter_v4l2_m2m.cpp b/src/libcamera/converter_v4l2_m2m.cpp new file mode 100644 index 00000000..942e6e6f --- /dev/null +++ b/src/libcamera/converter_v4l2_m2m.cpp @@ -0,0 +1,504 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2020, Laurent Pinchart + * Copyright 2022 NXP + * + * converter_v4l2_m2m.cpp - V4L2 M2M Format converter + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "libcamera/internal/converter_v4l2_m2m.h" +#include "libcamera/internal/media_device.h" +#include "libcamera/internal/v4l2_videodevice.h" +#include "libcamera/internal/yaml_parser.h" + +namespace libcamera { + +LOG_DECLARE_CATEGORY(Converter) + +/* ----------------------------------------------------------------------------- + * V4L2M2MConverter::Stream + */ + +V4L2M2MConverter::Stream::Stream(V4L2M2MConverter *converter, unsigned int index) + : converter_(converter), index_(index) +{ + m2m_ = std::make_unique(converter->deviceNode_); + + m2m_->output()->bufferReady.connect(this, &Stream::outputBufferReady); + m2m_->capture()->bufferReady.connect(this, &Stream::captureBufferReady); + + int ret = m2m_->open(); + if (ret < 0) + m2m_.reset(); +} + +int V4L2M2MConverter::Stream::configure(const StreamConfiguration &inputCfg, + const StreamConfiguration &outputCfg) +{ + V4L2PixelFormat videoFormat = + m2m_->output()->toV4L2PixelFormat(inputCfg.pixelFormat); + + V4L2DeviceFormat format; + format.fourcc = videoFormat; + format.size = inputCfg.size; + format.planesCount = 1; + format.planes[0].bpl = inputCfg.stride; + + int ret = m2m_->output()->setFormat(&format); + if (ret < 0) { + LOG(Converter, Error) + << "Failed to set input format: " << strerror(-ret); + return ret; + } + + if (format.fourcc != videoFormat || format.size != inputCfg.size || + format.planes[0].bpl != inputCfg.stride) { + LOG(Converter, Error) + << "Input format not supported (requested " + << inputCfg.size << "-" << videoFormat + << ", got " << format << ")"; + return -EINVAL; + } + + /* Set the pixel format and size on the output. */ + videoFormat = m2m_->capture()->toV4L2PixelFormat(outputCfg.pixelFormat); + format = {}; + format.fourcc = videoFormat; + format.size = outputCfg.size; + + ret = m2m_->capture()->setFormat(&format); + if (ret < 0) { + LOG(Converter, Error) + << "Failed to set output format: " << strerror(-ret); + return ret; + } + + if (format.fourcc != videoFormat || format.size != outputCfg.size) { + LOG(Converter, Error) + << "Output format not supported"; + return -EINVAL; + } + + inputBufferCount_ = inputCfg.bufferCount; + outputBufferCount_ = outputCfg.bufferCount; + + for (Mapping &mapping : converter_->mappings_) { + ControlList ctrls; + if (mapping.getInputSize() == inputCfg.size && mapping.getOutputSize() == outputCfg.size) { + LOG(Converter, Debug) + << "Got a configuration match " + << inputCfg.size << " --> " << outputCfg.size; + converter_->applyMapping(this, mapping); + } + } + + return 0; +} + +int V4L2M2MConverter::Stream::exportBuffers(unsigned int count, + std::vector> *buffers) +{ + return m2m_->capture()->exportBuffers(count, buffers); +} + +int V4L2M2MConverter::Stream::start() +{ + int ret = m2m_->output()->importBuffers(inputBufferCount_); + if (ret < 0) + return ret; + + ret = m2m_->capture()->importBuffers(outputBufferCount_); + if (ret < 0) { + stop(); + return ret; + } + + ret = m2m_->output()->streamOn(); + if (ret < 0) { + stop(); + return ret; + } + + ret = m2m_->capture()->streamOn(); + if (ret < 0) { + stop(); + return ret; + } + + return 0; +} + +void V4L2M2MConverter::Stream::stop() +{ + m2m_->capture()->streamOff(); + m2m_->output()->streamOff(); + m2m_->capture()->releaseBuffers(); + m2m_->output()->releaseBuffers(); +} + +int V4L2M2MConverter::Stream::queueBuffers(FrameBuffer *input, FrameBuffer *output) +{ + int ret = m2m_->output()->queueBuffer(input); + if (ret < 0) + return ret; + + ret = m2m_->capture()->queueBuffer(output); + if (ret < 0) + return ret; + + return 0; +} + +std::string V4L2M2MConverter::Stream::logPrefix() const +{ + return "stream" + std::to_string(index_); +} + +void V4L2M2MConverter::Stream::outputBufferReady(FrameBuffer *buffer) +{ + auto it = converter_->queue_.find(buffer); + if (it == converter_->queue_.end()) + return; + + if (!--it->second) { + converter_->inputBufferReady.emit(buffer); + converter_->queue_.erase(it); + } +} + +void V4L2M2MConverter::Stream::captureBufferReady(FrameBuffer *buffer) +{ + converter_->outputBufferReady.emit(buffer); +} + +/* ----------------------------------------------------------------------------- + * V4L2M2MConverter + */ + +V4L2M2MConverter::V4L2M2MConverter(MediaDevice *media) + : Converter(media) +{ + if (deviceNode_.empty()) + return; + + m2m_ = std::make_unique(deviceNode_); + int ret = m2m_->open(); + if (ret < 0) { + m2m_.reset(); + return; + } +} + +int V4L2M2MConverter::loadConfiguration(const std::string &filename) +{ + LOG(Converter, Debug) + << "Parsing configuration file " << filename; + + File file(filename); + + if (!file.open(File::OpenModeFlag::ReadOnly)) { + int ret = file.error(); + LOG(Converter, Error) + << "Failed to open configuration file " + << filename << ": " << strerror(-ret); + return ret; + } + + std::unique_ptr data = YamlParser::parse(file); + if (!data) + return -EINVAL; + + if (!data->contains("mappings")) { + LOG(Converter, Error) + << "Vertex mapping key missing"; + return -EINVAL; + } + + const YamlObject &mappings = (*data)["mappings"]; + if (!mappings.isList() || mappings.size() == 0) { + LOG(Converter, Error) + << "Invalid mappings entry"; + return -EINVAL; + } + + LOG(Converter, Debug) + << "Parsing " << mappings.size() << " mappings"; + mappings_.clear(); + mappings_.reserve(mappings.size()); + + for (std::size_t i = 0; i < mappings.size(); i++) { + const YamlObject &mapping = mappings[i]; + if (!mapping.isDictionary()) { + LOG(Converter, Error) + << "Mapping is not a dictionnary"; + return -EINVAL; + } + + if (!mapping.contains("input-resolution")) { + LOG(Converter, Error) + << "Input resolution missing"; + return -EINVAL; + } + + if (!mapping.contains("output-resolution")) { + LOG(Converter, Error) + << "Output resolution missing"; + return -EINVAL; + } + + if (!mapping.contains("mapping")) { + LOG(Converter, Error) + << "Mapping table missing"; + return -EINVAL; + } + + const YamlObject &input_res = mapping["input-resolution"]; + if (!input_res.isList() || input_res.size() != 2) { + LOG(Converter, Error) + << "Incorrect input resolution"; + return -EINVAL; + } + + const YamlObject &output_res = mapping["output-resolution"]; + if (!output_res.isList() || output_res.size() != 2) { + LOG(Converter, Error) + << "Incorrect output resolution"; + return -EINVAL; + } + + const YamlObject &map = mapping["mapping"]; + if (!map.isList() || map.size() == 0) { + LOG(Converter, Error) + << "Incorrect mapping entries"; + return -EINVAL; + } + + Size input(input_res[0].get(0), input_res[1].get(0)); + Size output(output_res[0].get(0), output_res[1].get(0)); + const auto &mapVector = map.getList().value_or(utils::defopt); + + LOG(Converter, Debug) + << "Input/Output mapping resolution " << input << " ---> " << output; + mappings_.emplace_back(Mapping(input, output, mapVector)); + } + + return mappings.size(); +} + +std::vector V4L2M2MConverter::formats(PixelFormat input) +{ + if (!m2m_) + return {}; + + /* + * Set the format on the input side (V4L2 output) of the converter to + * enumerate the conversion capabilities on its output (V4L2 capture). + */ + V4L2DeviceFormat v4l2Format; + v4l2Format.fourcc = m2m_->output()->toV4L2PixelFormat(input); + v4l2Format.size = { 1, 1 }; + + int ret = m2m_->output()->setFormat(&v4l2Format); + if (ret < 0) { + LOG(Converter, Error) + << "Failed to set format: " << strerror(-ret); + return {}; + } + + if (v4l2Format.fourcc != m2m_->output()->toV4L2PixelFormat(input)) { + LOG(Converter, Debug) + << "Input format " << input << " not supported."; + return {}; + } + + std::vector pixelFormats; + + for (const auto &format : m2m_->capture()->formats()) { + PixelFormat pixelFormat = format.first.toPixelFormat(); + if (pixelFormat) + pixelFormats.push_back(pixelFormat); + } + + return pixelFormats; +} + +SizeRange V4L2M2MConverter::sizes(const Size &input) +{ + if (!m2m_) + return {}; + + /* + * Set the size on the input side (V4L2 output) of the converter to + * enumerate the scaling capabilities on its output (V4L2 capture). + */ + V4L2DeviceFormat format; + format.fourcc = V4L2PixelFormat(); + format.size = input; + + int ret = m2m_->output()->setFormat(&format); + if (ret < 0) { + LOG(Converter, Error) + << "Failed to set format: " << strerror(-ret); + return {}; + } + + SizeRange sizes; + + format.size = { 1, 1 }; + ret = m2m_->capture()->setFormat(&format); + if (ret < 0) { + LOG(Converter, Error) + << "Failed to set format: " << strerror(-ret); + return {}; + } + + sizes.min = format.size; + + format.size = { UINT_MAX, UINT_MAX }; + ret = m2m_->capture()->setFormat(&format); + if (ret < 0) { + LOG(Converter, Error) + << "Failed to set format: " << strerror(-ret); + return {}; + } + + sizes.max = format.size; + + return sizes; +} + +std::tuple +V4L2M2MConverter::strideAndFrameSize(const PixelFormat &pixelFormat, + const Size &size) +{ + V4L2DeviceFormat format; + format.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat); + format.size = size; + + int ret = m2m_->capture()->tryFormat(&format); + if (ret < 0) + return std::make_tuple(0, 0); + + return std::make_tuple(format.planes[0].bpl, format.planes[0].size); +} + +int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg, + const std::vector> &outputCfgs) +{ + int ret = 0; + + streams_.clear(); + streams_.reserve(outputCfgs.size()); + + for (unsigned int i = 0; i < outputCfgs.size(); ++i) { + Stream &stream = streams_.emplace_back(this, i); + + if (!stream.isValid()) { + LOG(Converter, Error) + << "Failed to create stream " << i; + ret = -EINVAL; + break; + } + + ret = stream.configure(inputCfg, outputCfgs[i]); + if (ret < 0) + break; + } + + if (ret < 0) { + streams_.clear(); + return ret; + } + + return 0; +} + +int V4L2M2MConverter::exportBuffers(unsigned int output, unsigned int count, + std::vector> *buffers) +{ + if (output >= streams_.size()) + return -EINVAL; + + return streams_[output].exportBuffers(count, buffers); +} + +int V4L2M2MConverter::start() +{ + int ret; + + for (Stream &stream : streams_) { + ret = stream.start(); + if (ret < 0) { + stop(); + return ret; + } + } + + return 0; +} + +void V4L2M2MConverter::stop() +{ + for (Stream &stream : utils::reverse(streams_)) + stream.stop(); +} + +int V4L2M2MConverter::queueBuffers(FrameBuffer *input, + const std::map &outputs) +{ + unsigned int mask = 0; + int ret; + + /* + * Validate the outputs as a sanity check: at least one output is + * required, all outputs must reference a valid stream and no two + * outputs can reference the same stream. + */ + if (outputs.empty()) + return -EINVAL; + + for (auto [index, buffer] : outputs) { + if (!buffer) + return -EINVAL; + if (index >= streams_.size()) + return -EINVAL; + if (mask & (1 << index)) + return -EINVAL; + + mask |= 1 << index; + } + + /* Queue the input and output buffers to all the streams. */ + for (auto [index, buffer] : outputs) { + ret = streams_[index].queueBuffers(input, buffer); + if (ret < 0) + return ret; + } + + /* + * Add the input buffer to the queue, with the number of streams as a + * reference count. Completion of the input buffer will be signalled by + * the stream that releases the last reference. + */ + queue_.emplace(std::piecewise_construct, + std::forward_as_tuple(input), + std::forward_as_tuple(outputs.size())); + + return 0; +} + +REGISTER_CONVERTER("v4l2_m2m", V4L2M2MConverter, "pxp") + +} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index a261d4b4..b12c8401 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -14,6 +14,7 @@ libcamera_sources = files([ 'control_serializer.cpp', 'control_validator.cpp', 'converter.cpp', + 'converter_v4l2_m2m.cpp', 'delayed_controls.cpp', 'device_enumerator.cpp', 'device_enumerator_sysfs.cpp', From patchwork Thu Sep 8 18:48:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17349 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 5B819C327F for ; Thu, 8 Sep 2022 18:49:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C855E620B1; Thu, 8 Sep 2022 20:49:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662965; bh=wF5EBF++35Sl5Dk+u90PDywpcgoPQN/maOAX/112ZB8=; 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=m9LeZi4na8mDBECF8uXKT8HmugJIzdWHwGmIJsklLlshB914DiHhQjw2qwRsqEkr1 9Lff8xwLl9yAwBvWF3Fa1Ki+XahTGzKJEaNa+0qJlNzovrXjHB9E66MRHsIKzQdxeG jMqRUOxIhQtHePkSge0AS7cP4L1VHNgljQIS2ZeKlTiRtlB05/jI8fgPycg/mabTpN f1YKqfeNEsWaHBJEMS8bH6asClFa76Fi1IwPp3SFuscZVn/etoqmc6puu1vyQDIp7/ DC0zkRsQcevlUCX6aZogES2Bu5cjqmWY9c2h194uwWt5vCmAypIzJb/EanWoZR266O xwpDc8TFu6Faw== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60040.outbound.protection.outlook.com [40.107.6.40]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C3EF620B9 for ; Thu, 8 Sep 2022 20:49:21 +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="jbkBvnvk"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TQGfJ2Ry06AuVSYKof917raJ6abAzO+TNZMty3XeC+4sGX5IKybXENJvkqlYLEAvWIfSxsSUVDoOdE6XRNXDtU3HsFDRUMtNeFO0JPV5hEHFpgwQuCjSYWNmqssyuAgvvEXfm6CZd2J/WiZrh4Ow70ngBUU5X5CJmZ9dgiEwRUUbKaw004KHx0EQA2/Cng1UxRzmquzBBn1/JIqLDGn69asWeJfHP5wV9AClhdASKP6QU2Eh45CnUBnu3GkpIRVzN8tYe+2L7sJdIsu9j1J3GMXrz2fRB0Z3uSfV10UAFyVIhvnwaqOY5cndihCGQ4ki7SekQaISGVLb0FTzskza4w== 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=NHcZzGNN1W3/NowGWn0tjFK00mRQtCxeCxAIMil8EAQ=; b=n5bIAGXBOlE3nwDZQXiil1Jk/RDxjD3MT8ba1wX8ahHV+rmWrjwtQrfc8/eMEHSY/xSU86Uf+0QrZniRj+4uvjT5UNSEt3hqhayGaMT/INJ0dvW3mkSkXCLoMYuFc/sH6ay3okXO1hE3ePYK7sXA+GiWGIrg6Jtsjcs/XBCvaOIGI0zh7LLxYZyTAtLKqDU0AvrvWQboHiiJ5vlDsNFtNjGZRzem6BgXVvocXt85+6jCL+F+o5exZ6EyLTAA+NEmBlCtbJfuGse+ewPrQqqCeqnTlJw/UhgcoR/n6gN0GKE7lBCQrxEcAABRUcCL8+axzQIN7FmijHc1O3RllwB27g== 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=NHcZzGNN1W3/NowGWn0tjFK00mRQtCxeCxAIMil8EAQ=; b=jbkBvnvk5iDfPlpAxTb7VQygZ/DfnDaqLhmwIn56rBbZnCUilI8VgDPqMeRhXT2AoO6XKiWIM1y3V1e4R+PEXuuR1Qnu18Bx+y+mK8ND16ZVNnxgUoCIbK//EhmoWUiDWMnvs30B6mv4i1v84yH0CiQNEYNYSgBJHOf3BXWm9ak= 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:19 +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:19 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:43 +0200 Message-Id: <20220908184850.1874303-8-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: cb9dc2f6-0951-4e5b-e0d0-08da91cad6af 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: iwzWZK/D/AzMN5ciiHzjYOH2JaFVXv8U+9ztdlVP5e73szPabyO8UdVxLCzIvkcF3fNHgRtenOVCRm+qVDgsqI+HnNcYPqGVO6Zh+fHGO1TsgpmNqe7usuIQalaZj3gV57v+TmmmLx71QbKocGzkMoou3ntdigxgUW8DbD4I3q6VXStcDFYl8HW18oGhmji/5jhRtB8dWYNVFUk3hDng1AnheD9NecH9V1rYtqPSzjKxfeybGXK+KvAwQDowmcOdzWZoAPiY/PpmPwomozaDBcsNTEgixzliCMiYxcjA5c7uTAapIpTSNSfyBegjh6TN+9d4ON4wm4UNBLPyFE9BNr7ZyvtrXWqrVFZNyrxcnLbEjcU1muYQDqc416PtQSXktz/9fVOlschaPI2E1cfu5CkoWlGwXVAHba3ajcirpSwl7MO9999oE6DWcFi19Wd18UrKJnLojrA/3if69yyY5O7esaHA6xqf8DVJFirdTngZ5iARdjGyMgnSiPgH2dqNjWaVJuBgdLcSRSRBZNK5eHPlplFlrtPqcJTWjAlzzl0NkGdsaTKpqdVbvj1EQHKV57l5R2Q5ccLD/oOyoYl7Pq+kKIndmIDxIH5bCuPnczm6xJuEb2xf5yxm6xGDgcd3cEP9YBnKFPNFi3+WEG/0Na8OhPxyQfMdgnjA+VC/yjiq8NoD1EGGkAFZ1GkJN9TA2t/jOeLP4ARSc8XXzsFiBw== 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)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +S2UL0Tc6njXWw/Jmq6FitVQT4EHzs/NTF7U5SjBRggLr7USDDq9xBAghVx3nSUg/fYP1ELbrj3dkdfPdntJth+Zlh/ema7jiPaM5OCubmIsa4o7+Q9DsClq5qhsl8feZQ7Ch2SHbp4E9GLJhM2E11+D8dl/sdIcFNueRbZhNDZpnMVpCI7Jp7cJHMoB4YmXMo5QPaVbbwI0nrEm7PK3PIUEF8Opt+Vn+qlXA/eobkpZbTovVcImbI5+LxOYYjLAyA4h0ugzIEbYQdmAbIm+By5lN3BnHWXd8A1BKWaHjfUoJ+s/ZpDcnL24qx4I4HKVUI8YBeb8aLomUckgR6DRXmQV3yVar5To5QefhL2Tk77TjvTzn3aRYnOiHsLflzkp0ggbSAp/euC5kG2C9HYbkIglHwDybaYWOyCiJUfYuXCdyhUNqt7NLeVIteJS+0MePzQP5bTpquB9umFBwYcE1ofL0nn7q0tAt+NqPaSljwWpk4sAGsDYYP5oI2PP2p7NE7pWH3/e3j0AhkOhgH65/4FA2HndjqKSKL8o85BfDcgmtJL6LlazVEEuCSwUIob27G/yy5Bj2Z/+/z4lHIWBoGmW0XSZpamciieeT+k0XwULDx7AFnLncnAQdvB5dgOMov65Yu0CNDhRrewXyrCvFKuDUYi7x5Uv7hlrF3O8RtfeWuIhfMDFVy/nBniKLTOIlQeS5Sykf+8g2QnRUUKyW72ZowJx2c+gAurLsteyEcBbpBJIOy9MgTCkWwW4jP5uFmF3oeu40o1cnAYNQRRiuxUNNuFz76xV2FNAg97RvmD9zDhivKw98cUOn+d5oIm5zO33wv2Dnx1zKsHe4FSzT6YtHtkTOmjznq8xFgfQZXHwSX4Wsn5i39d5YV4IkaeG+bJMXVMZJqTZVfLyW1EdcSM7Mj9Fc8V5OvNZoYNZWmIkZKlJhR00U8UxogKzfnLK7yNuLs1lr961l0SumkL9BuDcxAZeBWV9DniyarwXhG1u36E03yKoEnDucED8qd94Wd/GfbiNzA6meIPsOS/j/y3bsFZBJP7gRzjSHJFEe8F4JxlHcw3ffUu5+wtGOLfvUVL37JaAljffKLCQnk1Kd9fuZ5HvOAtVfMQ21GKSobLanr3vn7caiV3b67ACaIWpYDzpYwM+ZIvFl/lEuOu6OJCSaIXDPj/TCzbzuWjUkH4/i37jhfEzduQAN2jt50uRzOyZ9gdZEvNoyvHWJl/GCWJ0/HoSaJJ9SFCkopu5ff4eDo2rKEaoAxKluEUEamaqnrHa8u8Q4h9Kx8/zx1xf9s8wos2o9g9/+wuMzHZP7TQ0AcdGueLdFJPKm/V18pr7WQVU6vvHnNZvmJXJdlF6d0hXZFxLzyNOnXjFiuc02+Ai+PH9jvs4+5YHriF5FI9OCeP3A+T7Wet6O+xUprOjy/bTcvkeXmIZKGUbCRH8FwxPibmIg8kPSpHj5h9sYfEb1ZDm/hg84QUKTqVef2PmqoAdLrotEWym/uzDW21V4nwW5prsWD0qswBaVtYGyDqh86Fbsh/L7v9j/kNU6nikanNxO2HmBziXwTYuZrB4DzFo8CvWhnB5AgiOYkE4Zv22tmqlqw2qVHIj0d1LposjWtTPP4U7xoTbxfKV/d/m+qDyryzK/DifdgJ3mrcjwzObbmNrKD7KHFCnJr5Mrxa8LQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb9dc2f6-0951-4e5b-e0d0-08da91cad6af 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:19.9024 (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: 9+hHrmW6CtxE9Pp1cs9Fvkf2N8WDRjgLSyb18V/L0oe8lCFeXxtP65evBVZJu/Ds7HjENa/qCoICJqqJPQNrkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 07/14] include: linux: Update headers for dw100/dynamic array support 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" This is merged in media_tree/master linux kernel: - 9d5c3c069805 - media: uapi: Add a control for DW100 driver - a41c4088cf43 - media: v4l: uapi: Add user control base for DW100 controls - 43cc0ec38131 - media: v4l2-ctrls: add change flag for when dimensions change Signed-off-by: Xavier Roumegue Reviewed-by: Laurent Pinchart --- include/linux/dw100.h | 14 ++++++++++++++ include/linux/v4l2-controls.h | 6 ++++++ include/linux/videodev2.h | 2 ++ 3 files changed, 22 insertions(+) create mode 100644 include/linux/dw100.h diff --git a/include/linux/dw100.h b/include/linux/dw100.h new file mode 100644 index 00000000..3356496e --- /dev/null +++ b/include/linux/dw100.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* Copyright 2022 NXP */ + +#ifndef __UAPI_DW100_H__ +#define __UAPI_DW100_H__ + +#include + +/* + * Check Documentation/userspace-api/media/drivers/dw100.rst for control details. + */ +#define V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP (V4L2_CID_USER_DW100_BASE + 1) + +#endif diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h index 9d2a8237..047f8965 100644 --- a/include/linux/v4l2-controls.h +++ b/include/linux/v4l2-controls.h @@ -229,6 +229,12 @@ enum v4l2_colorfx { */ #define V4L2_CID_USER_ISL7998X_BASE (V4L2_CID_USER_BASE + 0x1180) +/* + * The base for DW100 driver controls. + * We reserve 16 controls for this driver. + */ +#define V4L2_CID_USER_DW100_BASE (V4L2_CID_USER_BASE + 0x1190) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index bfb315d6..f502114f 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1860,6 +1860,7 @@ struct v4l2_querymenu { #define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100 #define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE 0x0200 #define V4L2_CTRL_FLAG_MODIFY_LAYOUT 0x0400 +#define V4L2_CTRL_FLAG_DYNAMIC_ARRAY 0x0800 /* Query flags, to be ORed with the control ID */ #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 @@ -2367,6 +2368,7 @@ struct v4l2_event_vsync { #define V4L2_EVENT_CTRL_CH_VALUE (1 << 0) #define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1) #define V4L2_EVENT_CTRL_CH_RANGE (1 << 2) +#define V4L2_EVENT_CTRL_CH_DIMENSIONS (1 << 3) struct v4l2_event_ctrl { __u32 changes; From patchwork Thu Sep 8 18:48:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17350 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 B965AC3272 for ; Thu, 8 Sep 2022 18:49:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BB817620DD; Thu, 8 Sep 2022 20:49:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662966; bh=HYnM7arI2BQclGbfjkjv1YMR7isLuHspx6GtdKEmdm0=; 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=GRAOQuld/rlBPIloKT3Fh2PBT6VyWCYgpCfCwgEivmRxuKWwGKUiN/6Zyxoj4ATiw g8KP9yyiufTGbfcaWWfD20QP5F7mDNl9oA2ai+sLM1zW+QZzW7cEgc8GCfqLdtScfu nz7oKo6T6cAR1oG+mEPCsPWeWnzeHsArIZ/TwZiZDycNrtaDjjGj4fiWggt1IpPzVi HS+ACqtWcMhcUjzrEORih2p42dnBpFozpVAAPKi1b1orwRBdH6gmn7Wje6JlfJrdHR oD8P62Sx2AubOZt/qwnncpDl3QY7GRpd1CMx7xhFnl3njRGcI7LrIS8+QlXq8zuXpU u8pqbTw8cQx3g== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60040.outbound.protection.outlook.com [40.107.6.40]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6DE62620BC for ; Thu, 8 Sep 2022 20:49:21 +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="PxnH/HJr"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZAYFo1GQV8X+0nxqxlHqh6K4rMX7uu6QxvWM+NUy4Mlijrpi7UVM5BFlcpILh99PcIEMIb3LWJHoK8xGOMH5MiPDZPjuBwJKBuGGD1W83wobC69dAP58y9kKjn/zCc7g9sArSip11fefOd2cLKz8T8HZi/P+KcRRrBG6FOGWlvCdRORUsI9QoUjFfiu1z6RxOnf7flyibVm0WF3MJaqN7SaUoSU2jlx+6QgmGyTKKMv3viqJyQoF1Ue+fjgJvJV1Wf6Nb5RZP7GVA3+wfmP7vUUZL33t15OrDv1NI5sm8Mkuqh1gUFEKC4BqVx+UaAdLsBV5/YEu3hQOF8+P9LXXRA== 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=39cHtImZCt/FDt7TruEu2qcr3S6tjY8TWLTpVB3KQxU=; b=EsOLGG0UZSazPMuwX8wRp5JwvizvbwNTK5XVGFbFegm7UvcSYz+1kuKYiDkBrI2hiyo79GFEBkkW/dFLBtKa3lQmu91I0wcc42shRn9f25UiTOzqL0H+9Bc0DL7s7AQVqTdRvZ9dHM05i4YjM8Ur1FlvLsHVfbBo8C5HdOvBw4+ojl0n9rij8LvxisgYriLowePdv2PU2sxqWsWpTu/raWaFTli/v8jh16zQlrIuUeEMxnLShYf2iUgfJqJHXYTJTMVf5U32eHSz30h2lMO2HG509whlP2Iua2VvmY6khJaEsOVJYRN1zgU3WL2up0SLLNw3Nfvy7RdUyxdjq8A4Og== 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=39cHtImZCt/FDt7TruEu2qcr3S6tjY8TWLTpVB3KQxU=; b=PxnH/HJr7HyNhVoaKBRhPa22Vwe9ouf9Bb1+6orefvZs63VjrQYIZPYb65OEgjcmHOtwFcTgEBavk3aMPiZl8shK75a0O3R+2uDMc9c2Pmip8R4IP5mWZakT33jBBXG89KsWtwZHLz3hi9Y/ZECFEquJFJ56C2rQH6H3UEMSVAw= 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:20 +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:20 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:44 +0200 Message-Id: <20220908184850.1874303-9-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: 3beadae5-f31d-4520-b420-08da91cad6e6 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: 93rZwSUCtu7oWw93Y4j/rrHvoYvBOokEa1pysRlvfw0yqkz5qM6dTgHcRVK0zPSQNBHaVQQ7fMHAbhCNZJB9fGh32toZjHGASZUQ7ZMm4aN8KEpz2wVHtVrNv5eGqjThxreeyYzxNs2NpGnSBJHUFo9og5Wy4C2rZkdksXhvmIsGAl+8dMvwPrOXvpctt3SuPNnVSp6r6GM5/YJoruKh7Y4otg3fxby1DuTx4otE7Mfjb4XEUxsKukCm+YMYwCvDz3wdsr/39XV/mXgU1kS59EyaLDOSOETyTvUJzE37Lye1oRMs3lQprxjAlFwxVKtf6/NDAeO1CEgzCcHrf+DeWeeO9uqNEZzSebg6/zoevHUU90Ueohw4qbrWOXORNbsgrv9BicIj94PTDEWs4Np/9hjGyRzGBVQci64It2oCGN1KUwjkwMx7PqqGFUy9liWRpX3C0KJ3FNMJAcz5EfZcK1rhOQ6eIbvJNqUY5K8wpnzG5/nClEkhh3ojuxzEOkTh1wrcRK966OkoRCQUKWjtY1IMo5yQO+Qk1luSeAUrGeLGbTifEEiwDtsh8PuIEXnG/BA/uhKqi40/mf2PdNyZHh8118kBRO3zv8bmiu2NwzqsDnfju0g2ldMFOey1UkI7PK/dgdVMTllGUCcLkAQn23gY/fCazl9nB8ng5wTeomN/qN3eDMxRl0c32s0XAnkaLPpB1YBH1vBNdJkmG0d+fg== 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)(4744005)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(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: hWahOasdBAcIQNtBRFwU0X6DDY5t7NfKD2LZAOiGQ9hdw4hoEcTpfxmoWqtGfXFw0MUWYdgKFzf5+sNZovfE7JFhFn+Yscg+zPHwDl6TD/4qpiEiRualqh/G9TWq9KirQsaveGSJINdqJxcUlUqtP2f7xQYYjPxwI4N2Wz/U7H4esTKP2qnMdrxHCCRCYpTKiZsnkNzwfeGwByj8fL5LhX8qXUU6RgAhAen5PXJMvc+oeYPfb1cEyHtNnB7SVsGgx6IwO933qANRxwlQPLGbg2xV1tg46B3EfTZQhDrUzIUSdy9sNvXU9dzCDiIGK2GbQO/n83MDKj6nELeheZ1xAadMCrKzzA/U6fs8NJz3TTunB6Uu007uk1nhI31Bz9oRmPwQnPB8mHcEVp3WRgIgxZKmUxVFEKTzwggftsPQ5wisd7c8md88rotvkZwHy9QLEbY+CnR47tb06PgdFKmVJl+7VlYQv9uEYZkUZmtkNLQs6patiJysY88She2w1aUCQYWwTmTN3H2zot+OQafcpdkjMpusDyViZrg6+IpVL6XETgdEKY3eb2FOZYAV/DyUHs7Tc9DpvkMmI/JaAZoznMd4QfYXjQw9wb/E+eel11T7NmYHpoMtQByxj6kjEO+E6sZzpakpgxMP+OHa7yX/nYc5+SH0KEt1dDVvAK2ns7X6yEwvGpZ0DkmrknNKyx0RHpaZLxikOrosRXKfP2HLcCR1D4pTrDR/kWtPHRodb5P3nuLpkO1pK4gQP3LZba2/bA9IbBCvIdxQPCptFLWMQbkjxar3W+1Yi/lf0f5mDINXTd5jDIkQ1rGb9Wn1/HFQFRp0nKZBjOHj+m/blV85OJ4GrjkHK51MwNPlfqb+5xIx+QAScCv6i8Jhimy+dDPk7U0sH0Yh49k6TQNY2qWrphRzaLTiBLfRGOjcf4kMFw7PnoHsNVVWUFEytEFI06JP+VprHdZ8zIHY5HkScxldgfrCkmPM1Hz6nU7rBZ140L5F2wP5PQ6C7JnFHJ7eXmJEoUP8yor3Vuq0eIKSbOfXKckyqpZ/Yut+JyMexB8SLXg6HbNvAr5gHVyJh6DYh6CbVRsItqhvkAH97dynHAWJ6HairvVIvkIryGI7BQJkg37k7GaFVZUO1phfyZhyAm1ehbPGE4afeCfpRpf/eUyBK55/Uyf2/BKGa5ZoiEi/PzWeMqBxSpSxxicRTG1djTePqGT5SATtqSQ3q3kwqY9KpN5kRX/a2v2ztz2Uv4uN0+Z5ehtqPY5oSuhsRLjW5J+SCE1d09hiDadfwMvQv+FOpV4C30Hq1rzXqjA0KWPmYBV9MGRJ6R/jOb2yvFakYCL4TkQq+OPitufqP1EcoepfKJOXnOkfeoWwIbuPTgJwwdjHnppBA+BOl8XjNuhqJRV3Eae2MUO85tAKp/MN1XHtuA4Qh6+FWKejchoMXW4aAaTMwNuG19S/tiJJ5DMziWPnnJF6/TMWSV5jelpbOrnz409uaR36ApFy5ZhXRSYNt97VcPpchDhknAM1svCEPJhpGAZZOCd9L1lAKFDEGD8gf1WjGpDeBpou44wS086bnOi2Te3OxOvOy/srYXMTBC4Cek2QvjpnoRldaMzlGLCRnsLM9kRS4bHk6SWFjkbqnOz+RYww3tLtyhaqPXuzwdgwaYS8GLGB/1/fktMd5PxfIQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3beadae5-f31d-4520-b420-08da91cad6e6 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:20.3242 (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: QAwb+NxsuAwBbFpM4iIZRgqhTDUXhThMzM4niRdMw+Qmiu3i4QtGhj9HABNH3UvXJeQ/vrUY3604cF65XwuWZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 08/14] libcamera: yaml_parser: Increase sentinel to 100k 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" Signed-off-by: Xavier Roumegue --- src/libcamera/yaml_parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp index d8a7c2f9..abca6903 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -676,7 +676,7 @@ int YamlParserContext::parseDictionaryOrList(YamlObject::Type type, * Add a safety counter to make sure we don't loop indefinitely in case * the YAML file is malformed. */ - for (unsigned int sentinel = 1000; sentinel; sentinel--) { + for (unsigned int sentinel = 100000; sentinel; sentinel--) { auto evt = nextEvent(); if (!evt) return -EINVAL; @@ -690,7 +690,7 @@ int YamlParserContext::parseDictionaryOrList(YamlObject::Type type, } LOG(YamlParser, Error) << "The YAML file contains a List or Dictionary" - " whose size exceeds the parser's limit (1000)"; + " whose size exceeds the parser's limit (100000)"; return -EINVAL; } From patchwork Thu Sep 8 18:48:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17351 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 6DB6AC3280 for ; Thu, 8 Sep 2022 18:49:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 304CA620D7; Thu, 8 Sep 2022 20:49:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662968; bh=VLwGBIGV3/rf3PXhQC2E7C2nenUzbwpxRWanMYMGKBY=; 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=ifbBVNj8cbK/+uqTndq3w059UadIB/cDPERoMyFfnzBOOso31VH8xGgAovo2pbesk eFQ7QxKb87YSC3zn0EPX4JR8hnkG/pEJFOtDUaJrYQVbyclRRo0wdMD9aDvltmIchY pcf7l2kUjpnaVGhqvp2/TNKKdIDGE12Mt21Em3BTqh3Uq1DTfLwMBObFQXY/wGpCUI CMzul0hYTLbTyDvMLaVIIyuk1BTsMtGpcIazB6lwrhCfak1fkdyf8jg4+WGxw4CDkV Tx0cNKZV2fljG9FQeQZiJaSeCo/6bHAVMElc+h0ylhnR1AEFO6YCH7kHMJBB1i/7Yz TYPFs+PK7tOjQ== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60070.outbound.protection.outlook.com [40.107.6.70]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FBEA620C1 for ; Thu, 8 Sep 2022 20:49:22 +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="RzrITWnQ"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nLxBwGKzvpgQGzEHpwNEEXUgsvJg9xizUSGW15G+JoUYkDO3QHbs9oEq580Y6pz7gvJmTfaLVXobAxCa7DPr0SyS3B6EQ3iSPjselGlYGYifG+de95R1M4rdLc2QcnmZFmduk8U+XUgBXOvUOTTcj/1GjJca+UIXmGFEEv9coBwPdqymy9GQpifnwEsBXdJlZT2YLGAWV1WRvlPg5reC+SFdmyjhn6zEOwgha4ihN75mWw+Ur4W4xvLR7ZBDa59eGUSDrpksfYLZaRmtJ2xUGdzx0oowQYRYGDHjaUyUilPkrH6CejXZxoCmySv2rUaqy+8mm9Oy+8iQ8pGLZpcEMw== 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=LYXpDQknnxUnTUmztLoxVgzvsHO5mzB2h16T6Di2D94=; b=OJxzvdeR489jRnDdU3Gs4x7ZtmaniTVbO3j+f6aqPBeSdCh7STsslw3DA91R0fh3YHLozjXXBd9g3M5zsp1QugPNUMZWA/kt0dyg0orB+hR+2gcLpNl7imFULE0ZOTJw+J4YMcR2Ol1fIk/72rN7T2HvtvkGK5vf2w1TsmulQFTOTKYkjCrLvoZ8XTKcPS9baM/bSpanRt/+QyQ1KLnirgKAzLUQSoxaSA9zar/pbYL/e4Eevmn66CQa3QzWM4Sf6McJ/C0AExACgyaaAPFRwICJS7Jqungfyl2Uro7lMcuVhw7sKfgGeSr3XtSxnNKn6m1xEG21e9fR4sX4S0uDOQ== 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=LYXpDQknnxUnTUmztLoxVgzvsHO5mzB2h16T6Di2D94=; b=RzrITWnQWJtdHkGZCiOnq3c551ThMjELUgr5TQMqXZxyK64E1VeUahciFKFGKZN6yG5j44Tw6unebMj89Vd5sC7Fih24Uz4v7AFxeLjX5PlIBCia08GFhYJyCJZE51s3DdWsQkFMsthWHx5LEvGu3pVceM1vvKG2Ir7XQfhxCAM= 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:20 +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:20 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:45 +0200 Message-Id: <20220908184850.1874303-10-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: f41eb887-341b-4c8d-5df1-08da91cad735 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: Nh44cFwZw7sgnbprfc1xF+cDtC4N9+iHeNJNuwHCmpfrRaOdERifcMgPbTRutdjSPI+3T0Y1F+wuRvznUWgtrSoWI/B284seq10VY2cOTO4jn/nucvZj07eF/QzVw5ZziMoDP1d8tARPFx2vDN1DCS+EZ/ZGCv5JS3EQNtXakD74zQSSk+BvKFaG6kuqNPilT4P1d8P7DYcOTXWFiFCdQHQxARZhPW0c9UPxK6iBZFaq0dVGc4DL2pVlbVheRu053zLDH8uY7i9kRYD9kDtyWA+TVnE9a0mWerHSjOwyodWdzTor5uj2GrV9fSljrqEc+oFsDln5a0UV2BKh04hijlw8n4pa8xxMZYieNIxDC3EPCg+m9zhGtCVih6Capr5FKSHXDTmiKTfcw7JTOc7997ZBz0Bv0ovejt6zpB0oXZ0hvge/fX1u9oO1G/+eBfglW0hSai/1DgZIO9g0PDevmimzXnbcmdVuo1+kCkTgKUextpoX46uyNbOABXlDdfKYg0SuHLcbHeT0zO/K8ZXkofQpZbdZYQgqzGRUAr/R9Suglcx7Sx54Tc0gUA4JOC46gGsb361frhq3t22NZe7LMcGdtfi3BgDV8ThN71kfIHM6B9mkjPT2+faXU99WSda+Xm5spTmSKXxVWwr9h3h6mB8w/Q9495l+GNcfJ32kFbhDy/kWWh1LJ2W5C2HfJkqOKoz8DdGuJoYVZH4xSB5yiA== 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)(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: 0hJZs3sG1pOW4XBW4R+tDu1qY80Gy8tT5GzFMiW1JY9i2m1ArxQFja6kO356/LH7BXHVDhLLTvvuUCaUvI0dtu5CDn0CGZeivKUtWf4upz6Wic8PQZuB5/ZU2PEKv2Fd/uUhdEJe0GyUmaZXNJypWQavIKz+GWKqvl8kUuBuKmYyQd1X8LUeRhoNUaZquFzHvTca6Zvt/av9lOD37PClsDofHgWn7Nhb2dO8rCNUeDIxM7uLOQfHWjv+y5hl+MoZBgbbnOC7It3a9Ku8dO7wUGSxwfXhqpg5zclnlcIzVzjkiTS0SKb9zW1r8W6h2tzYkCvIUhHkCcd33HmRBlbR1I8W0P4jD9PVo/Vf63RHtY5toDFbxHYi70xFIA5khhFyokvuluaW81ja00opKHw59lTGPZ4Wk6toOcDVLFxlYGnf2baaN78xm5b27ow45S6ehltCCQi8nJCzRbcWeorME2LBhAc7FwT93xM9TpmtodT7PaGhP/iK1US3uYCDZBbfuy+Zx5wZeUB4Y+XUnp3/Hm6Mk4Y1LmiGEl/7ASPu5Hcgxrq8paxmJGrCZLN40fNJUl8pmxKsZ4BmpXvMRJi5rLtSs225IqKlvAlqDAXLcLdFgc3dp5bhQQZbbHz/qt5KKHuehqIhiXJgWDYDFi0+LGBC352g+bqgnsIddSoDItspOU8n6M7X2fv2NRhfd+zC4rp+XPySRVNgRTSzST0jW3CtI5gaQSGRXbgL9r0JxWPJ8urhTi2ljqQfMvC/+KPz/GE0FK+QmxXgLxrubRCn/WVqrhB9XrzmZydJpXY0cuIL5PO0bcSPVOlr0FnMuR+cbi7dZvxn/XCJYvdnH/Ne1qS8sFI5py6q61ppJx9Imvno+S4yYZDCudfWon8E1v/kln6T4jHRU1MZ4LHjKf14kpvJjSPXdbEsOuy8Op3YF7TV/eo2s2LWtU6I3A7RUqQg5N48T7EzXaqGm/tC4kHB0JrjbFcYMfgkRMD/ppx16KbEskCkMKn+O4LO4X58f4J4dzV4hXCAYi6SC075ab9tPryL1noExduqFg0HEznMGjpMLswW7qYBvahl+LwkcSQBQQzyJ4SaWtj3lEHZkViEtYInumkSEZiksSzrXGlf0Jb/1W89829N5IbJRb2xnq4vVrxiJdO9uhkg8L4gWwFCeCRhHiC4nWvje5BpYBJvacLMW+xiCBGS5UK4hDYu8neBzwLeNwhVLEvyT/8j5YHDxVKfaBchgcM/d5MO1pRL9sD6/fvWuGNZx1xLgKsOXHm265dmloTRki2HfWKUg5RxcrsPnh0vAkT+nvVAAqP5WMroiAYTMucIIaTo4QwJMWHwRl7K2EKYVOnO9AyFZoVMoRTyvXz11bAyHauaoLdeXctWDoK3RqxRa2VSgniYdXWibENZ4/5HzBsChEmMvy/1j7KZWUY9osfMbY8SGb5Tg3Um699e7ia4j3Re85Grq3UubU4u3MP2RDgJa+HzFjTQBdgwK8ztqE7dJHBynvlExr9vbvU/VhyDBBa7kxZEKXk3ZRLlnsTiqjlIHxPEz15rglteu5zqpvw70KYwcaq0RyQdM1iTb+XybPdKRpME5BNiMr86PxuvEimr5h3hkBP4pgQfjHC70Dlxvi+X6+nH8AW5Ys2pSZ/QoHR9XTN5urQbkt1HuInR6O5jKTf1b6Y9PQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f41eb887-341b-4c8d-5df1-08da91cad735 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:20.7474 (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: Q87LNvqpK/IczLt40KhZMt5PdspR5/oD3xxx8L8nShdyK6ij8wfToxdgyvTdYrC2bDYi1xG1D+zkpQTT2I/ZdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 09/14] libcamera: converter: Introduce dw100 converter 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" Add converter support for the Vivante DW100 Dewarp Processor IP core found on i.MX8MP SoC. The processor core applies a programmable geometrical transformation on input images to correct distorsion introduced by lenses. The transformation function is exposed as a grid map with 16x16 pixel macroblocks indexed using X, Y vertex coordinates. A set of input/output vertices mapping can be loaded at runtime through a configuration file. If no mapping is loaded, the vertices mapping fallbacks to an identity transformation. Scaling and pixel format conversion can be used independently of the vertices remapping. Signed-off-by: Xavier Roumegue --- include/libcamera/internal/converter_dw100.h | 25 +++++++++++++++ include/libcamera/internal/meson.build | 1 + src/libcamera/converter_dw100.cpp | 32 ++++++++++++++++++++ src/libcamera/meson.build | 1 + 4 files changed, 59 insertions(+) create mode 100644 include/libcamera/internal/converter_dw100.h create mode 100644 src/libcamera/converter_dw100.cpp diff --git a/include/libcamera/internal/converter_dw100.h b/include/libcamera/internal/converter_dw100.h new file mode 100644 index 00000000..1972d6a2 --- /dev/null +++ b/include/libcamera/internal/converter_dw100.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright 2022 NXP + * + * converter_dw100.h - V4l2 M2M dw100 format converter interface + */ + +#pragma once + +#include + +#include "libcamera/internal/converter_v4l2_m2m.h" +#include "libcamera/internal/media_device.h" + +namespace libcamera { + +class DW100Converter : public V4L2M2MConverter +{ +public: + DW100Converter(MediaDevice *media) + : V4L2M2MConverter(media){}; + virtual int applyMapping(Stream *stream, Mapping &mapping) override; +}; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 132de5ef..c2dd094f 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -20,6 +20,7 @@ libcamera_internal_headers = files([ 'control_serializer.h', 'control_validator.h', 'converter.h', + 'converter_dw100.h', 'converter_v4l2_m2m.h', 'delayed_controls.h', 'device_enumerator.h', diff --git a/src/libcamera/converter_dw100.cpp b/src/libcamera/converter_dw100.cpp new file mode 100644 index 00000000..b079fb37 --- /dev/null +++ b/src/libcamera/converter_dw100.cpp @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright 2022 NXP + * + * converter_dw100.cpp - V4L2 M2M dw100 format converter + */ + +#include "libcamera/internal/converter_dw100.h" + +#include + +#include + +#include "libcamera/internal/v4l2_videodevice.h" + +namespace libcamera { + +LOG_DECLARE_CATEGORY(Converter) + +int DW100Converter::applyMapping(Stream *stream, Mapping &mapping) +{ + ControlList ctrls; + auto value = Span(reinterpret_cast(mapping.getMapping()), mapping.getLength()); + ControlValue c(value); + ctrls.set(V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP, c); + stream->m2m_->capture()->setControls(&ctrls); + return 0; +} + +REGISTER_CONVERTER("dw100", DW100Converter) + +} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index b12c8401..83da3e5f 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -14,6 +14,7 @@ libcamera_sources = files([ 'control_serializer.cpp', 'control_validator.cpp', 'converter.cpp', + 'converter_dw100.cpp', 'converter_v4l2_m2m.cpp', 'delayed_controls.cpp', 'device_enumerator.cpp', From patchwork Thu Sep 8 18:48:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17352 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 0EBE6C327E for ; Thu, 8 Sep 2022 18:49:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BC3DF6203B; Thu, 8 Sep 2022 20:49:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662968; bh=bXFTFLYPc8xs5W+ZTXlG2P+wmN/hywT2knH1TyhTrqU=; 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=ZmehGSnJZyAPbV/BzrmWqpa/XXpf9hy8x2CcteyCVUrCRBfmQQnNZB2u5xW7Gz7SV pJYfPb8ilgFj4GKfNor4yJVonSKpUYevO3LEEhy6n8YAtdIgBNss48KEJjc87hCfkc MOw3pvxySXbHgGsx0t2XO0F9RZPCEgtd4+kIHWMgArAgroYunw/56DwXX1xurdDMmv kz7R2QebH/GwNMZGW/0Vo9Jk+LipzkhNRw75CqCyWESu4SUVdXSKBv8nSpb/p1QyU6 ty0LejIdcw4WZz5gQraliAymlcGMbL7PAGUOP/xsZFGSEPra5P3bm6QixJaFGo4bLo 6v7O33/njK8rA== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60070.outbound.protection.outlook.com [40.107.6.70]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 68695620AF for ; Thu, 8 Sep 2022 20:49:22 +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="XjK67miQ"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NQQCbsgmUGUYApkPU8QjEzy9/NcmMwd/gmeNk4lrioHZ7fjHTFhqArZ4xwZRJR2tpM8/qiu1Vnr9/SvFTVtHltmIJvK1fjkzCsvv2yNEOkt+3g1z5puDF8xmmU/i7wZi8f3vxUZWXs+Bkt2Rr4AKauaug7sLKrhG0gkCpDanCQNvTfvhx7y9TcxlgHTjPSR20HZVP6KePXvzJHVw0XGB9RBuvvxnbFyZzSBDKnAkV+vf6nuhX4Jy9Y0W6Pv4a6AAG8XlTyvYc1ZpdebkAR67o6BHF+FMi3tQ3taIXwlRCINKt4MITVUwvflEmeBl1k442MPie2bkTwUrnFWbqRsxJw== 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=yQKjXSBzqXyIduGILBjaZsOGxtx3tljw1EuJ+wiPwdM=; b=HU2aGOdX16HvrhAWANWHiK2QDx8dwPK6H43nVxzZYbRC2cOHMVWts9DUxT46vcKFlqy4r98FR2Z1axszfOHzEDWRjZEKLWFqvs1xDBLFdwJo6XIsO9ND0oprJ0m6T83C2mbeT4C/U8zZyEr3rom65O8ZkNpIxCu/CNhP+rNCr0tKLXrvxLRl+/4Vgu+KwXRgrKJgUQkVQXQK8RddCPKTg0/G1ob3AygG7B5msRzjt3+2/FhdR8DRnmFIxvh67YQZY/weHt/EaKz9q9HYTU+jEQliO/EKY44GVeRfhEj5D0Loh8iP/fFfO2jS0Gxr0G9ytQi6+nHuudqCeRDiyjDOaA== 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=yQKjXSBzqXyIduGILBjaZsOGxtx3tljw1EuJ+wiPwdM=; b=XjK67miQ9m94mJpXvalcrzTaTId7yN7IHrbZbouFM4AS5CEd8zbOo5DKl3HQctepzT36vP8aWCzTyMNIR7+aabpx1hN9oI3W5YRtnTlcNvGZxI25ZfJWCJKppl1nk3l4wLxMyN5T43VaC4R832mI/MzbSTSM5QkEY8gd5mlqQj0= 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:21 +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:21 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:46 +0200 Message-Id: <20220908184850.1874303-11-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: 09bf97ec-97bc-4715-de6a-08da91cad762 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: Xx2QVhosLh2G6clg3MZOs2p6MEKCBOmvXlkNgdwndVjLlyDzF7m3rKW9xpao/eXaqocBl0jm22QFsTCbs1j+2I1varn9CddfsiH6QEBnD6moE0eGGhkl+KLz8nmY3z/kjnong1cOiikiPBIZBrKcrHC17jGv4uPtD2setzxFjyiDRww8WMeCtimmXle+2TOqbbwslT7kWZoAjQ8L8Ul1IUJvFpzM0dM+T1FPjukIMH7z+SfEs7TbMPJKbExAvFRXWt/mQxvSkENOK8srxOiXfOViZgGci5BQHXfDGcjt6DlYof2fDeeJaLNzKPXbbKOEWKq/lkFOaX/2wsbYVGu99ssu3otNmlb1hmMSaSAJGhRtxDgfM4qmWoUViJ2yNjJ6sI5EldZWAOphRhJ+B/jEWHH3AmR1ZHbsXsq9A+/2+ol6RZwOQJUTLfim0ABdQ24uWLD6PSFQwsOqW6h0zsa+4aKAfPjYyVPevclv4VmNZ6AI/vKa42c31hvK9y5QbfCf0EIPFet6ca1gYsjHLKTnw3JZo3TcP6+YACj6Su9gVcJ22mfPbitWrGK6D6Fqo5Kb44su/t4yKLV0IwVd84OSNgM53aMmsygXKMhz+4PTvdd3q8XdE4Y3t8qLoYmB34+NWxGXxR1DD1AydPd6YFpFlb907a2stCIo6VZvV2RxyKAYe2cgpBrszow0WQv8PBMGVWuf37yrSHsd0mCqNqi/5gdIJPMvnYI32yThCGGShsPtgzxHnOvnLjt3WwnJF91JcjmtL2IGh6o04Zo066cQJw== 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)(30864003)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(83380400001)(6486002)(41533002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qkANBpl4bYvcqiIpUd07ydfWSV2EYj1lkXUseSQbei3KqZniy4Bpnoyreqdm2EHBTNnxvPH2CyD0Wq0gWZqgidigLcx0s1rAoZXX1YgoHuVRaosOGZOPeZ+vWZ02GYpiZHTGoCC6fVR0cfXcNaKV9oxu5Hs6y6wHsakkGIEza/6q9sRrh2ttlHMjnHH3XJp6X3QhiKOl/oz4ezOTPzA/b7t0or/1pI02c2kxx8wkE1Hcv78U9Wa3BpFkjBkeQHaRH/DsK9A94raKaMIpdKECQz9FASFBXqwRWVLajeZUfbl7fPMp5Ng5AFdxLqrddvCxSaf1wWZ5VkfEnxpW0uj3AgGFaDm2q+IVLE34IGdj5fe7mYwRkWxzxzjlbnUXYSf3kthBmyzATY4cF2Ou+KLkhHiY+Xen3orV68y11oNmeGQYbWPOuH9EenhtVovRGo4h1WiXW+sd60s62b3bax7gxRdAknzgZk5QYuSfWkEx5/oh8Va0CpPemaKVHo2t9e80D8fVaKSQIPNr1t6T74EPaMxmBhfx9OcEkcmCyr1SBvPJpAcxznF+QHYBvam1Z1VsnvMTwPjF4041R2yWlNj2FrIuWNo/9q5fdKTWzjwXMKLXbK1Hk7x/w7QBHxkW/vZTrbwmoj6Ql1DsvXE3F19nHYqvTQKJwtX7bvpJa6vnJL/b9PUL9UVSdagVQ67nxvcKL5xFW2Y5/jlii8S7vjwRr6C1v2R8nheAYtNXxkw3Xp2gJIIMVXALZfJtGFGt0hd0QlF5AASHD4RO0SeshG9hIw0xLcK5paS5UiZIQKM8FLDvpSQGRIWm+9gitJlCpAdIQ/wQYMTeKPkbZRqfr26erAjruCBg6TcVWSpnHNmjxQZm/PiN/Q8jN21UUyshD6Ac1G+ZMIn9j/NNCZbYrwWCBPsrpaahyq8HDXFl1PBTQIPmuXxY6QkdmED+kK+6gM3V59dYo5kbzJEKFICyJj+PW/pbBiXSzE4c2l6PlR1lvrX0KyVSWxWDkL/NvK08JOS15oEZR7TJzOFWl3AAsT4cvWLT9nIc36gMeWzBfV5kg0zkmwGXX3bH62LEW54PqjLnLfKQup1Fgb+QibvRCA6QaObqFzXSTADOhWeaYmQ0qJHKXtE27wnyJILJbLe5fwMkzHW5pyq9M3nxeWIuODx35eqHoApmKFyAqFGBvp1K+L708JtaB4UEAvUi5hqH0OyDxOQBHTEkVVCAmmKminRCCkwiUCBwjyF8ckfYLk/hvQFN84eitMV4dzxXhYqgGLmpCml6QGGVqinuS4JsrFZYiHTfuKdJMRMuK46DisNq5yeeNGFCzZ85jQFpWyKyW9f48A5ch+3dxRyJjaQcsTFDu4QnH7E7SF4DyjsJ8iQIv+BQPggMqVtIFZ/sFZ8yZveNWaUhBIGQeAPl/RocyFD7IEJ1Ltmb68DxAjvtfjXZEl9GFcTjg/nZgZ178tmoWC1IrcA7GnUBC6eoeuTHCmiyFGyayox+kn3px+eT5PaXiK6a5CX3M+izDmWcNeZCijZFYV1Wkf0kDZ6jkMnxpRmX0tSR4AUTpjdInyxCOWHQh924KcGYRNHdxlG4u/0w8zcQMy18yxJUS7FoxU4truQokcD2sxi0GBX55PE9dZFG4Z0PN65+OglSFMk18XdpJdYs0pmp6qOcuMe+ij2Da7rtwQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09bf97ec-97bc-4715-de6a-08da91cad762 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:21.0910 (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: Xi6pKiyQnAY2TRc/2PdZ9jmq1ZglA/sBiZ8oHetA7Yktwli+lqGoUoiDMggOhtjRwJiw+AlfcxLdtzyLDwTo5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 10/14] libcamera: pipeline: simple: converter: Use generic converter interface 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" Signed-off-by: Xavier Roumegue --- src/libcamera/pipeline/simple/converter.cpp | 405 -------------------- src/libcamera/pipeline/simple/converter.h | 98 ----- src/libcamera/pipeline/simple/meson.build | 1 - src/libcamera/pipeline/simple/simple.cpp | 6 +- 4 files changed, 3 insertions(+), 507 deletions(-) delete mode 100644 src/libcamera/pipeline/simple/converter.cpp delete mode 100644 src/libcamera/pipeline/simple/converter.h diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp deleted file mode 100644 index acaaa64c..00000000 --- a/src/libcamera/pipeline/simple/converter.cpp +++ /dev/null @@ -1,405 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2020, Laurent Pinchart - * - * converter.cpp - Format converter for simple pipeline handler - */ - -#include "converter.h" - -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include "libcamera/internal/media_device.h" -#include "libcamera/internal/v4l2_videodevice.h" - -namespace libcamera { - -LOG_DECLARE_CATEGORY(SimplePipeline) - -/* ----------------------------------------------------------------------------- - * SimpleConverter::Stream - */ - -SimpleConverter::Stream::Stream(SimpleConverter *converter, unsigned int index) - : converter_(converter), index_(index) -{ - m2m_ = std::make_unique(converter->deviceNode_); - - m2m_->output()->bufferReady.connect(this, &Stream::outputBufferReady); - m2m_->capture()->bufferReady.connect(this, &Stream::captureBufferReady); - - int ret = m2m_->open(); - if (ret < 0) - m2m_.reset(); -} - -int SimpleConverter::Stream::configure(const StreamConfiguration &inputCfg, - const StreamConfiguration &outputCfg) -{ - V4L2PixelFormat videoFormat = - m2m_->output()->toV4L2PixelFormat(inputCfg.pixelFormat); - - V4L2DeviceFormat format; - format.fourcc = videoFormat; - format.size = inputCfg.size; - format.planesCount = 1; - format.planes[0].bpl = inputCfg.stride; - - int ret = m2m_->output()->setFormat(&format); - if (ret < 0) { - LOG(SimplePipeline, Error) - << "Failed to set input format: " << strerror(-ret); - return ret; - } - - if (format.fourcc != videoFormat || format.size != inputCfg.size || - format.planes[0].bpl != inputCfg.stride) { - LOG(SimplePipeline, Error) - << "Input format not supported (requested " - << inputCfg.size << "-" << videoFormat - << ", got " << format << ")"; - return -EINVAL; - } - - /* Set the pixel format and size on the output. */ - videoFormat = m2m_->capture()->toV4L2PixelFormat(outputCfg.pixelFormat); - format = {}; - format.fourcc = videoFormat; - format.size = outputCfg.size; - - ret = m2m_->capture()->setFormat(&format); - if (ret < 0) { - LOG(SimplePipeline, Error) - << "Failed to set output format: " << strerror(-ret); - return ret; - } - - if (format.fourcc != videoFormat || format.size != outputCfg.size) { - LOG(SimplePipeline, Error) - << "Output format not supported"; - return -EINVAL; - } - - inputBufferCount_ = inputCfg.bufferCount; - outputBufferCount_ = outputCfg.bufferCount; - - return 0; -} - -int SimpleConverter::Stream::exportBuffers(unsigned int count, - std::vector> *buffers) -{ - return m2m_->capture()->exportBuffers(count, buffers); -} - -int SimpleConverter::Stream::start() -{ - int ret = m2m_->output()->importBuffers(inputBufferCount_); - if (ret < 0) - return ret; - - ret = m2m_->capture()->importBuffers(outputBufferCount_); - if (ret < 0) { - stop(); - return ret; - } - - ret = m2m_->output()->streamOn(); - if (ret < 0) { - stop(); - return ret; - } - - ret = m2m_->capture()->streamOn(); - if (ret < 0) { - stop(); - return ret; - } - - return 0; -} - -void SimpleConverter::Stream::stop() -{ - m2m_->capture()->streamOff(); - m2m_->output()->streamOff(); - m2m_->capture()->releaseBuffers(); - m2m_->output()->releaseBuffers(); -} - -int SimpleConverter::Stream::queueBuffers(FrameBuffer *input, - FrameBuffer *output) -{ - int ret = m2m_->output()->queueBuffer(input); - if (ret < 0) - return ret; - - ret = m2m_->capture()->queueBuffer(output); - if (ret < 0) - return ret; - - return 0; -} - -std::string SimpleConverter::Stream::logPrefix() const -{ - return "stream" + std::to_string(index_); -} - -void SimpleConverter::Stream::outputBufferReady(FrameBuffer *buffer) -{ - auto it = converter_->queue_.find(buffer); - if (it == converter_->queue_.end()) - return; - - if (!--it->second) { - converter_->inputBufferReady.emit(buffer); - converter_->queue_.erase(it); - } -} - -void SimpleConverter::Stream::captureBufferReady(FrameBuffer *buffer) -{ - converter_->outputBufferReady.emit(buffer); -} - -/* ----------------------------------------------------------------------------- - * SimpleConverter - */ - -SimpleConverter::SimpleConverter(MediaDevice *media) -{ - /* - * Locate the video node. There's no need to validate the pipeline - * further, the caller guarantees that this is a V4L2 mem2mem device. - */ - const std::vector &entities = media->entities(); - auto it = std::find_if(entities.begin(), entities.end(), - [](MediaEntity *entity) { - return entity->function() == MEDIA_ENT_F_IO_V4L; - }); - if (it == entities.end()) - return; - - deviceNode_ = (*it)->deviceNode(); - - m2m_ = std::make_unique(deviceNode_); - int ret = m2m_->open(); - if (ret < 0) { - m2m_.reset(); - return; - } -} - -std::vector SimpleConverter::formats(PixelFormat input) -{ - if (!m2m_) - return {}; - - /* - * Set the format on the input side (V4L2 output) of the converter to - * enumerate the conversion capabilities on its output (V4L2 capture). - */ - V4L2DeviceFormat v4l2Format; - v4l2Format.fourcc = m2m_->output()->toV4L2PixelFormat(input); - v4l2Format.size = { 1, 1 }; - - int ret = m2m_->output()->setFormat(&v4l2Format); - if (ret < 0) { - LOG(SimplePipeline, Error) - << "Failed to set format: " << strerror(-ret); - return {}; - } - - if (v4l2Format.fourcc != m2m_->output()->toV4L2PixelFormat(input)) { - LOG(SimplePipeline, Debug) - << "Input format " << input << " not supported."; - return {}; - } - - std::vector pixelFormats; - - for (const auto &format : m2m_->capture()->formats()) { - PixelFormat pixelFormat = format.first.toPixelFormat(); - if (pixelFormat) - pixelFormats.push_back(pixelFormat); - } - - return pixelFormats; -} - -SizeRange SimpleConverter::sizes(const Size &input) -{ - if (!m2m_) - return {}; - - /* - * Set the size on the input side (V4L2 output) of the converter to - * enumerate the scaling capabilities on its output (V4L2 capture). - */ - V4L2DeviceFormat format; - format.fourcc = V4L2PixelFormat(); - format.size = input; - - int ret = m2m_->output()->setFormat(&format); - if (ret < 0) { - LOG(SimplePipeline, Error) - << "Failed to set format: " << strerror(-ret); - return {}; - } - - SizeRange sizes; - - format.size = { 1, 1 }; - ret = m2m_->capture()->setFormat(&format); - if (ret < 0) { - LOG(SimplePipeline, Error) - << "Failed to set format: " << strerror(-ret); - return {}; - } - - sizes.min = format.size; - - format.size = { UINT_MAX, UINT_MAX }; - ret = m2m_->capture()->setFormat(&format); - if (ret < 0) { - LOG(SimplePipeline, Error) - << "Failed to set format: " << strerror(-ret); - return {}; - } - - sizes.max = format.size; - - return sizes; -} - -std::tuple -SimpleConverter::strideAndFrameSize(const PixelFormat &pixelFormat, - const Size &size) -{ - V4L2DeviceFormat format; - format.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat); - format.size = size; - - int ret = m2m_->capture()->tryFormat(&format); - if (ret < 0) - return std::make_tuple(0, 0); - - return std::make_tuple(format.planes[0].bpl, format.planes[0].size); -} - -int SimpleConverter::configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs) -{ - int ret = 0; - - streams_.clear(); - streams_.reserve(outputCfgs.size()); - - for (unsigned int i = 0; i < outputCfgs.size(); ++i) { - Stream &stream = streams_.emplace_back(this, i); - - if (!stream.isValid()) { - LOG(SimplePipeline, Error) - << "Failed to create stream " << i; - ret = -EINVAL; - break; - } - - ret = stream.configure(inputCfg, outputCfgs[i]); - if (ret < 0) - break; - } - - if (ret < 0) { - streams_.clear(); - return ret; - } - - return 0; -} - -int SimpleConverter::exportBuffers(unsigned int output, unsigned int count, - std::vector> *buffers) -{ - if (output >= streams_.size()) - return -EINVAL; - - return streams_[output].exportBuffers(count, buffers); -} - -int SimpleConverter::start() -{ - int ret; - - for (Stream &stream : streams_) { - ret = stream.start(); - if (ret < 0) { - stop(); - return ret; - } - } - - return 0; -} - -void SimpleConverter::stop() -{ - for (Stream &stream : utils::reverse(streams_)) - stream.stop(); -} - -int SimpleConverter::queueBuffers(FrameBuffer *input, - const std::map &outputs) -{ - unsigned int mask = 0; - int ret; - - /* - * Validate the outputs as a sanity check: at least one output is - * required, all outputs must reference a valid stream and no two - * outputs can reference the same stream. - */ - if (outputs.empty()) - return -EINVAL; - - for (auto [index, buffer] : outputs) { - if (!buffer) - return -EINVAL; - if (index >= streams_.size()) - return -EINVAL; - if (mask & (1 << index)) - return -EINVAL; - - mask |= 1 << index; - } - - /* Queue the input and output buffers to all the streams. */ - for (auto [index, buffer] : outputs) { - ret = streams_[index].queueBuffers(input, buffer); - if (ret < 0) - return ret; - } - - /* - * Add the input buffer to the queue, with the number of streams as a - * reference count. Completion of the input buffer will be signalled by - * the stream that releases the last reference. - */ - queue_.emplace(std::piecewise_construct, - std::forward_as_tuple(input), - std::forward_as_tuple(outputs.size())); - - return 0; -} - -} /* namespace libcamera */ diff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h deleted file mode 100644 index f0ebe2e0..00000000 --- a/src/libcamera/pipeline/simple/converter.h +++ /dev/null @@ -1,98 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2020, Laurent Pinchart - * - * converter.h - Format converter for simple pipeline handler - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -namespace libcamera { - -class FrameBuffer; -class MediaDevice; -class Size; -class SizeRange; -struct StreamConfiguration; -class V4L2M2MDevice; - -class SimpleConverter -{ -public: - SimpleConverter(MediaDevice *media); - - bool isValid() const { return m2m_ != nullptr; } - - std::vector formats(PixelFormat input); - SizeRange sizes(const Size &input); - - std::tuple - strideAndFrameSize(const PixelFormat &pixelFormat, const Size &size); - - int configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfg); - int exportBuffers(unsigned int ouput, unsigned int count, - std::vector> *buffers); - - int start(); - void stop(); - - int queueBuffers(FrameBuffer *input, - const std::map &outputs); - - Signal inputBufferReady; - Signal outputBufferReady; - -private: - class Stream : protected Loggable - { - public: - Stream(SimpleConverter *converter, unsigned int index); - - bool isValid() const { return m2m_ != nullptr; } - - int configure(const StreamConfiguration &inputCfg, - const StreamConfiguration &outputCfg); - int exportBuffers(unsigned int count, - std::vector> *buffers); - - int start(); - void stop(); - - int queueBuffers(FrameBuffer *input, FrameBuffer *output); - - protected: - std::string logPrefix() const override; - - private: - void captureBufferReady(FrameBuffer *buffer); - void outputBufferReady(FrameBuffer *buffer); - - SimpleConverter *converter_; - unsigned int index_; - std::unique_ptr m2m_; - - unsigned int inputBufferCount_; - unsigned int outputBufferCount_; - }; - - std::string deviceNode_; - std::unique_ptr m2m_; - - std::vector streams_; - std::map queue_; -}; - -} /* namespace libcamera */ diff --git a/src/libcamera/pipeline/simple/meson.build b/src/libcamera/pipeline/simple/meson.build index 9c99b32f..42b0896d 100644 --- a/src/libcamera/pipeline/simple/meson.build +++ b/src/libcamera/pipeline/simple/meson.build @@ -1,6 +1,5 @@ # SPDX-License-Identifier: CC0-1.0 libcamera_sources += files([ - 'converter.cpp', 'simple.cpp', ]) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 37b3e7ac..2507d586 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -30,13 +30,13 @@ #include "libcamera/internal/camera.h" #include "libcamera/internal/camera_sensor.h" +#include "libcamera/internal/converter.h" #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/pipeline_handler.h" #include "libcamera/internal/v4l2_subdevice.h" #include "libcamera/internal/v4l2_videodevice.h" -#include "converter.h" namespace libcamera { @@ -266,7 +266,7 @@ public: std::vector configs_; std::map> formats_; - std::unique_ptr converter_; + std::unique_ptr converter_; std::vector> converterBuffers_; bool useConverter_; std::queue> converterQueue_; @@ -492,7 +492,7 @@ int SimpleCameraData::init() /* Open the converter, if any. */ MediaDevice *converter = pipe->converter(); if (converter) { - converter_ = std::make_unique(converter); + converter_ = ConverterFactory::create(converter); if (!converter_->isValid()) { LOG(SimplePipeline, Warning) << "Failed to create converter, disabling format conversion"; From patchwork Thu Sep 8 18:48:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17353 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 B1F17C3281 for ; Thu, 8 Sep 2022 18:49:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 528FB620F2; Thu, 8 Sep 2022 20:49:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662969; bh=zxMQi4v4g4CjysDDsbUvXgz+sUkQ2yv8qTfkTT60qus=; 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=2ILXs5sqkMvyvCUUiIeoDkGBQjPR1A7vLAFM7CwZ6oiguDqu1Mz3IwbZL98UXsKhb VUBGpBG2Jt6IRUA8GDp01Wh26dMAOHJzVjlrnWW1O1WQzQIJIWPzoo+1DmPb45nwZP AdjPJNs7AmNm3/4ElOVLbK3NwUSJAxR8J3AdUnAVHke3vYi/zoq7KbCUOhhSPRwyTa ma0aTX3e635+CISzTJsiyYybV1uLM0Ptp4pbbf0v+OHqBNWn7y6LFTfsKrmCzA/rVm waTp+uVGKzKkOrVdi1pSX37pv7ShuVlLgtBCzk3vPbgIv1lF5qT4OFeLrQ/jzUTVBp jQl6Eibq4rK1A== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60070.outbound.protection.outlook.com [40.107.6.70]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8BAD26203B for ; Thu, 8 Sep 2022 20:49:22 +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="P5zWHvPb"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dryv7cGdHOzFZnGNfB/SdSJ6+o/kFxGE7E2Gb3OaMcogQOgvqzh6HAibg25C9G7EDo6JO0ggE1EY1tGfGRg0gMLKsB3E7waubKtiNLLyKI4qF6obxQVKV8nwwcPj5K3Y3APRS/UIjhvVLKpJYfNkqCLTpARKmNVgQUoYPhCg8BEoLH28fSuWmhL8tAFp+bdIqya6gmMAEoAuWZaJaPThypZH0J6s9Qx62jJt645Y/SCINbZTavm526HRzfnTHjSq2BoDhQ1lpBMiZyBs1sk3HoxOaZEVFLXWbfovcWshF+N8Hks/T7XzPQqpdK+Mt3E3AOzblWQ7Y1gui+5Rn0cARA== 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=KkIQdhOhM3D4FRD2voakI/89RJYAUkQ1GNYStx+P6HY=; b=g9P7uwsJSwjj7tP2LiO1o0MO0WqsBlewNHNS/AaFdDUySZMjGsKR1KX9M6BWT9TSvQ9CHpWiSZIR7w1xZ8kq73AKnP4Uz+CYowlm94bWDGFCNw1XAFlCHOeAHsMXjGpgGKS/rbmvqeLqe134hbZURU4uO+EzpuZg1m9tdaH+X+sPt0cOwRSzUqZYzc7G008cdSBmVx7CbX4T42WO23D13Lb04S4lqOKQ8AyIdYtJIeFJkR+zSFoUPrw04bE5uGhFf1z2Mx7phQgslFCJ/hG5kcezt8YqyNtpNpSlgh75Np3LG3n1nc9NzCkTtJMToYSx+3JNM9rUG/EEja3SoHVLmg== 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=KkIQdhOhM3D4FRD2voakI/89RJYAUkQ1GNYStx+P6HY=; b=P5zWHvPbiUGjQU3zoCcm+6JW5TPYq6v77u5A8v/1FPJeeTUTENT83F3wV2p7X9KMMR8cmNpbnMQTAt3/rTRcW9I6z9Yz5qA4mTJYrE/sUtc9s7fAfAfyBF4lgeV5AH9hKKr8L2LXTsUUQ+2ZYt/29jQ3D9pQ2gBFPBcB+GKgmng= 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:21 +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:21 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:47 +0200 Message-Id: <20220908184850.1874303-12-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: 5ae94d21-ccf8-4fcd-4de6-08da91cad797 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: rYi78KFdQYvfBomwzrh3sHQSSSXvb7lLCY4XgYdzrUbYv03C2rSJrdpS6qMB4b4663gWn2ZOwaN66H7L2vv0KdGwo3csJB1i6qoQbEywPJ+tg56TGc6iFjFYSDBzq0olV6fTqlW/JDH1pDjVAXbU4iT8AEZRgODGL0VUCqFHGYZfBZPPDKl1cVV3YlR0puUPW5AoQhzy+v47byEmN2gwn4qgRpsl5wU8QFpcjQKGFFCKJADz9+Tr4x3Fj/9Z7BDOCX8ycZftkudiRuZENK7pQbEMoYpDIj968lXTxT/4YkX0iZ7xyDZCIcdXp8X4/Q9Y+zCTMyhbClphNBiznpApuQDTwbgH044g0CWs6CCVe4N3Pupid6x7GYZ9OTawi6DjPoDCwoL/zxNrhiGkuUEIzckY/uPEMJnb5tccdCDrPD3/mGy9mUGC2ZrewJQOJw/O1mlNQE5Oaq/RwKsywLj0Zl/Cwb1iFvH9kL103EcnEy6Z3dP/rd9qI5iuo/0BdkyV4PZD0xV+tKt8vXiwmljxjVALsalEQnzC0j7HW00+oNpx2/piVBnCWsTx/6IMS1tAP1BVbYGmOdDoNe6hQ0Eui8uEUO35mxWpirAxvuPljJmAKBFbJYcKZ9AYsVIyGCNSOyN+MmJCKqoHKd+Jqw+lEbw6E5O2qv9+lapHL9b0nYNRSgnKRCgvNfMtTh8d+xoELBK7vvciDICJKDpjb5TpRg== 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)(4744005)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(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: h/yVIQWNNJMV4aVYr2z+EMYwGQ7Ol1VkUs76AvCgRFDalPQBROs4B+4WgT2OtI7OQpD04G+uf88Z7BeSNXQZoFaozXIzasAs9MTeH5FN0iL60tFqBLPA4d+g6cr6OmvcLzyh3kPEmpubiwTi0Q++MetHnSBtYKIErqvEOCpx2GC2hBjjXQd09ITmrpc+sd9bNCiAAa3+tuvIPXf2SkkIlyItc70cZB8C2d22PnkhtC7LrmLRDBg8oYQCEr0Zwg147mS/3QKmioHV+eeVi+W1OR6PiYG3o13umRwki2FCvgx+lTWrZ5MF8u7WtGqShi+ROW72qHN7tF2IUjwUcsz8/vnyH18UUNW9VJUDUXshaKf8WaRGcm+TaWOpWcUwGhWyqp1JhBgtPydxdMFrC6+txgLsRiX71EG7BMCSX2SidjIJKseWtLfDvW219cgZdAs4h6fzBH9YRp+RJABkY/Kp3OxapyBsVQCyEiOBxn8VUj9OqSDusxHS6h5q2ruPQQv9hrBif+YG8WVOxH4Ci2M6zMDrKlQZmxequJ81dSRETXmXBjGBp63fffsX+a9bYw6+Ab7SDDCYGc1m7GItjL65Sfg0LU2LfCYRewBop/CJxs765DOHAkJHsfk7dVZogyUO4LPEqtX6ienDjThsTEf6t0NfR4GVdm+nlhTVTSrTUvbgceWVwpZbM/Rckc8jntLENstwtdNiNxVyTfokEAePUIUkbL/5jHWsakYNANsruhxm5smJQ/WJOwluCjWgwmBjDT6HQ6BgRVCIHCMNemYkIOy+HiWPJ8f9dSnQ6reUfgyC1R9C6aw/tK8+KcFLa2uW9yF6M0XA3OkXI5hCJ7sXLWXNk0VTjtktIjeZL0ZgMTZYUjchXNcM5v8RzfWVDgqwaBGPWmiEPpXh8MF6fHROhcZ4wx54MivGHO3ABuq4PNl22xLGqCau1Znl5KXpLu1V918CVLwdcHyCbkGCTKR2zq8IXne+ySwpOkpXjPs6VSSF06Wi0rxm5jFRXH7X0tBpKTBkT7FyCnvCRpHfHELKS3G7fun/G9vjWSEva9rL7wQR2kavyHZFN49JjiNZ4AfCqE9XT0U1gD9t11XucdwgKLVy4cqNz+QY45+j/7UZ4fbngdWdu0uWaKW2PTqVog9FLlye5icoNEAmIdHLHHlNndkj1Txh808O081nYoV32WEIAfW/taXDFjwaGVZVjQPw4Fx2mcyux1H2abXTbmmT7SsEyIQBAmvY8Vr4Us63Ik6YF4Uzy4Rttv4MuQrsUfsI3c7JWdTe+00ixvdKqj+bA4bqJK9LPSmrFBSTjnwiT34llus0e4AweiI7LEZ0xnTaUcmDbiefP36gz+Fqw8M0Mg81UmXV774JQL5e1463Sic+P0wbwBLn5BDNVG1ap22QmolTIgMYViuYh20lKwljeVZgzSI2awiWlM23p79IHylYoCm9rmmFykFPghKMtG+52uyntAjez0ljc39QA4kB6Ynmn48BlbSdkxmQdkSKF90UYKZJ7B3oQ03iGFu5Z/030eZviqeLQHSyvg4+Cqn8GynwISS+wVOeIxya2Fplw7K9Wynyyu2mmAwZphxKf+fpsRl5zHQemtEeW3yLERvmjLUalqjMcObDzpFI1ZO65hnmLDHXl6GrxMQpLJXixufhAUaa5g7NPL+3TsUbfcJQOw== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ae94d21-ccf8-4fcd-4de6-08da91cad797 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:21.4539 (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: Dc/Kui7FFNxwE9U94hWDZJjBWLKz52EVf9QDwuoQqgioK6W9PC1Yg+GPA/HkEHTR8kVGG1ez0yU/WE2AqRZ55A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 11/14] libcamera: pipeline: simple: Add dw100 converter to mxc-isi configuration 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" Signed-off-by: Xavier Roumegue --- src/libcamera/pipeline/simple/simple.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 2507d586..a5970234 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -191,7 +191,7 @@ namespace { static const SimplePipelineInfo supportedDevices[] = { { "imx7-csi", { { "pxp", 1 } } }, - { "mxc-isi", {} }, + { "mxc-isi", { { "dw100", 1 } } }, { "qcom-camss", {} }, { "sun6i-csi", {} }, }; From patchwork Thu Sep 8 18:48:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17354 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 5F3F5C327D for ; Thu, 8 Sep 2022 18:49:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 02BEC620F6; Thu, 8 Sep 2022 20:49:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662970; bh=rmLgdn4iUD4c+bmGTBHSxUb9oFz7MeEW9myZdWo6Ws8=; 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=fPpYRZEfs/stYRMneD4ty9o3s5gEBcpSD6VVC9BVrEcArA2qfC6lnO+n5/f28YNWA dngDwoOpwsZH0Ga+4kmivRPor7ccSg82jNLSQLQ5vqaPI2dEKc2c3XhHu25MpY04hd 8MQSlfzGKLQuUJXAJTyE1a1EUa7yMf7Rje29AWSrb3WlShTQwlFGWwWtHHSuETOsaQ 3dyn1B/b9VNJaxT1ojIn4vFOtD247Qkjg/mnsrLtClkfLFJ1qzfzr2VP1PZfJNeVMV 5NnH54f56QIB6lrYa1xzlqVBpqtTXOHia2wSMvGc4Wu6SWf0a7guBf4Zbf7LqF7rcH hT4vtv/FQQy8Q== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60053.outbound.protection.outlook.com [40.107.6.53]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 29257620CA for ; Thu, 8 Sep 2022 20:49:23 +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="QHEOZEGw"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gY8Wki2a2Dl2hVDOjK6ixcyQeZmj7E4cn+iWw0v6A7IhmxvoKodbbF6vLjeePMTJ1eh9/dicHYLiu1Wfj019eGHQ3cLAQYkQt8Abe3srXEt+ywnWDrGameeaSx9XaX6suO82J3t+pcL8zJs8tBEEjXsVh0Ade9SU0U8JpGTjcPUNEN+zaL0Tok+YaAam98QtxbM2Sh0p/zKqA6/LSO4s2PgprF2MWHga1MNVBsmu0xEgkoa0qPpb7aUOqYluGkVk0k2k0tcfPHBGoFa0Y4bjTGq0CuhrnYuZiwdjiC/1WBVpdbOZPJNmur5efopU7gB1tBFovL53nvaZ7oV2WBz2GQ== 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=ZJbLeDB8vBcQlF+9hWh7JOPM/7UiPOm7k+M6Q73hYb4=; b=m1SunRiNRTMh6ye53MLTYTCWyZWxDr/CaSTqmUnIGumWbvNXD5BOwAlOh/J5R86W39TENouGe3QjGV+ZeDyuQHnDUZXoML5v89aR10z4lsZsScVXJeBebaHM+2fMnfFIWjod2ndF0BFfvkl3nypjjofK/BsOjIT5nWijVXtKujkoQd3Re/ikEcy9OZEOsK69h1KkuikZ4W4oRPPtrNn89oIEu4w0jqdLqbAjS+l2mdNCgKC4KLkl+fI/nzgrlwGa/2oezwF6nZx2NgTE5zzNdNo3gXUOUdnJEcjGu0t0B8A6wPiLgpfM2/yARYChbr7QqY2AUOQuwCWCiJEojuGYRQ== 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=ZJbLeDB8vBcQlF+9hWh7JOPM/7UiPOm7k+M6Q73hYb4=; b=QHEOZEGwEILvxlLkDMRsUDfhWo3Ly2MJa9ygj1RJ7tDTvLU8XaEgjZjOoMTlTxR09ijvo+Fcx+bFY3wAcxopGtMAaRg0dZ2o/sSopDtO47l25F1yQhhz27g4+4wthQmB2MLQxiMow/54HPoymCW0CSG+W+k+zfxE/RtPepR8NsA= 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:21 +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:22 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:48 +0200 Message-Id: <20220908184850.1874303-13-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: ad736311-d593-4b95-ea27-08da91cad7e8 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: KVJAqqRqulWX5sBUrPiRsvUvakjbIHz7NYQza/ithqt5wlQp79PEmQw/IVf863M+aKavzs8IfFii/LEf66vLWwiDgbIdc5wCfQX6B+J9VSbjRgdjqKlFQpnNdPDBs8G4FaBR01c5PKTb5MVd/eSV5Ugy3HpzNCVBQ+CZaFDEQXwubBchA3KqvCuvFW/19lsJf+cPK8HvyNkAlDXx12wrZcS29WdZIgirBvSdDNrHQ8tTeN51i19BtUg+LBbjb1xyXiEw4j491LUy1qXbfgzcTXX6QOW4shPS99EfLpcEtQy8LOUBLud/SkrQC9EAJaWo22aAiXK5l0hEiyz+ukg4Pt7jOAw6rphSCq+U/gWjLaqCV/yOyDD6OndSZcHhIYfTbj+ySGG14+MbqT1A7x0d6zOcxwSmk+3uCPfIf3Ncg4kkRCXDFChPGZIwNzeFbkc00By4uxwLGI/LIe0isrGXg//vQ/ozAYDqnbn4v/qGrkkEHJ3SPfIx8c851yc7dQlNyzZviGMZ5He9Clvyl+IYBPIcTzunUE74hc1OeRtFiY9NSclJFdQTCoCV/5JZSe/J/0p/dK7NQoj+lDlywSKuOT0D5W5bnl1zrwpFF3C8Pl7UAupt6Ggc27etCyy1kwq8WBqJVOcXNtEM4IOHZj6x5EXVwSKy39bW2DzEg33YaHS+L2fqCFzRfxTVb1XP8GOVTzho/JVdKR18UZH1LL4NTw== 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)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nMayd8jABfQyWFLPd5atZhC4E7wVn/aBeEkEVWHrN8/Hj4ambuVbXmmHRRvclFk/pvkkh/oX3yhtAb4QTscGgbegbXnUQDdvhGR7IOSKsfvXdRtHCMocONqPKNBbCoUE3KwWCA+jI4eSt06+ZZ7Voj3sby/srhAC3UTOC/KYAgshRXr0PcU/nKqM5WQuwpZtgR1/jBXpxfyzEO7BxtmzY4utgdW9ICGMJMksgO+QMgoNCLLDN1M1seZ4zAJdpofQvhewj9kVP5iG9E683kiLT3tjLih0XTYasXPq+N1D1SqFxp9T3GHmQIAZIcmi3sO2bU3YqAPSVHf3PoLxDo3z9SDB+Qh4Ckpdvnf/77HKDsK6NDmWJzHBIaigZ7FxIb0ojW4BMHjpm0kUHj34tyNUAP+eqQ8/dqflRTZB7MR+oWBvZfB8iamgQT4Ra3KoZjEUQxnVipXQeYWOXtTtoAPBIgO5gxAAkhPJ8GuuZI/XZBwREwFHuSBNfjmCGxlgPGakL1sRf11QLI/HF8chdssfjsPI33AVqHQrPcneIO91WLkDBNMLhqvJ3d+iVX9rLDJehwVIGzXwzr70fkFFI8hdgrWZDgC+0x5d4Oxu9xeitT1mLQxuhXbGTiL2yBLjMc6qmjcLv8R5fugmRNhkgyoAUHTkFMMohUmYwnusCGCpeXgExggwa3VFvEJOEn4pwm2TK+PG12aNRzEsBiflV9lF+Y5/6nE0z/4kWy++hhNyq2rOoY/ZEa1VYiYh6gkk9FetYeoGkxGCGCYOnsrZjZ69HozEIjlirlHUtCYqfqfdXorK+WXzERIU8e37C69Tod0okohc1uAcOXjIjBW39nUByyQW/vLkcTbjFTF47hwBxDDyL0ldenc1yrLxd+Uusi/IaP+T0RYUS/dVplND+sdY5SV8fGy1vQKOVKZ/8AZ8/Z3bDqnNogMP5ocMIrlUsPFj1DlQlrgJOglOeyklkD4M2sIy/zJqHfs/Z6iD/Gfra2pDD00Fd3K/WxzUAOvUpWCoB07ZMjkolY0c3xYbccCQRV/LWI18KZItr+iZ4Iy0Cf4rVX71coZLSSAJ38zuJt5uNJWVcmlMpT6MPtFuyj4hBx1KQUbCgMM08Ka/gGfdHb9mWG+aNoCWW6J5mX4O+/SD05Os+vylbUVDW5lsmi2Oa6LCAKgxW+/NchzmJxvlBeD00755h9yAwvxYJ4vYijV2axPEAgzG8ZHL62hE75JeLd49xqMfht1Mn77oMf8SDMqVpUn3Kx+OX50JdXsNhvbxXR4fmyLxHyjvjTkHap1Dg5bG5chfp2Nx0bMkW9oAFEin8H74mb7DjT2axioSGz6VqNrehJuwaLzboAQYg2dAQF5uAdVobYD/W2CRrRsnoOsJrqE+J1oPgMt5enkL3tNtcT6iqA0njkKBrSoFhJ3vF9spKWywXwO6Kt37OCCGHV3ggxxjHfWsz8h94eJ0+FroGqztpymEmRbJsVvqo95CHI4aTBDgg90KZYz3MJjxFwM3K7cV/TH0vC8jz8MCSUZBudnkQANQjyp4BeTQ7wr8X8hGfoE4XEJr8kETenA6E59i9o3ucmH4Ad7mo57m5UP4x/vZsiQq9EFfzhx1pN4YkOyC3WVNIr+yWhH9I+cwBLgED9744ssgNIWi9OYL/kCYRUl433LuaU3k7cBS7ks86g== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad736311-d593-4b95-ea27-08da91cad7e8 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:21.9382 (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: TC/QbVYT+RmV6gzCKyOEtUN05BV5/JTPI8bh4IiX0TZo3X5vJ/3ZA+hpVPrs69j537aGBVaPU13Kgs9DoxXozA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 12/14] libcamera: pipeline: simple: Load a converter configuration file (if any) 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" Signed-off-by: Xavier Roumegue --- src/libcamera/pipeline/simple/simple.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index a5970234..31d10c56 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -498,6 +498,14 @@ int SimpleCameraData::init() << "Failed to create converter, disabling format conversion"; converter_.reset(); } else { + char const *configFromEnv = utils::secure_getenv("LIBCAMERA_SIMPLE_CONVERTER_FILE"); + + if (configFromEnv && *configFromEnv != '\0') { + LOG(SimplePipeline, Debug) + << "Getting simple converter filename as " << std::string(configFromEnv); + converter_->loadConfiguration(std::string(configFromEnv)); + } + converter_->inputBufferReady.connect(this, &SimpleCameraData::converterInputDone); converter_->outputBufferReady.connect(this, &SimpleCameraData::converterOutputDone); } From patchwork Thu Sep 8 18:48:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17355 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 EA160C3282 for ; Thu, 8 Sep 2022 18:49:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A96B1620EE; Thu, 8 Sep 2022 20:49:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662970; bh=nBBTrKaYKbKVSnuwyNWWnmYMjMiwyIS2GIVgZfHEF+c=; 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=VJqVu1vG9im9HV6wC8a4iCYuBfRZozyMzcaz+CRkUYc6q9DP3osVnZkic9lwFh1m/ YxgDRhQTw1GmLNpt6Xf7h7b2yvWVJycOwf2f+Fu2lnhpc91VVtr4iAhrW8VJ+ZFG6O T2Ms8kRL5xfWy0c442iuJ2ZMFYvll5azemHaNoBskjvEnC9I8DUG5q7lZ+MsWZJg1z Wh03TApMlH3mCqOEyARQJkDSI01nrPY6BBrz6a3bK7MbnIqjlZuyMHlEmv+pbdxAJ/ BgS3jkyyGHC194rNxyWYQHc5sKSOr/kCkVmN/U9alypotUmpB8z3OWYL9sjzPUS0ZI XiV2S6wR+W2Gw== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60053.outbound.protection.outlook.com [40.107.6.53]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A010620B2 for ; Thu, 8 Sep 2022 20:49:23 +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="F0l2WaCi"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G9E1EI1gsQQn40TDwbsSYA/KhV90jFffLeP5eJFvX+UsagKsAnBwmCobnN67y28pwD4DkB5x6yjuOWDOL4cdR2PEeGnUHnbkmjDG/cSGyG79VQlyDcdaFfz+HbluXLvN8aFsmpL9YOWptWXnTMWARJcUk9lFMFiE1cu9ORcx8HwmBmPAb49eue/+6OFHP6z5q4kgpNib/LhUQ7fm03ZmVmRBy/k+voYWFJ+cpg5imxQMx1g3dWGn/GhN+ByDxnipeqSurpw5iyvqgN2YaRcYLPLOQvX401S3SBFYHwmWi4RUi6xjkx1cY4OZ/M2GJcRmzb8PAgKgrEbB5GMJBwyA/w== 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=AK/bi6rxdBbz8x6SIPHndU60DEbeSpBfsdLp6WoV1V8=; b=RgoHm8kydW/pcyn66uLZkubeU/BEJ7DPp2Z/g1f9VI6RPiaXZscMLxSSPjaeOmTXuift7j0kDFhVaDSv7gl+uDlv8ix4FwnHwwAD395W2V8pMLnu4oCU+DWPn51sQSQ/RWMYl4Hckfh8Qv5gtAbUo/6vLJPKB2gkpTKj7ecP+1a0+qezGcnUzR/726JG6BB1jYAW843jOZy26I4kLNDPcSBmR8VgTWFzM3SwCUHRGdQkQvpFzAF4FNL7dPUeEcEkNwkyDi4QQidaiW2Kt0wOVL/w4T6YiP5bjMgoqCWTlp88WzvKKHGRUPDd28144p1t3rrNVrLueSRi0wAAE4jGFw== 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=AK/bi6rxdBbz8x6SIPHndU60DEbeSpBfsdLp6WoV1V8=; b=F0l2WaCi8C9J+fMgPxSoKjFH5lcg91lUKQE488a4mXx7ma9ALFUBair29stGoeFqGFToQTE4aNbA7pr4CpiM+B7K+1Vb/HKKvyIPRoa48C30NR0TzgFDIaAlycTybLLVOr8UPWrj3Ghu4bgHtnNqEAmwQhMwn6aupyoDje0T5jU= 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:22 +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:22 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:49 +0200 Message-Id: <20220908184850.1874303-14-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: 3ae63976-5dec-476f-31e6-08da91cad816 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: Z8QbVJzTwrTbfMN738DBQf657h7Us8TNVz6JOPa7qaXQKbz3F0Xn6sSozDoHDw4q4XkMe+S+2opia+HqKDZEvE0hYt9wlvs8tXtvUYEu/VL5RqT92jIThshUHTmRUslMC1A/Ar0nbd171vDFi/6ORpMdFZKYCnsXO90jIKpUuhFXZwm3KzTdsp2+X8Qhe9H27Q4I/sByoITkIK0rFemDV3CeLqx+kaqF76JC80tlVyEzen9/wGF2hcKtTXNqGZKWXKMbL2W67C22acHVFkdg/+OsPzLrTcsCVPWxA+vddY5PofpOX4sVBUgvYgBjAjZIiSW3+DefRkljuYG3CA2UEwsIE/g5tq/J8dX+WQU60LwxkRZRpDRzeEgy0Jzq7wwIUJvYFNZVYCc04zswRI8IsdsZiyuX79eIJ2SXTXuHtXQ4qG7+DnkjPZSe9DPjXAFVbbrYTMvEObM+tBGl9U7kY0AbfSzX6ILy+hGa2OTPUHuXhP7JxVr39IDvFGo2VFZabDWsV5v/uR7FHS9ZqPb1kFJJfjVVm1dND4msikHX27B+J9jUa5WVvq6JJJBekUXXrngRUNJ63bRV2DW7SIGx6PjPj1AUX7M3lxIaLCLYcsqM5LwbcVqP7XUo1sCxEjYr16JTsZfURux1d0SGpjAU1VqoQ3GNIBxKlUubYDYBovrRrAOE3LydLfeJIwvBAW4i5cgy86uUI4JnKp9YQnCAFA== 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)(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: cJGSrcPm6D18Dmc1rzFPJJAHiuxaqQk1viIwwxXt15ElJCGGe/xnGgkC3fJuwaOp8kthxiEl6GyM+Wfb+FN64cD5nREmZCv0VPYpmCkXgUNjoi9JWFZtAwdQ6rOGeBCy+LnSWg0absXYCg+adEAKvhT4xrtgw7UNLTCBV7D+GRm2gHAImQ04TSDDRlGWXJkWwkw5vq8ctk+ukfQ7prmlqLHzN1hgOVEDl5RXuT8hVJKZ7Z6e0XLAUujDS1MNxddY75tObN08Mwz6RJaGOX+udHVT9mAUau7qqieGbCsk2UYCDvS78tkMTgL6w7LeNtR+rljPF8H/7TqKJ0Fr7nrp2Mz5qCKyDpicTuAbiV4n7j6njsCo8wecEzvyEs4le4weuaap1TNA4Wm1hPe+pKiEnP4eAIazIIwrLzBl8CLiu4rd9/faQs2gylqi6bvQXnBEs2IoDn4QB1oujC01UnJdVy6ocMbrQlH5DDa7tDpozAIDsi3MtNfU+p6Dm/j53x0IB+eJYS7weXOqopI0F9in8etMWFoAXgozMu9N+TGt1rHxYjUNbRgoM4fsoYTuIETdsm+dLetyxBX2U3jH9xYK8eqZaGiPHx4CsLyGq17Zt+o/pzlRxGLjDztZStZ7y0l5XHmEAkcYVZosdpu1wM1aFR4H+VQQ4SAo2pAMUZIT5BnfYYcWH21L17accztb1QKXzPVJXcPBPEUe3L+L9maB3NI54Wh+CD7BTxOAD+G5ioX8NVMAn86NZjL15aq8Pb9khHJS5290E+FFb9t8+aflfrqJ7bcPhVU4RGObNPdZhoKKB59Q5NbYUs9qO8GQ0iui2/jzTB7BXzW/o2JdOjsjkIOrQASvNCzzS9S0khVow4VgUqChJ82zPFYKQrHmzcWqcNt+tFBJvMkExZx1+R1Xss33fFeuX4hYn+6GyKWb3mGXDYDCUP7zkFWl/7sfm0A3QsuWVYmHEhbOaRtPxfbZhvK0ppXx4L/b3LJxm3jAQvYXNIGqzy3AHT5fPXo2TV24vrFbhjkE5250h2HQPInbUYzsyLR5zj+FK2VP+fpED4eJOaGqK00T0r0ops6j2mR/4H0evOqeW/c/s3kuOCPRx3yIkfxhUeg4sXkm/y0V4R3pvVo106X+uTOIO6n0w5gBUVJX8dksM5b4VC/+ZAHrdlcbuFf9RVLITxuta9LCCteBRJ58cHGrjNb0yIeFOTvuoOfwKBGJFKjRl4fRhHlmcMN94C7Tue8zBZ+UKSvkE8m4N7MdguxYutCZL6w/hIBrWJpPv0ZCOtyCPzxKkg+Qi9d2gvsAez2m1KdUwJJ84DCZkbLA76tut2maczkoGG7XQLLUgSkSxS0RkgZsXpQg+nXEHAaB28KSSfXGXYX86McADxMNuYpSqXDmn8KXD5jRpWZ0FNkkmCOLJ1Ce0EwXl0Omtl7H2n+VQ1JPzX0gUO1SF+XGxfE2KgiGRRFDea6m6G+CBpl00XwdUBq3zGGofHhviqINShbQzTDdarrBhK98IYvDfp3iOorezEDlciF+uVNDiso2eNmPdqPrOKDOsi6eINRAs3GSOkx7Bhh5V/WcxUPPl8/ESSNuz5+ZLzMEH4xPY05B+zMejamVE4fMLIENeQL7nHHTXgyPvSAO467sLEWJ+3PTEbptdbo+NvyO74QZ9G+RPeqi7RYHVim4cg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ae63976-5dec-476f-31e6-08da91cad816 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:22.2038 (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: 3TcaSGIDF3qa1BN55oGHfXtkBQkmUt8vx1kK0oSS34o2iIxnEVCkPW1XzwAK777khrrZsHu0eXNsbT7tOBZBDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 13/14] libcamera: pipeline: rkisp1: Factorize errors handling path on start() 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" Signed-off-by: Xavier Roumegue --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 45 +++++++++++------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 25fbf9f1..c1522ca6 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -828,59 +828,56 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL ret = data->ipa_->start(); if (ret) { - freeBuffers(camera); LOG(RkISP1, Error) << "Failed to start IPA " << camera->id(); - return ret; + goto ipa_err; } data->frame_ = 0; ret = param_->streamOn(); if (ret) { - data->ipa_->stop(); - freeBuffers(camera); LOG(RkISP1, Error) << "Failed to start parameters " << camera->id(); - return ret; + goto param_err; } ret = stat_->streamOn(); if (ret) { - param_->streamOff(); - data->ipa_->stop(); - freeBuffers(camera); LOG(RkISP1, Error) << "Failed to start statistics " << camera->id(); - return ret; + goto stat_err; } if (data->mainPath_->isEnabled()) { ret = mainPath_.start(); - if (ret) { - param_->streamOff(); - stat_->streamOff(); - data->ipa_->stop(); - freeBuffers(camera); - return ret; - } + if (ret) + goto main_err; } if (hasSelfPath_ && data->selfPath_->isEnabled()) { ret = selfPath_.start(); - if (ret) { - mainPath_.stop(); - param_->streamOff(); - stat_->streamOff(); - data->ipa_->stop(); - freeBuffers(camera); - return ret; - } + if (ret) + goto self_err; } isp_->setFrameStartEnabled(true); activeCamera_ = camera; + goto no_err; + +self_err: + if (data->mainPath_->isEnabled()) + mainPath_.stop(); +main_err: + stat_->streamOff(); +stat_err: + param_->streamOff(); +param_err: + data->ipa_->stop(); +ipa_err: + freeBuffers(camera); +no_err: return ret; } From patchwork Thu Sep 8 18:48:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17356 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 A1D43C327F for ; Thu, 8 Sep 2022 18:49:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 58795620EF; Thu, 8 Sep 2022 20:49:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662971; bh=m2ynyg7TqtczJaJAHD82Ze/daVvJ7iGwmFeJmDIk1vw=; 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=BrHZ1HPjl84FL6ls3/4OufHPWfkUkLf7BT9zfpNwavAYhGivkYilB+MDFLSryBDrK 4s0oIVl+wSYOLoGxxl8ZNOZsCXaDyeigUlm0XQY3XMdn6NBLwJhTBa/KtyRW97e/Ar Jv1wXCuKigJWuwh29trjdaC4BVNsIo0+q1939kcOKQ6KDJSn9kQrLCbf1u/aT++uU2 6X0ol07xJqhxyjGDdgxClCRHS+QNYmltU2+EWTZ9iXleyUZITj686RvYx6Fv/LKzv2 vGbN5328apDLaGrGVl0RumzPQrJjOx1oN2700rw295GIhHmNgFdBHp5dpBWn/OvaCg P8UhPiJIFc7Ig== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60060.outbound.protection.outlook.com [40.107.6.60]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4FFF9620D7 for ; Thu, 8 Sep 2022 20:49:24 +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="SceOCB9z"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KXBw07QCESiu1Ieya0wIOwDZeExXRZpn/mcSWQzuiY2ESBlxxj0n375FJwbceKFhldii8VN3hapIWzP8hhqvLvwaP3zCmCzE6sjWgvRaGKsH2+8lvEdJKPu/qB3veGwBM6burSrkWPb90ki9NKn3G3/p0z0syRYC/ggo5JXwv5ocLWqVOJxAwdVmKUsg76cgIreLwE14956Om/bojqAnPJOdCYcu9qxhmelKgF+jAGz8NJ+hdUlap3AUFy9Oc8U8hb4YKE1iRDhDlf6TGLvwBzdq+WvgGUIx6NWJ3VJWPDWS3q2p2d6L85CzQ/aq2GwWQILftmPJGfw4DUqaXt077A== 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=I0tyVzsP57ZnCFW+9pOhH2unE9htnH3rC/5FYI2a+ss=; b=ctSAn7mM+7Doh5G3TH4A3cLR6ti9EbRyQORjRriVMaPwdOhHeLapwuCeFDrZzVpO6FbG5FBSUofjGkOLmHQMljZSA0mmtnZt14wnpHIB4SD/pyGycW+9td0jIBzePY9+LMk6brxJU3DuXt4f1BRiqKdmjt6C9z8qio4rBScMx6zgNPMvtN5B+wG9uqf+uRu3skYo4jK8WpOPLPdF5DsSARwUKln4qLcja7VEJSur7338l81lSXg1v5IniEHVs+NLgTbf1d8yGn7zU+BE9FwJutGRDx+Fr9KIhdd0LDVtQRm+XtdLV+lTh1VHEIqeGxEYzT9lUvjSsdeL52aEmTgByg== 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=I0tyVzsP57ZnCFW+9pOhH2unE9htnH3rC/5FYI2a+ss=; b=SceOCB9zpltKja/o3rLVVZQPQKTg0H1Yz51J19AOk0kjAtN+Ce6p/sMxEZJSDOU7VbUOb5hKFs8hYo9tnjjqbV9ZC3ucHn5w/pYV1gFFxlcqLKFVkhAy28w89nwd5YGnyeF7lZSGu6dmmhxpMzOJ7rmh6HeUKNN/Q4kiNYEa5oI= 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:22 +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:22 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:50 +0200 Message-Id: <20220908184850.1874303-15-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> 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: 65958e69-c80f-438b-40cf-08da91cad848 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: +CotIftFeazBBQxG9dKl42Umv3StQac4kOkImFma1iiEuZivkyGYeeg0Yri7Szv1mkPybxONj9SWmSqmniw/SupwwsvjKih42XdeGTIgnKFx0bofHanK3NQs8oLHek/c4c/DfldaPFGaa049b+C+q1vQa9wfiFm+1q0hm6+vzOyTfTE88p0/3i7dNiu6HXqhlAGVvXGI+s97JRwERes8THNjyw5nA5CLYsiDpQjQUeb+HSspzjzmf5Ww9hBhKQFuAxilDx3Q/OSsvSJ68WI3oa1z6xo0Pheriim2quB/fBYPXYTF97D2SPSYL6lWqcBtJFOCna1U86/pyWnNRXiXNaThK/L+2f+HdA3QFBQpbKoMFVUEoz0m+Vkp2tc69nRgCzquVRjuZy1CWKasbBfmwHbmmUpDtWygWB8EsB467SKJ06umvX1VXfm9n8McBZDb4cSps7IKjagXtiRHYLj/H0YAQSdzavjoGrFXUf+ahLa6WlCLSPwnk9egn0SgsDeYX9CzYcLsOIBLciODJGOvA/n3crjzP3bruMEmAmINWE1P7x/vf1Z9AKvD8T/dOEDPt3tA4IqdbFEqXl/qna/3bvv9xffjQowXUNN+SsOoIIWSP9JHw0SV1IeYAlgd/eDjHseydVBjvKDZ52cuYOCtgTrZ0+8Y3G9mM/ncBTauZ4ZYqzoYd83H38YkwCphwSSH5bAVg25CPxnCOAJEWfgbIJKuK8ZkMF0jBzYeDGBuOBs580fFMZqK8n9GQQbnOfb+nDitoYK/B2shmEosLvmSMQ== 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)(30864003)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(83380400001)(6486002)(309714004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OFZU2NbpIk1qnfPMJJHbw+yLg6cFFF4fdKQ/HKEW8JXaB6t8MO5eluMYSyrMb1gPN6lmXsmNDWTPqxGrbe+yI7LhJG4Cq87WV3Kyi2WA0BcSdoEPCuqXgaBMGvmmwN/7Tgg4fsEPCGtzkczVayVipCDkF1NFdUkuV3UMxxqRclxS/OFQyVjTk4ANBOV7wpjOLteU2wjZk8LpnYWVb/HscqFMygFIuiE/8t1dpRNy8q7rdwawB7lB/HgN2wz6geaIwS847VA2WU5QYxax801y4pL1mIZfA4jhZipg2iahpVsOoMBtv2MrPw9rFS5ocqBNYynLZzxIxjRUJmZl2a3QVkrJfaWFRV4QTpf/P5rdxHxKE2C8CMgVdjJFWJtyqJvH5Vikb8r4bx0nZVld7xCmvYfM2FdQCqvcnEhFF0OP1wIZ/UBBvuM7km2YMpQdHsZWUaW0etxDW6Iijca338ROu1N/DLeQK+NKx8r0q10GkHlI+EqMURfYSqsPQrRfbU3fWKMz/VbuUbMW81xqLvJXZH0xPi47Vkd5biX10CRcWNrtVVmUkI9Kr8+naH/qTwh2/SmKW8UXcoqMvn3N6KGxpn/O6AOfrjdhBteGdfuEsGGyUVHJiL+zS2qjaUk0yfXjNOJE0dNr8Vb0e7+1sY9S4fHw90zs1jIwPA43FST9v/05JAv+1HbjvQuCyB2ggX5cEwyXJdpRSVjZFK/uKqZ8DDEsJOszHrtNqTIVeMCnfGeL51cj6rHSpnV7IxvHAUT3sbpuKOMFZiVaqQHqaskISL/cwaHpHemWwysNxBvBhGiP1dFV6Qf/LcYVJDGtFA0pDV0T41sAY+zqX0vJfAmLzzi1y2ujKCIB9khA/9OORxWUHwbD4rQhozsTSNn3hxniLLPAb4GKaEdwH3v4e+up0dkWXq3K40sNstjtgFjX9K0BckpVYfv9m+8ZeWMpkCvTWkPjNzDE7JIldZuRcNWfnFDv1WVBUMdU+3xYjR8YDG+WwSLBe3G+FNNzXcNEdU14pDPKFXb8o63Pp4TCE5OE64g3e0usWvESEKEfLXxV/V9+kpm9gbZjP6oKIa3/2+T2WkSI8/Xl87B24k9z+E2hS4zVyHwPOe4iS/Jb5V/cMUMQ3U9NP5UWiBlDcM16mUZq6nUXIRTFqf1wQ6ssie2Al3j0rrr7LMjqaZio+QFKUiGoxjy+5B/gpU4B23tXa6RMb99JHcN85/vT2XvBY0w0F+IckChWvhb7ha1wi/28zAVenZrWAy2z4aWrFij2UGTJJQaognpeVQx6C3fwkNWULEqk2x+o7+3QrPQHl5Xh2wICQn92hRpFuQhr9ruvKNBNOz8t1Vx0VSwkFUSXXSzd19lu0rn4YYIR6fC7s/vtWtwAIPsIfbR8HJfSXcZdnI0tAqLxC1I2ZoiEnXnVBcPagTt8hoKTJmzdWNeURsPKUTucz8Bn5+df4sSOwpivFgKWYtA6Q8ZaU2uAJPXa8APQMJlPIAhhknufuV2hNn3XNQe7lNN6IliU9CSpqi/I5zMNAW2Vd/goaUq52WGgv2AIOsn1LsHRovfHosdA5LTfe1d6rfpqaFhWLB51LQhrrTFAjCo4zivAFYt1ADYmP2+459WYHMOWXmsqalXJYTUCS1O6x5D/ZksJXNmPRAYt10y2pP8RFQmgYg1jkjX3dK6BNA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65958e69-c80f-438b-40cf-08da91cad848 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:22.5943 (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: 3IpoPMeeSm3gY/5ZWj81EB/7ya9lWcbVDrCHDadBxgrVN8py7tJIKkLzDFUFAIoPxgsDEFHHikiVGK1L7mjWLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 14/14] libcamera: pipeline: rkisp1: Add converter support 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" This adds a converter, if any present in the system, on each streams (self and main paths). In case a configuration file is successfully loaded, the converter use is getting compulsory, such as a dewarping map is unconditionally applied. Otherwise, the converter is only used if the stream configuration requires it. Signed-off-by: Xavier Roumegue --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 126 +++--- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 374 +++++++++++++++++- src/libcamera/pipeline/rkisp1/rkisp1_path.h | 54 ++- 3 files changed, 485 insertions(+), 69 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index c1522ca6..6bdf5a3a 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Copyright (C) 2019, Google Inc. + * Copyright 2022 NXP * * rkisp1.cpp - Pipeline handler for Rockchip ISP1 */ @@ -194,6 +195,7 @@ private: Camera *activeCamera_; const MediaPad *ispSink_; + MediaDevice *converter_; }; RkISP1Frames::RkISP1Frames(PipelineHandler *pipe) @@ -449,57 +451,44 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate() bool mainPathAvailable = true; bool selfPathAvailable = data_->selfPath_; + const std::array cameraStatus = { Valid, Adjusted }; + for (unsigned int index : order) { StreamConfiguration &cfg = config_[index]; - /* Try to match stream without adjusting configuration. */ - if (mainPathAvailable) { - StreamConfiguration tryCfg = cfg; - if (data_->mainPath_->validate(&tryCfg) == Valid) { - mainPathAvailable = false; - cfg = tryCfg; - cfg.setStream(const_cast(&data_->mainPathStream_)); - continue; - } - } + for (auto &_status : cameraStatus) { + Status pipeStatus; - if (selfPathAvailable) { - StreamConfiguration tryCfg = cfg; - if (data_->selfPath_->validate(&tryCfg) == Valid) { - selfPathAvailable = false; - cfg = tryCfg; - cfg.setStream(const_cast(&data_->selfPathStream_)); - continue; - } - } + if (mainPathAvailable) { + StreamConfiguration tryCfg = cfg; + pipeStatus = data_->mainPath_->validate(&tryCfg); - /* Try to match stream allowing adjusting configuration. */ - if (mainPathAvailable) { - StreamConfiguration tryCfg = cfg; - if (data_->mainPath_->validate(&tryCfg) == Adjusted) { - mainPathAvailable = false; - cfg = tryCfg; - cfg.setStream(const_cast(&data_->mainPathStream_)); - status = Adjusted; - continue; + if (pipeStatus == _status) { + mainPathAvailable = false; + cfg = tryCfg; + cfg.setStream(const_cast(&data_->mainPathStream_)); + status = _status; + break; + } } - } - if (selfPathAvailable) { - StreamConfiguration tryCfg = cfg; - if (data_->selfPath_->validate(&tryCfg) == Adjusted) { - selfPathAvailable = false; - cfg = tryCfg; - cfg.setStream(const_cast(&data_->selfPathStream_)); - status = Adjusted; - continue; + if (selfPathAvailable) { + StreamConfiguration tryCfg = cfg; + pipeStatus = data_->selfPath_->validate(&tryCfg); + + if (pipeStatus == _status) { + selfPathAvailable = false; + cfg = tryCfg; + cfg.setStream(const_cast(&data_->selfPathStream_)); + status = _status; + break; + } } + /* All paths rejected configuration. */ + LOG(RkISP1, Debug) << "Camera configuration not supported " + << cfg.toString(); + return Invalid; } - - /* All paths rejected configuraiton. */ - LOG(RkISP1, Debug) << "Camera configuration not supported " - << cfg.toString(); - return Invalid; } /* Select the sensor format. */ @@ -680,15 +669,21 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) std::map streamConfig; - for (const StreamConfiguration &cfg : *config) { + for (StreamConfiguration &cfg : *config) { + size_t idx = 0; + StreamConfiguration internalCfg; if (cfg.stream() == &data->mainPathStream_) { + idx = 0; ret = mainPath_.configure(cfg, format); - streamConfig[0] = IPAStream(cfg.pixelFormat, - cfg.size); + internalCfg = mainPath_.internalStream(); + streamConfig[idx] = IPAStream(internalCfg.pixelFormat, + internalCfg.size); } else if (hasSelfPath_) { + idx = 1; ret = selfPath_.configure(cfg, format); - streamConfig[1] = IPAStream(cfg.pixelFormat, - cfg.size); + internalCfg = selfPath_.internalStream(); + streamConfig[idx] = IPAStream(internalCfg.pixelFormat, + internalCfg.size); } else { return -ENODEV; } @@ -754,6 +749,20 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera) data->selfPathStream_.configuration().bufferCount, }); + if (data->mainPath_->isEnabled()) { + ret = data->mainPath_->allocateBuffers( + data->mainPathStream_.configuration().bufferCount); + if (ret < 0) + goto error; + } + + if (hasSelfPath_ && data->selfPath_->isEnabled()) { + ret = data->selfPath_->allocateBuffers( + data->selfPathStream_.configuration().bufferCount); + if (ret < 0) + goto error; + } + ret = param_->allocateBuffers(maxCount, ¶mBuffers_); if (ret < 0) goto error; @@ -813,6 +822,12 @@ int PipelineHandlerRkISP1::freeBuffers(Camera *camera) if (stat_->releaseBuffers()) LOG(RkISP1, Error) << "Failed to release stat buffers"; + if (hasSelfPath_ && data->selfPath_->isEnabled()) + data->selfPath_->releaseBuffers(); + + if (data->mainPath_->isEnabled()) + data->mainPath_->releaseBuffers(); + return 0; } @@ -1055,6 +1070,19 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator) hasSelfPath_ = !!media_->getEntityByName("rkisp1_selfpath"); + /* Seek for a converter */ + for (auto converterName : ConverterFactory::names()) { + LOG(RkISP1, Debug) + << "Trying " << converterName << " converter"; + DeviceMatch converterMatch(converterName); + converter_ = acquireMediaDevice(enumerator, converterMatch); + if (converter_) { + LOG(RkISP1, Debug) + << "Get support for " << converterName << " converter"; + break; + } + } + /* Create the V4L2 subdevices we will need. */ isp_ = V4L2Subdevice::fromEntityName(media_, "rkisp1_isp"); if (isp_->open() < 0) @@ -1086,10 +1114,10 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator) return false; /* Locate and open the ISP main and self paths. */ - if (!mainPath_.init(media_)) + if (!mainPath_.init(media_, converter_)) return false; - if (hasSelfPath_ && !selfPath_.init(media_)) + if (hasSelfPath_ && !selfPath_.init(media_, converter_)) return false; mainPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::bufferReady); diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 2d38f0fb..c19a1e69 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Copyright (C) 2020, Google Inc. + * Copyright 2022 NXP * * rkisp1path.cpp - Rockchip ISP1 path helper */ @@ -28,7 +29,46 @@ RkISP1Path::RkISP1Path(const char *name, const Span &formats, { } -bool RkISP1Path::init(MediaDevice *media) +void RkISP1Path::initConverter(MediaDevice *mediaConverter) +{ + hasConverter_ = false; + useConverter_ = false; + + if (!mediaConverter) + return; + + converter_ = ConverterFactory::create(mediaConverter); + + if (!converter_->isValid()) { + LOG(RkISP1, Warning) + << "Failed to create converter, disabling format conversion"; + converter_.reset(); + } else { + char const *configFromEnv = utils::secure_getenv("LIBCAMERA_RKISP1_CONVERTER_FILE"); + + if (configFromEnv && *configFromEnv != '\0') { + int nrMappings; + LOG(RkISP1, Debug) + << "Getting pipeline converter filename as " << std::string(configFromEnv); + nrMappings = converter_->loadConfiguration(std::string(configFromEnv)); + if (nrMappings < 0) { + LOG(RkISP1, Error) + << "Error while reading converter configuration file"; + } else { + LOG(RkISP1, Debug) + << nrMappings << " mapping(s) loaded"; + if (nrMappings > 0) + /* We want to force the converter use to apply the mapping */ + useConverter_ = true; + } + } + converter_->inputBufferReady.connect(this, &RkISP1Path::pathConverterInputDone); + converter_->outputBufferReady.connect(this, &RkISP1Path::pathConverterOutputDone); + hasConverter_ = true; + } +} + +bool RkISP1Path::init(MediaDevice *media, MediaDevice *mediaConverter) { std::string resizer = std::string("rkisp1_resizer_") + name_ + "path"; std::string video = std::string("rkisp1_") + name_ + "path"; @@ -45,10 +85,13 @@ bool RkISP1Path::init(MediaDevice *media) if (!link_) return false; + initConverter(mediaConverter); + + video_->bufferReady.connect(this, &RkISP1Path::pathBufferReady); + return true; } - -StreamConfiguration RkISP1Path::generateConfiguration(const Size &resolution) +StreamConfiguration RkISP1Path::generateNativeConfiguration(const Size &resolution) { Size maxResolution = maxResolution_.boundedToAspectRatio(resolution) .boundedTo(resolution); @@ -67,7 +110,165 @@ StreamConfiguration RkISP1Path::generateConfiguration(const Size &resolution) return cfg; } -CameraConfiguration::Status RkISP1Path::validate(StreamConfiguration *cfg) +StreamConfiguration RkISP1Path::generateConfiguration(const Size &resolution) +{ + StreamConfiguration cfg = generateNativeConfiguration(resolution); + StreamFormats formats = cfg.formats(); + std::map> fullFormats; + + for (const PixelFormat &fmt : formats.pixelformats()) { + Configuration config; + SizeRange szRange; + + config.inputFormat = fmt; + config.inputSizes = formats.range(fmt); + + if (!useConverter_) { + config.outputFormats.push_back(fmt); + config.outputSizes = config.inputSizes; + config.withConverter = false; + configs_.push_back(config); + LOG(RkISP1, Debug) + << "Pushing native format " << fmt + << " resolution range " << config.inputSizes; + fullFormats[fmt].push_back(config.inputSizes); + } + + if (hasConverter_) { + config.outputFormats = converter_->formats(config.inputFormat); + if (config.outputFormats.empty()) + continue; + szRange.max = converter_->sizes(config.inputSizes.max).max; + szRange.min = converter_->sizes(config.inputSizes.min).min; + config.outputSizes = szRange; + config.withConverter = true; + configs_.push_back(config); + for (auto &_fmt : config.outputFormats) { + fullFormats[_fmt].push_back(config.outputSizes); + LOG(RkISP1, Debug) + << "Pushing converted format " << _fmt + << " resolution range " << config.outputSizes; + } + } + } + /* + * Sort the sizes and merge any consecutive overlapping ranges. + * Imported from src/libcamera/pipeline/simple.cpp + * + * TODO: Apply policy of converter use or not.. We likely want to force + * the converter use in case there is a mapping defined in the + * configuration file if any... if so, shall we filter out resolution + * not defined in the configuration file.. or should this policy be let + * to the application + * */ + + for (auto &[format, sizes] : fullFormats) { + std::sort(sizes.begin(), sizes.end(), + [](SizeRange &a, SizeRange &b) { + return a.min < b.min; + }); + + auto cur = sizes.begin(); + auto next = cur; + + while (++next != sizes.end()) { + if (cur->max.width >= next->min.width && + cur->max.height >= next->min.height) + cur->max = next->max; + else if (++cur != next) + *cur = *next; + } + + sizes.erase(++cur, sizes.end()); + } + + StreamConfiguration fullCfg{ StreamFormats{ fullFormats } }; + fullCfg.pixelFormat = fullFormats.begin()->first; + fullCfg.size = fullFormats.begin()->second[0].max; + fullCfg.bufferCount = cfg.bufferCount; + + return fullCfg; +} + +CameraConfiguration::Status RkISP1Path::getPipeConfiguration( + StreamConfiguration &streamCfg, + const RkISP1Path::Configuration **cfg) const +{ + CameraConfiguration::Status _status = CameraConfiguration::Adjusted; + + LOG(RkISP1, Debug) + << "Looking for " + << streamCfg.pixelFormat << "/" << streamCfg.size + << " output configuration"; + /* + * Select the fallback configuration + */ + for (auto &_cfg : configs_) { + if (_cfg.withConverter == useConverter_) { + *cfg = &_cfg; + break; + } + } + + PixelFormat pixelFormat = (*cfg)->outputFormats.front(); + Size size = streamCfg.size; + size.boundTo((*cfg)->outputSizes.max); + size.expandTo((*cfg)->outputSizes.min); + + /* Unless the converter use is enforced through a loaded configuration, + * prefer a configuration without the converter if possible + */ + std::vector converterUse; + if (!useConverter_) + converterUse.push_back(false); + if (hasConverter_) + converterUse.push_back(true); + + for (auto withConverter : converterUse) { + for (auto &_cfg : configs_) { + auto &outFmts = _cfg.outputFormats; + if (withConverter != _cfg.withConverter) + continue; + + if ((std::find(outFmts.begin(), + outFmts.end(), + streamCfg.pixelFormat)) == outFmts.end()) + continue; + + *cfg = &_cfg; + pixelFormat = streamCfg.pixelFormat; + + if (_cfg.outputSizes.contains(streamCfg.size)) { + _status = CameraConfiguration::Valid; + goto done; + } + + size.boundTo((*cfg)->outputSizes.max); + size.expandTo((*cfg)->outputSizes.min); + } + } + + streamCfg.pixelFormat = pixelFormat; + streamCfg.size = size; + +done: + if ((*cfg)->withConverter) { + std::tie(streamCfg.stride, streamCfg.frameSize) = + converter_->strideAndFrameSize(streamCfg.pixelFormat, + streamCfg.size); + if (streamCfg.stride == 0) + return CameraConfiguration::Invalid; + } + + LOG(RkISP1, Debug) + << "Chosen configuration: " + << (*cfg)->inputFormat << "/" << (*cfg)->inputSizes + << " --> " << streamCfg.pixelFormat << "/" << streamCfg.size + << ((*cfg)->withConverter ? " with" : " without") << " converter"; + return _status; +} + +CameraConfiguration::Status RkISP1Path::nativeValidate(StreamConfiguration *cfg) { const StreamConfiguration reqCfg = *cfg; CameraConfiguration::Status status = CameraConfiguration::Valid; @@ -101,7 +302,39 @@ CameraConfiguration::Status RkISP1Path::validate(StreamConfiguration *cfg) return status; } -int RkISP1Path::configure(const StreamConfiguration &config, +CameraConfiguration::Status RkISP1Path::validate(StreamConfiguration *cfg) +{ + StreamConfiguration tryCfg = *cfg; + StreamConfiguration internalCfg; + const Configuration *pipeCfg; + CameraConfiguration::Status pipeStatus; + + pipeStatus = getPipeConfiguration(tryCfg, &pipeCfg); + if (pipeStatus == CameraConfiguration::Invalid) + return CameraConfiguration::Invalid; + + if (!pipeCfg->withConverter) { + tryCfg = *cfg; + pipeStatus = nativeValidate(&tryCfg); + if (pipeStatus == CameraConfiguration::Invalid) + return CameraConfiguration::Invalid; + internalCfg = tryCfg; + } else { + internalCfg = tryCfg; + internalCfg.pixelFormat = pipeCfg->inputFormat; + auto _status = nativeValidate(&internalCfg); + if (_status == CameraConfiguration::Invalid) + return CameraConfiguration::Invalid; + } + + *cfg = tryCfg; + internalStream_ = internalCfg; + pipeConfig_ = pipeCfg; + + return pipeStatus; +} + +int RkISP1Path::nativeConfigure(const StreamConfiguration &config, const V4L2SubdeviceFormat &inputFormat) { int ret; @@ -165,6 +398,117 @@ int RkISP1Path::configure(const StreamConfiguration &config, return 0; } +int RkISP1Path::configure(const StreamConfiguration &config, + const V4L2SubdeviceFormat &inputFormat) +{ + int ret; + LOG(RkISP1, Debug) + << "Configuring " << name_ << " path " + << internalStream_.pixelFormat << "/" << internalStream_.size + << " --> " << config.pixelFormat << "/" << config.size + << (pipeConfig_->withConverter ? " with" : " without") << " converter"; + + ret = nativeConfigure(internalStream_, inputFormat); + if (ret) + return ret; + + if (pipeConfig_->withConverter) { + StreamConfiguration cfg = config; + std::vector> outputCfgs; + outputCfgs.push_back(cfg); + ret = converter_->configure(internalStream_, outputCfgs); + } + + return ret; +} + +int RkISP1Path::exportBuffers(unsigned int bufferCount, + std::vector> *buffers) +{ + if (pipeConfig_->withConverter) + return converter_->exportBuffers(0, bufferCount, buffers); + else + return video_->exportBuffers(bufferCount, buffers); +} + +int RkISP1Path::allocateBuffers(unsigned int bufferCount) +{ + if (pipeConfig_->withConverter) { + int ret = video_->allocateBuffers(bufferCount, &converterBuffers_); + if (ret < 0) + return ret; + if ((unsigned int)ret != bufferCount) + LOG(RkISP1, Warning) + << "Requested " << bufferCount << " but got " << ret << " buffers"; + + for (std::unique_ptr &buffer : converterBuffers_) + availableConverterBuffers_.push(buffer.get()); + } else { + return video_->importBuffers(bufferCount); + } + + return 0; +} + +void RkISP1Path::releaseBuffers() +{ + while (!availableConverterBuffers_.empty()) + availableConverterBuffers_.pop(); + + converterBuffers_.clear(); + + video_->releaseBuffers(); +} + +void RkISP1Path::pathBufferReady(FrameBuffer *buffer) +{ + Request *request = buffer->request(); + + if (request) { + internalBufferReady_.emit(buffer); + } else { + auto iter = converterBuffersMapping_.find(buffer); + if (iter != converterBuffersMapping_.end()) { + converter_->queueBuffer(buffer, iter->second); + converterBuffersMapping_.erase(iter); + } else { + LOG(RkISP1, Error) + << "Final buffer associated to converted buffer not found on " + << name_ << " path"; + } + } +} + +void RkISP1Path::pathConverterInputDone(FrameBuffer *buffer) +{ + availableConverterBuffers_.push(buffer); +} + +void RkISP1Path::pathConverterOutputDone(FrameBuffer *buffer) +{ + internalBufferReady_.emit(buffer); +} + +int RkISP1Path::queueBuffer(FrameBuffer *buffer) +{ + FrameBuffer *_buffer; + + if (pipeConfig_->withConverter) { + if (availableConverterBuffers_.empty()) { + LOG(RkISP1, Error) + << "converter buffer underrun on " << name_ << " path"; + return -ENOMEM; + } + _buffer = availableConverterBuffers_.front(); + availableConverterBuffers_.pop(); + converterBuffersMapping_[_buffer] = buffer; + } else { + _buffer = buffer; + } + + return video_->queueBuffer(_buffer); +} + int RkISP1Path::start() { int ret; @@ -172,20 +516,23 @@ int RkISP1Path::start() if (running_) return -EBUSY; - /* \todo Make buffer count user configurable. */ - ret = video_->importBuffers(RKISP1_BUFFER_COUNT); - if (ret) - return ret; - ret = video_->streamOn(); if (ret) { LOG(RkISP1, Error) << "Failed to start " << name_ << " path"; - - video_->releaseBuffers(); return ret; } + if (pipeConfig_->withConverter) { + ret = converter_->start(); + if (ret) { + LOG(RkISP1, Error) + << "Failed to start converter on " << name_ << " path"; + stop(); + return ret; + } + } + running_ = true; return 0; @@ -199,7 +546,8 @@ void RkISP1Path::stop() if (video_->streamOff()) LOG(RkISP1, Warning) << "Failed to stop " << name_ << " path"; - video_->releaseBuffers(); + if (pipeConfig_->withConverter) + converter_->stop(); running_ = false; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h index f3f1ae39..0da3594f 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Copyright (C) 2020, Google Inc. + * Copyright 2022 NXP * * rkisp1path.h - Rockchip ISP1 path helper */ @@ -8,6 +9,7 @@ #pragma once #include +#include #include #include @@ -17,9 +19,11 @@ #include #include +#include "libcamera/internal/converter.h" #include "libcamera/internal/media_object.h" #include "libcamera/internal/v4l2_videodevice.h" + namespace libcamera { class MediaDevice; @@ -33,7 +37,7 @@ public: RkISP1Path(const char *name, const Span &formats, const Size &minResolution, const Size &maxResolution); - bool init(MediaDevice *media); + bool init(MediaDevice *media, MediaDevice *mediaConverter = nullptr); int setEnabled(bool enable) { return link_->setEnabled(enable); } bool isEnabled() const { return link_->flags() & MEDIA_LNK_FL_ENABLED; } @@ -45,18 +49,31 @@ public: const V4L2SubdeviceFormat &inputFormat); int exportBuffers(unsigned int bufferCount, - std::vector> *buffers) - { - return video_->exportBuffers(bufferCount, buffers); - } + std::vector> *buffers); + + int allocateBuffers(unsigned int bufferCount); + void releaseBuffers(); int start(); void stop(); - int queueBuffer(FrameBuffer *buffer) { return video_->queueBuffer(buffer); } - Signal &bufferReady() { return video_->bufferReady; } + int queueBuffer(FrameBuffer *buffer); + Signal &bufferReady() { return internalBufferReady_; } + + StreamConfiguration internalStream() const + { + return internalStream_; + } private: + struct Configuration { + SizeRange inputSizes; + PixelFormat inputFormat; + std::vector outputFormats; + SizeRange outputSizes; + bool withConverter; + }; + static constexpr unsigned int RKISP1_BUFFER_COUNT = 4; const char *name_; @@ -65,10 +82,33 @@ private: const Span formats_; const Size minResolution_; const Size maxResolution_; + CameraConfiguration::Status getPipeConfiguration( + StreamConfiguration &streamCfg, + const RkISP1Path::Configuration **cfg) const; + + StreamConfiguration generateNativeConfiguration(const Size &resolution); + CameraConfiguration::Status nativeValidate(StreamConfiguration *cfg); + int nativeConfigure(const StreamConfiguration &config, + const V4L2SubdeviceFormat &inputFormat); std::unique_ptr resizer_; std::unique_ptr video_; MediaLink *link_; + + void initConverter(MediaDevice *mediaConverter); + std::unique_ptr converter_; + std::vector configs_; + StreamConfiguration internalStream_; + const Configuration *pipeConfig_; + bool hasConverter_; + bool useConverter_; + Signal internalBufferReady_; + std::vector> converterBuffers_; + std::queue availableConverterBuffers_; + std::map converterBuffersMapping_; + void pathBufferReady(FrameBuffer *buffer); + void pathConverterInputDone(FrameBuffer *buffer); + void pathConverterOutputDone(FrameBuffer *buffer); }; class RkISP1MainPath : public RkISP1Path