Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02CEBD637AE for ; Tue, 16 Dec 2025 20:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ca75mjl2ylCa0bxIWbc8enL9XzPv7wMBHz9lP28nTcA=; b=LxE72Wroia5k0RukX4msQnt9UO 3tz0i/OgkueyTZEsJf9vfKil7CesXILt1HfvKMexhH+snb1gSekw9nW58BVgjglRLwxYx30x4mzUU w1gBGMoyNtEIku+7e38B49MtLulu3+Dxtkf5E1A3SgZgtQoQ4XGqWrgG/X7jr0KIohJNGkECBP064 HHz9A96Ks+san18kaqpjhRXX5WipiajSaocYiRxld21e0sh3AajB8cJC8eaaebFokUoSXlXcYV/HQ xD1MOhsZ6w8Bbq/mB5tCZP1X1DSg162hsEQ/pxTK1WwXtyHJ2sZyPjYq5vWU89t9NPek5XSmoi0oD DmRT7Dnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vVbyt-00000005o5R-25cl; Tue, 16 Dec 2025 20:49:15 +0000 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vVbyr-00000005o4u-1owP; Tue, 16 Dec 2025 20:49:14 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1765918131; cv=none; d=zohomail.com; s=zohoarc; b=PWaVYsnoiZji0m2Vak4l2GrTUxoYt4kMHURmwjMjZguN7UWa59kydpjQsG8/mKjUo7tBa2IRkWyGvn3osGnQtysH22zg0z0gPvDLk11dN1t8OIVWMcjFNhIj5z4D2/RVShSp6GLIvRV7GUK1qxD7oqVYfOjI2yDzzQFtV/FjIb8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765918131; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=ca75mjl2ylCa0bxIWbc8enL9XzPv7wMBHz9lP28nTcA=; b=iz1+RkKe76OYgFc+4x90CG7/JNEo+qjeBULdrVd98VaeDlbOTS9HkTTGbX3vGUbXE6peyXxQWNDHt2N0hOlGKrYXDV/tREjcVvLD80QuuH5Kzt08+uapiKD8I211EaRZ0QeInDtrW9BlWURE9FQaE4onedCohFGAV9P/mGub2Ic= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=detlev.casanova@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1765918131; s=zohomail; d=collabora.com; i=detlev.casanova@collabora.com; h=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:Cc:Cc:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=ca75mjl2ylCa0bxIWbc8enL9XzPv7wMBHz9lP28nTcA=; b=a1tIKX9L+xVzbyG57TB4ApRpWDthyRhwKsQJ7HkIT8WPogciDBoSctMIEPAuFV/p z60f2A0v3saJAjWok8CugoEtdYvFnlbn6RsjSBaZ/fGkfOFN2valBWilUvpkhslB4lj 8Mrv80gmZ9qCkywpn36KArj9AZqfVVffEll65/7g= Received: by mx.zohomail.com with SMTPS id 1765918128524840.1763123080524; Tue, 16 Dec 2025 12:48:48 -0800 (PST) Message-ID: <37da2fe3-41bd-470e-bb6c-93fe35ee1528@collabora.com> Date: Tue, 16 Dec 2025 15:48:45 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 01/15] media: uapi: HEVC: Add v4l2_ctrl_hevc_ext_sps_[ls]t_rps controls To: Hans Verkuil , linux-kernel@vger.kernel.org Cc: Mauro Carvalho Chehab , Ezequiel Garcia , Heiko Stuebner , Ricardo Ribalda , Hans Verkuil , Hans de Goede , Yunke Cao , Jonathan Corbet , Laurent Pinchart , Sakari Ailus , James Cowgill , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, Nicolas Dufresne References: <20251023214247.459931-1-detlev.casanova@collabora.com> <20251023214247.459931-2-detlev.casanova@collabora.com> Content-Language: en-US From: Detlev Casanova In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ZohoMailClient: External X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251216_124913_533937_278F583A X-CRM114-Status: GOOD ( 28.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Hans, On 10/24/25 03:55, Hans Verkuil wrote: > On 23/10/2025 23:42, Detlev Casanova wrote: >> Some hardware (e.g.: Rockchip's rk3588 hevc decoder) need the >> long and short term reference information for HEVC decoding. >> >> Add controls to provide it as the raw data form the stream. >> >> Signed-off-by: Detlev Casanova >> --- >> .../media/v4l/ext-ctrls-codec-stateless.rst | 114 ++++++++++++++++++ >> .../media/v4l/videodev2.h.rst.exceptions | 2 + >> .../media/v4l/vidioc-queryctrl.rst | 12 ++ >> 3 files changed, 128 insertions(+) >> >> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst >> index 497ae74379f6..7b18e12fafbb 100644 >> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst >> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst >> @@ -2959,6 +2959,120 @@ This structure contains all loop filter related parameters. See sections >> - 0x00000004 >> - >> >> +``V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS (struct)`` >> + Specifies the list of Long-Term reference sets parameters from the SPS. >> + These parameters are defined according to :ref:`hevc`. >> + They are described in section 7.4.3.2.1 "General sequence parameter set >> + RBSP semantics" of the specification. >> + This control is a dynamically sized 1-dimensional array, >> + V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag must be set when using it. > I'd drop this last sentence. It suggests that the application has to set it, > but is it set by the kernel. > > Same for the next control below. > > I noticed that this is probably a copy-and-paste from the V4L2_CID_STATELESS_HEVC_SLICE_PARAMS > documentation: can you post a separate patch removing that same line from the description of > that control? I think it is a confusing line, and we missed it during the original review > of V4L2_CID_STATELESS_HEVC_SLICE_PARAMS. > > I have another question about these two controls: currently dynamic controls have always at > least one element. I have been working on supporting zero-sized dynamic controls. Would > that make sense here? Or will these two controls - if present - always have one element or > more? > > If zero-length dynamic array controls are useful here, then I can clean up my patches and > post them so you can use it. I guess that could happen depending on what userspace does, but the size of the array is determined by num_long_term_ref_pics_sps and num_short_term_ref_pic_sets from v4l2_ctrl_hevc_sps respectively. If that value is 0, there is no point in setting the (respective) control, except for simplifying userspace code I suppose. So 0-length support is avoidable. Detlev. > Regards, > > Hans > >> + >> +.. c:type:: v4l2_ctrl_hevc_ext_sps_lt_rps >> + >> +.. cssclass:: longtable >> + >> +.. flat-table:: struct v4l2_ctrl_hevc_ext_sps_lt_rps >> + :header-rows: 0 >> + :stub-columns: 0 >> + :widths: 1 1 2 >> + >> + * - __u16 >> + - ``lt_ref_pic_poc_lsb_sps`` >> + - Long term reference picture order count as described in section 7.4.3.2.1 >> + "General sequence parameter set RBSP semantics" of the specification. >> + * - __u8 >> + - ``flags`` >> + - See :ref:`Extended Long-Term RPS Flags ` >> + >> +.. _hevc_ext_sps_lt_rps_flags: >> + >> +``Extended SPS Long-Term RPS Flags`` >> + >> +.. cssclass:: longtable >> + >> +.. flat-table:: >> + :header-rows: 0 >> + :stub-columns: 0 >> + :widths: 1 1 2 >> + >> + * - ``V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_USED_LT`` >> + - 0x00000001 >> + - Specifies if the long-term reference picture is used 7.4.3.2.1 "General sequence parameter >> + set RBSP semantics" of the specification. >> + >> +``V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS (struct)`` >> + Specifies the list of Short-Term reference sets parameters from the SPS. >> + These parameters are defined according to :ref:`hevc`. >> + They are described in section 7.4.8 "Short-term reference picture set >> + semantics" of the specification. >> + This control is a dynamically sized 1-dimensional array, >> + V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag must be set when using it. >> + >> +.. c:type:: v4l2_ctrl_hevc_ext_sps_st_rps >> + >> +.. cssclass:: longtable >> + >> +.. flat-table:: struct v4l2_ctrl_hevc_ext_sps_st_rps >> + :header-rows: 0 >> + :stub-columns: 0 >> + :widths: 1 1 2 >> + >> + * - __u8 >> + - ``delta_idx_minus1`` >> + - Specifies the delta compare to the index. See details in section 7.4.8 "Short-term >> + reference picture set semantics" of the specification. >> + * - __u8 >> + - ``delta_rps_sign`` >> + - Sign of the delta as specified in section 7.4.8 "Short-term reference picture set >> + semantics" of the specification. >> + * - __u16 >> + - ``abs_delta_rps_minus1`` >> + - Absolute delta RPS as specified in section 7.4.8 "Short-term reference picture set >> + semantics" of the specification. >> + * - __u8 >> + - ``num_negative_pics`` >> + - Number of short-term RPS entries that have picture order count values less than the >> + picture order count value of the current picture. >> + * - __u8 >> + - ``num_positive_pics`` >> + - Number of short-term RPS entries that have picture order count values greater than the >> + picture order count value of the current picture. >> + * - __u32 >> + - ``used_by_curr_pic`` >> + - Bit i specifies if short-term RPS i is used by the current picture. >> + * - __u32 >> + - ``use_delta_flag`` >> + - Bit i specifies if short-term RPS i is included in the short-term RPS entries. >> + * - __u16 >> + - ``delta_poc_s0_minus1[16]`` >> + - Specifies the negative picture order count delta for the i-th entry in the short-term RPS. >> + See details in section 7.4.8 "Short-term reference picture set semantics" of the >> + specification. >> + * - __u16 >> + - ``delta_poc_s1_minus1[16]`` >> + - Specifies the positive picture order count delta for the i-th entry in the short-term RPS. >> + See details in section 7.4.8 "Short-term reference picture set semantics" of the >> + specification. >> + * - __u8 >> + - ``flags`` >> + - See :ref:`Extended Short-Term RPS Flags ` >> + >> +.. _hevc_ext_sps_st_rps_flags: >> + >> +``Extended SPS Short-Term RPS Flags`` >> + >> +.. cssclass:: longtable >> + >> +.. flat-table:: >> + :header-rows: 0 >> + :stub-columns: 0 >> + :widths: 1 1 2 >> + >> + * - ``V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_INTER_REF_PIC_SET_PRED`` >> + - 0x00000001 >> + - Specifies if the short-term RPS is predicted from another short term RPS. See details in >> + section 7.4.8 "Short-term reference picture set semantics" of the specification. >> + >> .. _v4l2-codec-stateless-av1: >> >> ``V4L2_CID_STATELESS_AV1_SEQUENCE (struct)`` >> diff --git a/Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions >> index c41693115db6..6182b4e2d2ee 100644 >> --- a/Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions >> +++ b/Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions >> @@ -150,6 +150,8 @@ replace symbol V4L2_CTRL_TYPE_H264_SCALING_MATRIX :c:type:`V4L.v4l2_ctrl_type` >> replace symbol V4L2_CTRL_TYPE_H264_PRED_WEIGHTS :c:type:`V4L.v4l2_ctrl_type` >> replace symbol V4L2_CTRL_TYPE_H264_SLICE_PARAMS :c:type:`V4L.v4l2_ctrl_type` >> replace symbol V4L2_CTRL_TYPE_H264_DECODE_PARAMS :c:type:`V4L.v4l2_ctrl_type` >> +replace symbol V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS :c:type:`V4L.v4l2_ctrl_type` >> +replace symbol V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS :c:type:`V4L.v4l2_ctrl_type` >> replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`V4L.v4l2_ctrl_type` >> replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`V4L.v4l2_ctrl_type` >> replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`V4L.v4l2_ctrl_type` >> diff --git a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst >> index c8baa9430c14..82c8b52e771c 100644 >> --- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst >> +++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst >> @@ -531,6 +531,18 @@ See also the examples in :ref:`control`. >> - n/a >> - A struct :c:type:`v4l2_ctrl_hevc_decode_params`, containing HEVC >> decoding parameters for stateless video decoders. >> + * - ``V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS`` >> + - n/a >> + - n/a >> + - n/a >> + - A struct :c:type:`v4l2_ctrl_hevc_ext_sps_lt_rps`, containing HEVC >> + extended Long-Term RPS for stateless video decoders. >> + * - ``V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS`` >> + - n/a >> + - n/a >> + - n/a >> + - A struct :c:type:`v4l2_ctrl_hevc_ext_sps_st_rps`, containing HEVC >> + extended Short-Term RPS for stateless video decoders. >> * - ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR`` >> - n/a >> - n/a