Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 A8CA9481A83 for ; Tue, 16 Jun 2026 23:40:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781653210; cv=none; b=P1quQI9UwWlZMj7A17b7qsvipaIdjY57bvFBYq3SxZpzBZ1XyBjvenBwh0PfcyH7/RkqjSqiquB9qd4Y8i7VX4kHEAZOS9PV2FsJjpiEu7gO9kFzteLwQhMLQf1PzH71kCdc9NRsfV5wyeMdNHlvQ0qk/L/nctGBNrGDg8qJKPg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781653210; c=relaxed/simple; bh=2oVtRuJR5wLvi4drkwXbpmhGqp9pCP+15g4e/nO6WsM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m9KySVTXNoYww/GkeKrpchxukJGIB6pHAhIvOtslb+chmotVeYT2LnWPBx/u0bXHF9gl6LzlfB0IsdIbBADPEQe0jGJ7vZa+u/yBEDgdUl4U7C54XJpIKYqnTHZOqBiFIEWaOC/f9bXSouTXCNsyykZFqhp3/quLgotnhS0qdMA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=kylxHvXv; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=JbkDhaPM; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="kylxHvXv"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="JbkDhaPM" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65GLTNik198436 for ; Tue, 16 Jun 2026 23:40:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= SSBfUs5zHWsHGP8+8ujO3onLvjU61aUkgAyxvbFTMZ0=; b=kylxHvXvsQ2UHnL5 0+16lqB9Vw+vaYasPAowTafo/RbuW4V7rsPRUxj03++BgxsEPn2acx5R3XVqK+7W rTjcIeoP4Hxf8ajSjscnAY3GJmCAqAU+yYWutndqWcJ6T506yLFrbhk7esKVwKlb Ep5eR+EDXE05xKT8RARq6Uhwbm7sf7TAqtp6KzD146JzZwhAO2u88igPBYB6vREw Ut95ld4xpiLbUhVFXDXbZoHtkeHv1+t0VydzQufhVlQ121IeE5JsBVqwBJ3FX4li NWZXlyKikcjksgBISNU040HmxD3CwQm3dHkhD81jEm6fYw7Mhg0tf9oFHei8M5of dLbmcQ== Received: from mail-dl1-f70.google.com (mail-dl1-f70.google.com [74.125.82.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4eueer0cd6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 16 Jun 2026 23:40:08 +0000 (GMT) Received: by mail-dl1-f70.google.com with SMTP id a92af1059eb24-137f9301fd6so253693c88.1 for ; Tue, 16 Jun 2026 16:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781653208; x=1782258008; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SSBfUs5zHWsHGP8+8ujO3onLvjU61aUkgAyxvbFTMZ0=; b=JbkDhaPMSxBENqniszbd/zfrlhxaf96E1xpnejPpFOBBoBji+vAfwqVk15TMKv0ncs 51KQQrhIPbNuUJbOIDQVs7q+qqEv60zRChjiLS2PuJomy+kSAv1sF9u7fBTqlEpmb9zF r5qHOjqvrmh+jgl8//T+q3P80rxShhA1PFtAOuTbCuMINhtHHZRsabJTuiTKkWstTwbl IjYZxLCdKfZtN1G2AJlqMivTbpLOJYKbG2BsTIw/VbK7LAXUKBpKRDyC0Y489qLRRGre DlmHpuoZPwp3Ow0SVcuh0nz/Ht1jg5JkNXsASkEyFeByKTIk5MZFZgIYfUCPXQqQwZrF MZyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781653208; x=1782258008; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=SSBfUs5zHWsHGP8+8ujO3onLvjU61aUkgAyxvbFTMZ0=; b=QHd/bttvdESq/Ljxpxfy8rI+t8eR6X2sW0gnsn+Ig/x1e4jdG5bqKSWUHkA+CLhCsn L+C0mEnP0Hs0VId9JZCGxs+BZe5D4B6tvgnpJx/6v0InTgCKDO3RseL/beVcEMqzov9l DWoHezn0PcQS1oueGsYnOJWHz4M4XhIgoodz8gKnv9VlRuYC1WHTzs/q1ywLiH3kopwn 1TpY/6nrGqlY4g3eKk73638IyUPpfh2tTVtoD8BIeLBd0Fy/iNp9c7bcrmwOwZf+Mag9 ylcL5XsaCFscjl3fWzPTwlN7z3Y6SLGuLcWtHH3om/HuDhifG3YOwfOcDGzCPf9ImUzb 5KPw== X-Forwarded-Encrypted: i=1; AFNElJ9VrJgcHLdCmUXR082Tg6CufXky7mmpSc3/jrSLV6uJYDHcSjKDQF3WPGaTt8JWVGCAywBHbYhquecXzT2H@vger.kernel.org X-Gm-Message-State: AOJu0YyJ5jsIfBzFMPMoF+SQHK7SDRlLsRwcrwQQZW2OsbPADfnNHMsd UC/xhykcEdh1y3g1rm7KKnMgUHvhDJaESpleObH9izILK2eVPtVPx9qlCzOspcOIUUwJf1GiInF 0kL/vppAFyT1avtkSlsO6azGBmaPSp52CBt2G4bExH0RxmVaw5ZeChWfJ4qtwGFe8WTFQ X-Gm-Gg: AfdE7ckmxKVc4tjeiXCQkXiXCJp9dbA6m6BoZBfJw1ijZjyYeIeninxQ8AruwjnULQq dv42po+F5KSg8+cxog6UHNQmm1IS4rZazq+3ln0sgJiISB4Z9k9oFFbIqa9DY7FjjbZpBo9PU6H +TQa2fghRy8dafWyz+EZqRH3esRCdWqySXtR2R8PUvajROQYFMhlX2ubCnlDCebeTA2Zyf8zSv/ xAXCoQK49QcbXy3siWQJeVGJbHm5BCQ6L2QMkTGOS+2/cszJUH/xoQSGDj1/qE72Y79k+loAS1R szjShGrx6YmWQ8Ng/7lsjo/YSO3OhJOZ94eJgKErHgjRC3j3K5iKd6E3eX32prPjvPaR5vhcNxo 1Wtuw3SIXH2GEa3JADp+Kcn6QyTzQVZ11DeC1ghegVuu3yZego3nFOq4Jhg/y4KnQA7BqvRrQNz pE5Mf5zw== X-Received: by 2002:a05:7300:8bac:b0:2f3:3835:2005 with SMTP id 5a478bee46e88-30bca0740cbmr469704eec.6.1781653208286; Tue, 16 Jun 2026 16:40:08 -0700 (PDT) X-Received: by 2002:a05:7300:8bac:b0:2f3:3835:2005 with SMTP id 5a478bee46e88-30bca0740cbmr469694eec.6.1781653207718; Tue, 16 Jun 2026 16:40:07 -0700 (PDT) Received: from gu-dmadival-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30bbbd636fasm2828607eec.22.2026.06.16.16.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 16:40:07 -0700 (PDT) From: Deepa Guthyappa Madivalara Date: Tue, 16 Jun 2026 16:40:03 -0700 Subject: [PATCH 1/3] media: uapi: Introduce new control for video encoder ROI Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260616-enc_roi_enable-v1-1-fefcc4e76f33@oss.qualcomm.com> References: <20260616-enc_roi_enable-v1-0-fefcc4e76f33@oss.qualcomm.com> In-Reply-To: <20260616-enc_roi_enable-v1-0-fefcc4e76f33@oss.qualcomm.com> To: Mauro Carvalho Chehab , Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Deepa Guthyappa Madivalara X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1781653206; l=4210; i=deepa.madivalara@oss.qualcomm.com; s=20250814; h=from:subject:message-id; bh=2oVtRuJR5wLvi4drkwXbpmhGqp9pCP+15g4e/nO6WsM=; b=N8Uh7A1P8CnzpWV3lV80XN9/yPl4mPYxEFmoI6njVMzRGNJGjT3x2ldG43GyNZTjKDCc7STlJ L25rJD/8gRHCl3VjuzxMlt7OGPvNfESwxoRgbj2JmrNYVGk8C4VmUw+ X-Developer-Key: i=deepa.madivalara@oss.qualcomm.com; a=ed25519; pk=MOEXgyokievn+bgpHdS6Ixh/KQYyS90z2mqIbQ822FQ= X-Proofpoint-ORIG-GUID: 7MCZAM41l_FOwLvUeLfplfC6FfIgu3N6 X-Authority-Analysis: v=2.4 cv=Mr1iLWae c=1 sm=1 tr=0 ts=6a31ded9 cx=c_pps a=SvEPeNj+VMjHSW//kvnxuw==:117 a=ouPCq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.125,FMLib:17.12.100.49 definitions=2026-06-16_05,2026-06-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 spamscore=0 phishscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606160239 Add custom control, V4L2_CID_MPEG_VIDEO_ROI_MB_DELTA_QP for video encoder Region of Interest to allow applications to specify different quality levels for specific regions in video frames. Define V4L2_CID_MPEG_VIDEO_ROI_MB_SIZE to retrieve supported MB size based on codec from the hardware encoder and set the corresponding ROI MB delta_qp map that adjusts quantization relative to the frame QP's base value. This enables use cases like prioritizing quality for faces in video conferencing or important objects in surveillance footage while reducing bitrate for less critical areas. Signed-off-by: Deepa Guthyappa Madivalara --- Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 14 ++++++++++++++ include/media/v4l2-ctrls.h | 1 + include/uapi/linux/v4l2-controls.h | 2 ++ include/uapi/linux/videodev2.h | 3 +++ 4 files changed, 20 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index ab865a1a6ba929f1725ce2ab0fd3aeee4a69329a..1995e7335fb29611151c61561df577f2bdac7a48 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -1674,6 +1674,20 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - Codecs need to always use the specified range, rather then a HW custom range. Applicable to encoders +``V4L2_CID_MPEG_VIDEO_ROI_MB_DELTA_QP (integer)`` + This custom control is used to set ROI MB map delta_Qp for whole frame. + The frame is divided into grid with MB Size returned from querying + V4L2_CID_MPEG_VIDEO_ROI_MB_SIZE. Each block is configured with delta_Qp + in raster order. The valid range for delta_Qp is encoder dependent. + Applicable to encoders. + +``V4L2_CID_MPEG_VIDEO_ROI_MB_SIZE (integer)`` + This read-only control returns the MB Size for ROI MB delta_Qp map. + Its valid range depends on encoder supported codec format. + Example: For H.264, 16 is returned for 16x16 MB size. + For HEVC, 32 is returned for 32x32 MB size. + Depending on the size returned, delta_Qp Map is set to the encoder. + .. raw:: latex \normalsize diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 327976b14d50b73a631e4d2ed95d9f4d146c45ab..a1806ddbc797efa52e83cd3f685ef70d5b5483d2 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -64,6 +64,7 @@ union v4l2_ctrl_ptr { s32 *p_s32; s64 *p_s64; u8 *p_u8; + s8 *p_s8; u16 *p_u16; u32 *p_u32; char *p_char; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index affec0ab4781507be761cb791ff737460acf9cb7..00a2c48630bd198faa9a2b833a9aa346d8357555 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -920,6 +920,8 @@ enum v4l2_mpeg_video_av1_level { }; #define V4L2_CID_MPEG_VIDEO_AVERAGE_QP (V4L2_CID_CODEC_BASE + 657) +#define V4L2_CID_MPEG_VIDEO_ROI_MB_DELTA_QP (V4L2_CID_CODEC_BASE + 658) +#define V4L2_CID_MPEG_VIDEO_ROI_MB_SIZE (V4L2_CID_CODEC_BASE + 659) /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ #define V4L2_CID_CODEC_CX2341X_BASE (V4L2_CTRL_CLASS_CODEC | 0x1000) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index eda4492e40dc14a90a230601d8e23b0e13845d34..ce217c41c471042eb9b920532a4102a87c991d5b 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1880,6 +1880,7 @@ struct v4l2_ext_control { __s64 value64; char __user *string; __u8 __user *p_u8; + __s8 __user *p_s8; __u16 __user *p_u16; __u32 __user *p_u32; __s32 __user *p_s32; @@ -1993,6 +1994,8 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY = 0x281, V4L2_CTRL_TYPE_AV1_FRAME = 0x282, V4L2_CTRL_TYPE_AV1_FILM_GRAIN = 0x283, + + V4L2_CTRL_TYPE_S8 = 0x284, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ -- 2.34.1