Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1480874iog; Tue, 14 Jun 2022 07:00:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9qIesFk1Fhquuu3++TuAO8nypYpczgsAcyiPC25BgOSVC9oWiwoAFcTOrU8ZSm/T3183N X-Received: by 2002:a17:902:e54b:b0:166:50b6:a0a0 with SMTP id n11-20020a170902e54b00b0016650b6a0a0mr4663036plf.30.1655215200894; Tue, 14 Jun 2022 07:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655215200; cv=none; d=google.com; s=arc-20160816; b=jbSLJ/2sPfIaUobVK2sGK9fppm8PP33sXwfp98dHPHo2iqyIshdi3obzdAiEmWcR+v YuO/CgKszXTH2J/zl30X+J+2frmZoskLajPpIrG4/WHQGvAPuzyOkZhPT9MKi6z/X/IH AFma33Bekc+FM4i/eost4xAm03RrQ1g4P4dUMRsLvOJ5BVbZGtQd2npiPtzp9mc/A9Sb EVgJqMGrxU4JttwERU9uaNHRYA/qC9837KNoS7mxi425SZFTGQTqkdEChEiOmbjYFNIN DmOjq0JfwNDI4mGmk+0WwmL04jzTvXBq03oMrr5yKJ2yF9nK9jdMO+aGiQ2TpfG45S2C KJ9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ajjTy2iPeY4NQaAK+G5/E8lxc3UZajsu4iQudT2P+M0=; b=daT1NxV+1ohAkNd+j+/TF5po4HUEZR02L2HjWYTEYwJR03oBalVDaAfS5uwYlkD/NY JrETBmxbbecYYgsEg5Ohrb3UANL42Uu/CmFi1vloZOp2XnlgXGZLMLxc7d1fxezKrFXu /5KlRmJDI5ufGyCd7p3J9nzEskKXeehwP0ygak3nvr2iAcO2Z2FDv7uhoMkONOtK+rkC fRZP6zeNfw7W8BhDx3scO5ZlAqUZOYRQiL340KTAUAAl0CKua6N1AVnT0I+fwirT8n3x WELohac58JC7u+2Vz4pRbEANmTTuja9EfdPMJlXKK9AIhdTiWVYR3/WvXlY5Wy02g5+t 8Q/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a170902db0700b00161571fd712si16763727plx.450.2022.06.14.06.59.45; Tue, 14 Jun 2022 07:00:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242601AbiFNNui (ORCPT + 99 others); Tue, 14 Jun 2022 09:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232844AbiFNNud (ORCPT ); Tue, 14 Jun 2022 09:50:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 310CA36B42; Tue, 14 Jun 2022 06:50:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D3400B818AD; Tue, 14 Jun 2022 13:50:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1934AC3411B; Tue, 14 Jun 2022 13:50:24 +0000 (UTC) Message-ID: Date: Tue, 14 Jun 2022 15:50:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v8 09/17] media: uapi: HEVC: Define V4L2_CID_STATELESS_HEVC_SLICE_PARAMS as a dynamic array Content-Language: en-US To: Benjamin Gaignard , mchehab@kernel.org, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, mripard@kernel.org, paul.kocialkowski@bootlin.com, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, nicolas.dufresne@collabora.com, andrzej.p@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, kernel@collabora.com References: <20220614083614.240641-1-benjamin.gaignard@collabora.com> <20220614083614.240641-10-benjamin.gaignard@collabora.com> From: Hans Verkuil In-Reply-To: <20220614083614.240641-10-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/14/22 10:36, Benjamin Gaignard wrote: > Make explicit that V4L2_CID_STATELESS_HEVC_SLICE_PARAMS control is > a dynamic array control type. > Some drivers may be able to receive multiple slices in one control > to improve decoding performance. > > Define the max size of the dynamic that can driver can set in .dims = {}. > > Signed-off-by: Benjamin Gaignard > --- > version 7: > - Add Jernej patch to set array dims for Cedrus > > version 6: > - Set V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag automatically when using > V4L2_CID_STATELESS_HEVC_SLICE_PARAMS control. > - Add a define for max slices count > > Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 2 ++ > drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 + > drivers/staging/media/sunxi/cedrus/cedrus.c | 1 + > include/media/hevc-ctrls.h | 5 +++++ > 4 files changed, 9 insertions(+) > > diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst > index 06b967de140c..0796b1563daa 100644 > --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst > +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst > @@ -2986,6 +2986,8 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - > These bitstream parameters are defined according to :ref:`hevc`. > They are described in section 7.4.7 "General slice segment header > 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_slice_params > > diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c > index 9f55503cd3d6..d594efbcbb93 100644 > --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c > +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c > @@ -1510,6 +1510,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, > break; > case V4L2_CID_STATELESS_HEVC_SLICE_PARAMS: > *type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS; > + *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY; > break; > case V4L2_CID_STATELESS_HEVC_SCALING_MATRIX: > *type = V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX; > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c > index 87be975a72b6..f3391c7c811c 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c > @@ -178,6 +178,7 @@ static const struct cedrus_control cedrus_controls[] = { > { > .cfg = { > .id = V4L2_CID_STATELESS_HEVC_SLICE_PARAMS, > + .dims = { 1 }, So cedrus HW supports only a single SLICE_PARAMS struct? Perhaps add that as a comment. > }, > .codec = CEDRUS_CODEC_H265, > }, > diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h > index 0dbd5d681c28..140151609c96 100644 > --- a/include/media/hevc-ctrls.h > +++ b/include/media/hevc-ctrls.h > @@ -311,9 +311,14 @@ struct v4l2_hevc_pred_weight_table { > #define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8) > #define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9) > > +#define V4L2_HEVC_SLICE_MAX_COUNT 600 > + I would drop this define. It is not used at the moment, and I think it is the driver that should set this through the dims field (as cedrus does above). It is likely to be limited by hardware anyway (just my guess). If it is needed in the future, it can always be added. Regards, Hans > /** > * v4l2_ctrl_hevc_slice_params - HEVC slice parameters > * > + * This control is a dynamically sized 1-dimensional array, > + * V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag must be set when using it. > + * > * @bit_size: size (in bits) of the current slice data > * @data_bit_offset: offset (in bits) to the video data in the current slice data > * @nal_unit_type: specifies the coding type of the slice (B, P or I)