From patchwork Thu Oct 17 09:19:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 836467 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2085.outbound.protection.outlook.com [40.107.21.85]) (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 844F41D88C1; Thu, 17 Oct 2024 09:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729156832; cv=fail; b=Ixpf/2/AHF+eSY90Og0W+h+xfNoruv/YdET0YiRfjdm2lzZulrgz9DQvMgKMhB1MlzxqObOfAkvTsDwLiIYKpXdnFh/xB7eUfLJTpaTNlefqOo5qDuG8wltRfE6KBuinmPMsUZtRIOExC8qT3JlbHgHtylxoUT8EgYz/GpPiI9c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729156832; c=relaxed/simple; bh=OwHg3/UZCzgbyyiaAKK3bqe5pwBMN5g48UyN5wOBBeg=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=M0NZ4jvy0Xl0HFYH9KRuz/yYIhL1r/ubL08AhtY1GfAhhnb1+n6IXoWsLgQEbRq0fVJO6sqi/WZhjTmfwMgsHT8sWm8HzWDV/fy9x5DH2a66FR12Am5CAw6jCPXcLJWXVQmcZfXyo3cZZnXHOzHS8WPayQmaEzhuADugq5nfnFk= 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=kSQZvu/B; arc=fail smtp.client-ip=40.107.21.85 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="kSQZvu/B" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BxzksVtiCS3JTt3r/hDRi3VN729uHDc2LHAB2EfrsFooKd0Kl2QD2wCVtwpwVlx6HY26UdJz8zkdYdr5Qzh3lRzIBZYwZs7/ChY7DxxZ6TOKVEHxR6nOyKgXO7o6z6Cist6EjrKCFdnDUET/75ZnvEpvHCocqh/hCJe7ZA/3WPsx88sQqbOkxSlStlx/FyESQbxV3pMz7UbSCYcP6F7lLPaMB9TepBjGNxksZY8ySaYKZQ3EbNllQvLNmuFSJiU3aRY8EFMdl/0f9u9i8eEVqlgaFbbb/kD3j6hmsu11KEL6dz+uhaM6zrpl43EOxQsSm9VyRjaLuhi2y7p+d6LDyg== 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=zmkZgoAx9zA747yjfUmc/dHmMnNEttNF5njw/2ggEts=; b=i7OY2lCi8SRTao9zI2sfoyKef7QD0KreBxSyEmd+Ml72rmxPwZDGNYciTnes5WnZQCsyJTB6Xn6MmsQqYOky0W1PAcxJjQxNEJg5wzu+YIwVmxfqvW1tUhIOBP4b8vTnkvQnzX+4lpC2x124P97X1on7RWtiEuda7ynXVnigkkNVuG3NIS0Jkjyb9dVwJh8y6dZl8Wof6t2/ONfR5nbSBUFAVgH5sOZ1r8zI2Q7vYjZxydTPdS8FrB7gNNxa5hAiZ6ciDuq1QSNu7+tkTU/sk4840uU1dmUqq8+k/4P5NJAuR3KToDfN3AW05v03Qp+6tysJX5BRjp7IZcaw+6P9wg== 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=zmkZgoAx9zA747yjfUmc/dHmMnNEttNF5njw/2ggEts=; b=kSQZvu/Bm2s1sn8YMQlzT/r5dQwsWkboCwOOPapRU2tEQcHyovUPEe7BSQHWlssP7Mo2q/PLPvgu6yxBIoQX+86LN8j0CVWZz0qqGJcTgdgZmU0YdgRxJIxUiU3rH6+N9IefaLSjSFVN4ZC480Q70JMbtvGNhhk/XexOBeuov/KLf1VurSlaxZjlKCg1C4L8DxT2jk5bVp3+qbVlkOBIroTNTA4i0h9axFyRW0QdTQX9ZOI2p2CjZyGQ5YNpP5Er/9ic+3D4nP3qZX6hNim5FKAC26Z8t87+I3h/mkelSt3z8G7221+ToTczAOcXW14FjUtczbjnDA17PH+ryLNMtw== 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 AS8PR04MB9061.eurprd04.prod.outlook.com (2603:10a6:20b:444::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 17 Oct 2024 09:20:26 +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.016; Thu, 17 Oct 2024 09:20:26 +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, 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 0/6] Add video encoder ROI ctrls Date: Thu, 17 Oct 2024 18:19:45 +0900 Message-ID: <20241017091951.2160314-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.43.0-rc1 X-ClientProxiedBy: SG2PR02CA0129.apcprd02.prod.outlook.com (2603:1096:4:188::19) To PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8254:EE_|AS8PR04MB9061:EE_ X-MS-Office365-Filtering-Correlation-Id: f46d1043-aca3-4196-5770-08dcee8cef48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: VfZqhDBjZMgn2hQ8/z4L7zCHION0LmTFvxcVPe7w82dGu8w5397rp5U4iKixExtvTMeB5/brMDNPnxIIdlORl/rn5wkb8hgTobJvBG5jTXXs1IxyGo3A3ICAqGLZ6VIM5el9KSOzsIOHqRw9OyCl6QAMxqADt0iYUoomS1YPbn76DD0A817aSTRgH1jUyysdgbUxA80YcUJMk7koD5VcV3RnWTYnA72AbfAfeWRifTe7Y9n/50DjXHg9TuSqeA1PeMNvpRDm6hlf/3C6TskRLoydvlTtWuSSu6zHJ9CIPYWnTs0LIyF16I8FHr/cLeBz2z1IWSozwjhzAp285WTZoEzpijCDc4IipxatzbdHBqKdqohb3DLWH6OUwNuBU0wBl3/RvxR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:NLI; SFV:NSPM; H:PAXPR04MB8254.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(7416014)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fdN3reFMHEaBZuUpADR2tzHB+2FaUW8qPLPBlXVzb984wWPDdMg4OOjgEv9AaBvN3EvUZpEuXOov0G4dSOXrJt0WyZ+24oXVPeRsnKAqgQ3usnGOP+Kak5e4LbEoLvsJfFpt5wMDQEsR5X1wDdS+/QXkWOD/0PsnG1c8IlbzxXHfd0pXLcYgoXvblUCat+na/dnud6EFXutUB6qmcpBSzk8BZar6tk00x+pEabFiyFCAAtxWneoTBTYcvvagwAMUYsoka52q9k25VJ5KoM1Z9+lxWmNkAsF1JmhcJcZ+gtqMv4lONT4Ed5dBPIfJXxJvoN2QCtMjXUiOWs98gl+gq8+zD6RFF9vUox6Ttn8tA5WoQQINwblYwjTwwIeWBJnd6R0Jr3izk0rHhuq6mK0fwLtZVCPWWavAKJuu7AcL5o64AxJXrozP/JHp6dwTV5gXG9aLcExPlI2dXYQCRVp9A7kiw++v7O8bDArj8puOUGPp5+MAxInnjVDEHTV62if8pDGs7yfCqo0VamVUBGFUOCSUYom7xnIq/p7CHCxaKFdw51uVsZCOgTaCcVua7GYk+Pzsi7SGNhgPjYXoKQCpkKn2S88pQ7MlY7j47HqvzXsS9YYPfKLvgSCskCC9N2qofodOEpcPeE5S+5wUf+EzFdPz0LvCFWDklWB8DjT00TW3lZx0bJqDSAxCtfOEDIowFcUXb5YF4uM3JyRPi/AJ16a6dL0NwhQDEqzSyE4fb7BXNICTh+OzGjBgS27ITNDkoHDAtfBWAv5zJrU2WZshceypNJc5WfeJ7xyQ9/69Hthlto98YkcweR5iC1YdoNfnQQttyEjL2gJU5BlJJgJ8cGrb49ifr3+WSjTW5HE263MYUM9+8EtFxQPrzBqufMcmYLl9YVdxG/34CKnV6Gd/e8Q1GZ61KxAFLhvdSW2xNnvXjjn3DWyyT3SMsn5qy1usQevZIkQ9KwLY7JvEeVtXvD8GmKtOOV5JY53KrVuCmqvEbj9CxIGABFF9gUZvYFdGwAiziC3YPYJCb8JSg7KsD7I0F299TCS983lGAQUKZZkTaycxR3ZGdbu61Fflw+Z4B6gngmvkFsoFFZzGJg08VXMmhpdbixN9Fbmm9SLk8pqunNG7wJlzdcNys3v9hD9iN5sHZiiSIZbAbXnr9p2BNwCPtBSAJWC+KodnBSvr75z4x/h3ht1sVczyQyCZEUbN6ggeiQgmw3nHj4spN1BAKtcKQiPJ7sOmDDdWvxhDEp1ktz0OpBmvWHjoDcKk9ArRHjVbrm7aKc+Z4CHWoRuw7ynAWTjaO0Sab/iAfxzWHRQcXkbJ7n/SnXjb7MRTEhsyBAHEzpZNdStw16p6sZtuALpKT9p/ePlRcfFTQ0CxzlKSraYM1SmKWw2fhd6dAeFD41lSoZpb13U1fww+dxP69Y9TAWn7Y8+aDOdueNQjV/1vDUojDSBCnHoF+BcOvi9q2oEy/Tja7vaMdRhMtJ0FyIPhcFXnH+JfK8Ir8ol8EoUQzsUknTatHxye318LMNDOrgEap2k6Cw0UL0zPqfxImAkz0aodLO2oOnqGw9ZDQBo5BrLzS35S9Zf8bbkJeoiC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f46d1043-aca3-4196-5770-08dcee8cef48 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8254.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 09:20:25.8877 (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: MkX6OQgUhLHbMnJ2A95AzVY8R85fbjS0AaET2a7HQbKEzh6UVY0b1IGN0Xq9i4WFjes3lv8pn/g+N/DA0ybabg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9061 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. Hans Verkuil (1): 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 | 179 +++++++++++++++--- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 29 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 4 +- include/media/v4l2-ctrls.h | 40 +++- include/uapi/linux/v4l2-controls.h | 10 + include/uapi/linux/videodev2.h | 13 ++ 14 files changed, 490 insertions(+), 48 deletions(-)