From patchwork Tue Jun 14 07:49:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 581857 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E92FC433EF for ; Tue, 14 Jun 2022 07:50:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238473AbiFNHuM (ORCPT ); Tue, 14 Jun 2022 03:50:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354893AbiFNHuD (ORCPT ); Tue, 14 Jun 2022 03:50:03 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C7953ED34; Tue, 14 Jun 2022 00:50:03 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:4a7b:8d3a:acaa:ec46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id 5EBED66016B0; Tue, 14 Jun 2022 08:50:01 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655193001; bh=x0nxGwrt50+4LgCDX6/bdpXdRkeiHuZS/A3/2NyD25E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hmhblfmZyolpNa8tNnzVCAj4BGRekG0veN1JKyw/TYlFEUZ/66iOJtBdI2oPlUK2a esh72LhujUROOuzi4XkUagv3ynXeVHT70W1aAB4J7TnK45ss5tzxI4ux5VwGCbGrOJ PsT9jLzVbs+rce4ZLrTAirVJ4XPegDRwvMix3uk2HyPoM3+8Q5FAbJ392Wk/A0gdiU o6RcUWio/Ec5U77NcbruQVLif5/dPLV3g0rVl26x8fH0AJdRJkK1BSyGfyoocM4J5M /r52IUs3yK7c6fDRqUU5VS6z5rpXcPsAXmIz3IXLMkZ81YXRBZsN8oelLcpbR3A33A X6tFeKMxNmGag== From: Benjamin Gaignard To: mchehab@kernel.org, hverkuil@xs4all.nl, 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, Benjamin Gaignard Subject: [PATCH v7 09/17] media: uapi: HEVC: Define V4L2_CID_STATELESS_HEVC_SLICE_PARAMS as a dynamic array Date: Tue, 14 Jun 2022 09:49:39 +0200 Message-Id: <20220614074947.160316-10-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220614074947.160316-1-benjamin.gaignard@collabora.com> References: <20220614074947.160316-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 }, }, .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 + /** * 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)