From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 84897481ABD for ; Tue, 16 Jun 2026 23:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781653211; cv=none; b=BZLeqmyBSjRLGpqjsxTHqrEQZi5ss4Nvm91IL1B4PqUUnXWB6eW3FFL9wX05kjeajfVyGYMccNauVftu5/6mo9fTyr1Q8LX2q97qUIUfUw5l2xTw8biqa00XVwjRU0amWntEJlPcgv1TX/YuIiRJ1p5G4C9YoMT8wAJOz0qsI0s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781653211; c=relaxed/simple; bh=2oVtRuJR5wLvi4drkwXbpmhGqp9pCP+15g4e/nO6WsM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XhEgirRE/lbkmGMeu736IqiVXpODs6XeZZXmht1YG4vTfbmcuwZYmccvXRplTQu6WSBeUBwYB8ql6dIw/0kr01WRteEx2BADSPCu06krfM6rKcNx0ninmHxe9asKXwBwW+XT9rbPBCT+LdDzBn0AclJzFf7pHNPDxj34/wfNq/4= 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.180.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 (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65GNSdIx1072489 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-f71.google.com (mail-dl1-f71.google.com [74.125.82.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4euef28dns-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 16 Jun 2026 23:40:09 +0000 (GMT) Received: by mail-dl1-f71.google.com with SMTP id a92af1059eb24-1380494d27cso331800c88.2 for ; Tue, 16 Jun 2026 16:40:09 -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=kCHMI+2HbFoYMwhfMsQT05hwKs/NnfAb2yINKHRxvIqxAqzyLIYDYQF4igNO3mMSjZ 1LgNAGiKUunoxwSls43Q0E26MhegJp55MMfowbdBLANrCBlbaencT8OgNAdVNPAZwWkF O3QSGBIOXktAkhbu/dmy36Vjvc8YxgJiSpIY8scT1QNjDJfp71LRtRLgHkVELWg2jDQw 0uWE06xNzJo53Usu/e2tPIJ+zWU2116ecljOAbUpdew1YfUeVm/vDtpap1sApsjKAute QQq1OhQkuXLvfncitfCWJeRz5/a7+y1xFmnLf1HbCfz8Exh3IN6LyKa6qYLL8layDAqt RQuA== X-Forwarded-Encrypted: i=1; AFNElJ8ZHXAKTC4owTAQDwuVRfsl49l0Rc3Ho1oquUcg4YBSF4LPSyyYgYYioUOFAQB4LR41PfFhzOqLrxPs6o4=@vger.kernel.org X-Gm-Message-State: AOJu0YxqoXbWt1MLos0mIAnHfOoXPwd2FLlhTIK2rZfrVv+VjlHu4Tsc NX1au5VRLd3NovOfUSgTvE/x1iDa56OsfY6VT8TLKQ93a5HBg64yoNXbi/2nPAK7au/puVUkfoq W0o+miQlQ0YCNj5NLHpAN8QL/j2mqFhQRfkO5a9lHBhSj20byTMrMPovCrPjnnepNqNLnZwmWeC 0= X-Gm-Gg: AfdE7cmKvTa4fDDd12buTa7i3M1m6rYtg36Nw/ZcpMMpgv9nEH3ErA3yRQmZSap94vi j1pLfaWCXOCUamN3/cmSB87ziJxDq2CZ6reIdmoWNQEfkaM41+h6tdrgrNVM91vncnIZx8D8lGM gKFYlqSRPxhxEEA6Y8W8DiLxzopJdkxB1lSHhMKvGpUWpA+h6o9vUhDERN6lVIJRioUXNwT/jZ/ AForPwyM9eOyRJpiOsQSkNtVgd9WjNmSKgcdByOoRNbFJeXCE03uASSlfpy13ITYd0CDekrurMW fGpbd/3DdGQ/hebnqliIfb8WW0tTA0khvBshK8sKzeYU9tbEs00qVQJk2VBEtLhvpZCpcSURlRk AZqyVHKtaIQL3tbIhCKt4UjsQl83CeRVhLLnF9Cd+R8jACHmFc12yAtgHNaZ5xDSQDCQqynXJLp QhfHjryw== X-Received: by 2002:a05:7300:8bac:b0:2f3:3835:2005 with SMTP id 5a478bee46e88-30bca0740cbmr469706eec.6.1781653208289; 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-kernel@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-Authority-Analysis: v=2.4 cv=F8hnsKhN c=1 sm=1 tr=0 ts=6a31ded9 cx=c_pps a=JYo30EpNSr/tUYqK9jHPoA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=1tTGy1hlu4sAMEPmmk4A:9 a=QEXdDO2ut3YA:10 a=Fk4IpSoW4aLDllm1B1p-:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE2MDIzOSBTYWx0ZWRfX3OZ9FnMymsAG brPoOEnYbrJ2V/guUCpJL+T6GQvjl1/S8I03eMPvcGZmyXnnYCx8OqndJO/0rUSc72KUVEFVULh yWCX4rsuonxqunW2cBSQY9qU+3zHyac= X-Proofpoint-GUID: 8i4ZqRsBH-4D1TCuXpc6TiL7f5NfScXM X-Proofpoint-ORIG-GUID: 8i4ZqRsBH-4D1TCuXpc6TiL7f5NfScXM X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE2MDIzOSBTYWx0ZWRfXyE6HvF9IzdSm hsR437vlxs6G4ZfundSgt10aERlVQShCBXpTWD/GCBNywivQeq4N+m4M8eNRENCIyoKqhau2rzA UQHqXwxehjfUw0wRO5z/erigjt+WV87RA+X6ASjiEAaa9WYnRBszL8Kf2FTGuYH6W3mMihjO91J +ErGbuCQxEGBVKl4YaPeeODyVKK1T+fF97h560RsdaJEmYrZep2+4uGirdWb/H0UWxICpOqGGNa LalQE1NKkXnTh8duFghCzbIW9M4IJ6DUWO9riI5EmtLT4VQe3LSbCcTPwLJVpaDm5DJ5tHWY+Yh drvpJFu9W4+1nlAcf4+Lhn9JvcDTybJQGPdbdUy4qqzn69bC9wSQo39pyVNLZC30kdKtBgMQlw3 gw0fASnJAHQ6KPN9Ym1ubAeH4W5Rpi56kuYyRum9Z/QRdbbhiZEel9Jh41MST0uK1EfLA5V3q4D 6FUvpjqrarUFPM32K+Q== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.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 impostorscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=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