From patchwork Fri Oct 18 05:44:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13841128 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2058.outbound.protection.outlook.com [40.107.22.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C0B515573F for ; Fri, 18 Oct 2024 05:45:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729230330; cv=fail; b=gpqd6qXzANXNmy3D5rMNcKUhAn/X53aW4ajVZrNsspDTVLoqPFUHKLORhrsxYiuGfhLjXdi5AcCtiRK2f8Zx9kzUfdBSopUItDlSOiXsFjgud/QfLo7TjRPGLxK7LhP8P4SIul14C2ygOqFXsbrXC4O7Rlbl8VjlY0FdPX4YnK8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729230330; c=relaxed/simple; bh=qbXapau9tfvE6yoZBqlJXHzZLJCUL9c1iPDFBhiZQmM=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=T5PNIg/Hz6BHZWS+aje6dYJzLQNhuzgsw0mhGbg7QMwD2ezZhdGukIgoSWbP2jjh9xSIMYHuqNUNkZmcvlYo22c5Cnx0dT6d07c6GCwyxCrNWnOxBnp3qgGMsIo7ABfBrDYcsPYT0yVFt313N18lOpmCoP47sER2VxKJFUmsAaI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=bEG5MK2A; arc=fail smtp.client-ip=40.107.22.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="bEG5MK2A" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zUNqLa3vwBhyoMfNKzFoYsPqYrA17G9RSGYQRRtYhJtfsotr/Vicahu7FCYKUh9ttmePA76B3z/RXOEakN4q90hosIwfOCpg1Ox0UhZ9jM+GiPfacqEwJDYSN0Hqwzu20dRypuI083u8/W57NBOC34JVMedByyYtNf4/iCtMCTTzon+mCagQLpasLqG9XsHRsG085P1EFrGfPTbreyjjL3qWcBPcnG3nB7HbCIqjQ1M8A42JyUwvO+mF7M6hzNgOst4IiJRzEgMOiqr1YxZk4umgNC9kCRR9lM/BPUYOrNLhhekkDXi+UgS1B+mQnn0cPx7QoAko8us3qpkPoAtUDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Cpnu9XE+bqCoEwreeRQxUwRJRMhigtvM+9LUk8JVkME=; b=QnC4zV/wAlpHGswcVhZ5116HtkYiABgL7SsUv3f1zm4ss3CZ5iRX1eBumSY2Q367RP0g1Mwujsq3KhMwwYIHGKzdyqzKqV8nx/nLPtA4PbNdNb3y59n6pFeuCiDTOl8ENN0ZNAQzwLQrmp8cSlMp6giaKgAqw0S4toiywQ3gG081zE6ilCPJs0iadjt7SjBN3gESYntmtpzDpjzWV6OakJmRsWKtIvCzKqaKn8yxm3H3nGRCBui7UnGDRx131Z8UiqcL3T2J/Mc4IRQJiGwZglniL4xzJDwsQdaSmjNZi4xLOxOj/bGU3hcggeGozPEgcUulZi5eqeLsRHnksYcB3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Cpnu9XE+bqCoEwreeRQxUwRJRMhigtvM+9LUk8JVkME=; b=bEG5MK2AlWnJr0DzWbUizRsnBlbJsIQAPWuYvucNyX1a1vvYYLamlTT+ZRUS+/SJJJFH6AVBfLxjb/rRwRnFqRj5X+h4vnDcP3gibrx3a7z4U/IQCpIfPhf0PxIeF2B0jmnG8H+YJaFdudcj+pHSNE1nfR+vfTzQVDUfB3DZtBx10Z09EGfeobZMyIrQuZPzm2/bZ6giH6BYCrQhuKkxv2ldGrPE2wRLDs03buTwKwiXEJS5tILy8upkya7Fb7H9MCF5RiqLlv5Pkk/PGVVxcfYt7hFiU2rjUS37c4xhwtVlIlPYgiCDy6U6PDD9iBplRrnDyakBSL+cQjcil5z3RQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) by VE1PR04MB7312.eurprd04.prod.outlook.com (2603:10a6:800:1a5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.24; Fri, 18 Oct 2024 05:45:23 +0000 Received: from PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87]) by PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87%6]) with mapi id 15.20.8069.020; Fri, 18 Oct 2024 05:45:23 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: yunkec@google.com, nicolas@ndufresne.ca, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, ming.zhou@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, ming.qian@oss.nxp.com, imx@lists.linux.dev, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC v2 0/6] Add video encoder ROI ctrls Date: Fri, 18 Oct 2024 14:44:42 +0900 Message-ID: <20241018054448.3190423-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.43.0-rc1 X-ClientProxiedBy: SI2P153CA0030.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::15) To PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8254:EE_|VE1PR04MB7312:EE_ X-MS-Office365-Filtering-Correlation-Id: ea9e302e-71a0-4f3a-4559-08dcef380f23 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|7416014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: v+3UbUJ2iCwy1uMRGgI+jNZoXv8HgDWj+QQLgTHsWqW12jE56ha+17TAh8KHhK+h8djp0kPlXNPvvasbYOBiuK3TqMLA6ieKJQ/2sEqXIm7aXS93jd6Hu+2imKuTnjLShUAp+4iZPOK/Ty2W07qNtvEzWp+Dr/SxiHnUQdtR2PH+sf41M6ucu3s2zyV+n3wQUBtGj1NczSxKteMMrKTL0f2Hx5rzikC5YWOx1zLlKHbwHtOvTW9nNslL+I7VU9OI00FgFj3rwz+/tdwMsAkrlq0os0wKY2bH27L09C/X1XQH/9S0Kba751M3vsXOVzOWZHNQrJIp1OSTgMKZJqcMmsbedXkFM08KVwjqMbrQp3vYX2r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;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8254.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(7416014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: El/BhzdeJX4AUfrkiRFj3Lf/zF1zQ1kOlVB2R7AKdA75sBrKXpH8g7gd53Fiv1cE8no0pFPvUXipP4mLylPdIT5mmVrxjEsQ99W5hZGMvlZ1cepgoTOldz4daMd74B8tntPNvqygSbg5Pq0XvOxcHTFdNnaPeeK4vZuNSZvYA697U6M18ftbCZixT24o2iMqh+lVaHIEYnVl1ZBVL+0/ESwc8/1/XjjESs+33tUMTbh0lQpnCDXwi196YgZue5cMyimeHuWEzaRRBp01NTqEZoiF0xTuy/kc4JyuaPvlzXXj+8uADdWFVMccDlTStlCaUjJreGx/YNitrTIbgOdQC9r2Q/0zKxRlXPZOgCYaD4Q0x6l88+y6NMtf0VcvxyvtmZK1jfwZ/30+bSUlwIP9y7pW5QaQy+xe4WhvGFLpqLf3I0V4W5FTxibEbyGYrP4cijRU07AoFTHAjqby4IIcxb55oM4IfiZZhNMOlnYkNHE1zMlcZhtCZRaOQuABtsPUYHgKb7UT1s8Wh2NkK9FizFjGZDtEVWPeCHDCn/OIyAbheGxOKdHEU1ndZNQoRqIcsQ14HjEQgBuRa1/sWlzfyPnQGDvlTjnWJRPsNFrbl6A7D/l3kpk/qTsr1HY/9l5RYIDS8ikcEjL7LzE4AH6+7JRWsEHUb8VnkiExgclsm2b/gfZByHlYHHxDS8uTDM3TG9Ifwi918ocUagDjkEX9h53uuCbOJjzVgMAj1OiX7NcqfR9L/Lvh+D5v1ja3VhguaI12vWHN7kaK1TY3Be3lNZhkd1jZt+yQzYG8vuVpmKNPKStl4nGl6+zV8mjhNXD8sMvTL+aiX/gKtiZ9dTxkIoNq1Sjh8KHbTp82zfOlebt29TAPYEuiPidMabXndnhDEP9N80O3Nugs1or+wT78MiHeExKpsKBLsv5JP8kvW9BXuE8FWo4NSyX1JBFZT/dPuT26mIy5zdU1l6TTYyUCqj8xGYCHhjFJFw054m+CuGnRPXwwJAXoA5FghPRdXAA2rTk7RPZjWLPpAjgTreqK436e11QhQfQbqB/ST0MLAS5pFhqpvtElNyxLMh+/Mw3zn0X0rdfi0ehYmBXoqIH3eiwNE3bEFt8AcfMekTG+brY1jYeW2kPfymj4rUlHlb8nhqkLq5fLE5aRlpuTz4q7tsNMkxI2TYNwIOqrPen0WFeTBCnrK8dupuVkJ4aquZFYvox8P/oAitkZWaT//Mu5n8/WssbfhUvKhs+gkSbpFw4nZqFIG5mqwMJkm0dT3RqAIqvEVHV5xy+toVzejj0MjJddAI7RwO3MPN4h5rYVDXAXrLwu2e1GVj5LW1t/5nLN+ZJhCk8F0fMLPc2R7+b43LC6TVeto4Ls+7lUP0vVb+cDCScj5AbnTl/9Hu+b3HIlrxOoXbL6GT4u7FggSteuD4peAp7MYjE2eDpJ/bRk/bjOKFpHpIAk/n9hY8tbQ2cd1RPkeD145WmoyOVEh8sjTSyG/wi9VHiFYE6sFtPa700i3NkzphHTowdpEcNatHjbO3WRpIeyzZJvaQfA+vsixtYDLthk8xJOjcAZDMM2h/LnFnn6LauuNgcOJYg8hFxG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea9e302e-71a0-4f3a-4559-08dcef380f23 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8254.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 05:45:23.2602 (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: sGTXV0z2z4vI+P8KeOwCTDYfQo/NaITFDWIcv1wJm96RtJmq18NtEYHKAL3cbpdao2uXRDxT0GFbLpnqUzb6Sw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7312 Hi, This patch set implements region of interest (ROI) ctrls for video encoder. One video encoder IP may support the following two ROI configurations or one of them: 1. configure ROI as a rectangular region, and set a QP offset parameter. 2. configure ROI as a QP map as an array. Each value represents the QP offset of a block in raster scan order. The block size is determined by the specific IP. To achieve this, I made the following change: 1. Add a new ctrl type V4L2_CTRL_TYPE_REGION to describe rectangular ROI 2. Define a ctrl V4L2_CID_MPEG_VIDEO_ROI_MODE to choose ROI configuration 3. Define 2 ctrl to configure ROI 4. Define a ctrl V4L2_CID_MPEG_VIDEO_ROI_MAP_BLOCK_SIZE to query block size I referred the patchset "Implement UVC v1.5 ROI" (https://lwn.net/Articles/953532/) and pick some patches from it. changelog: v2 - export symbol of v4l2_ctrl_type_op_minimum - export symbol of v4l2_ctrl_type_op_maximum Hans Verkuil (1): media: v4l2-ctrls: add support for V4L2_CTRL_WHICH_MIN/MAX_VAL Ming Qian (3): media: v4l2-ctrls: Add V4L2_CTRL_TYPE_REGION media: v4l2-ctrls: Add video roi ctrls media: vivid: Add a video region ctrl Yunke Cao (2): media: v4l2_ctrl: Add V4L2_CTRL_TYPE_RECT media: vivid: Add an rectangle control .../media/v4l/ext-ctrls-codec.rst | 73 +++++++ .../media/v4l/vidioc-g-ext-ctrls.rst | 30 ++- .../media/v4l/vidioc-queryctrl.rst | 26 +++ .../media/videodev2.h.rst.exceptions | 5 + drivers/media/i2c/imx214.c | 4 +- .../media/platform/qcom/venus/venc_ctrls.c | 9 +- .../media/test-drivers/vivid/vivid-ctrls.c | 62 ++++++ drivers/media/v4l2-core/v4l2-ctrls-api.c | 54 +++++- drivers/media/v4l2-core/v4l2-ctrls-core.c | 181 +++++++++++++++--- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 29 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 4 +- include/media/v4l2-ctrls.h | 64 ++++++- include/uapi/linux/v4l2-controls.h | 11 ++ include/uapi/linux/videodev2.h | 13 ++ 14 files changed, 516 insertions(+), 49 deletions(-)