Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8671124rwi; Tue, 25 Oct 2022 09:23:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43J+xroZ4R7PRU+DpF6Rm7hsg8SxKTWOevKbwxUN6aWfufSShlRKJHB0mYBEScz0SCLvkA X-Received: by 2002:a17:907:84a:b0:733:735:2b1a with SMTP id ww10-20020a170907084a00b0073307352b1amr33437560ejb.290.1666715003879; Tue, 25 Oct 2022 09:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666715003; cv=none; d=google.com; s=arc-20160816; b=XpCcp4atYJGsbcmV9xhQ+GdRKjX/CDe3Iucl9Zb3g6g54+BKXyfGrEm/8rrNuS6Yv0 RUAkFYmFYBJ8+YTZTveKtjal/Z4K0AHAZfo+7lLQQwz0SKw9tgGWYd5VZnMRb25cUBCr 1ZC+NkdBhaJcwdivKYiBm9k2TpkuZExyagWGx/89a5o2QARJ/TNZRMojAJ8oI6ZNG0u2 rh8Ktn09V257kWG+i0jRlkSG2hKRRUIwGUR6r6eacVLp75v4SxvkIyz4i8VMv5H0mG3H LymebxrlOXV1EYmgvBzU95NwT7K7WbirJ4Sk85ydzbbX5HSwnf2uJmn+IR2N1E5Sp2Ww 3Tzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Uly7ckkhJ2QaaComUjr1tUEanSEoMRUyfouydzaxF4Q=; b=t/nCHGRFER6HLLC30OWK7kDdvbUrl7spKOVZp5HGQKliOVRPksuSGKDWg1NRQKvh8P n1WK/fdlb8N7YsOcMsKvlTw9Z/kuIGvivbsMGzyNlE5SQ2HRYLnUPRNrC6uC8xgemqeE UZ+NUwDrpjW1gBDHCVmUhmEdjm0tl0pxgoyZ309ivaG8stPdAZaJX1h2FmxWwGg12Wv2 j8mCCmBdXSo3u70/Rc6iSaldFfaXL8TJbis6/us9jGZQg5lYjETF0PGO2stOv7X3n5+K sUWIvv7+JpA43ySjEnIw/cgHTBlMPrZE8mL5rpABtO+RjMISjL8XDfsqfxNdPvg239m2 hZYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=af37qNXC; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a50fd96000000b00458b42ff418si812110edt.221.2022.10.25.09.22.57; Tue, 25 Oct 2022 09:23:23 -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; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=af37qNXC; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233005AbiJYPQ4 (ORCPT + 99 others); Tue, 25 Oct 2022 11:16:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233009AbiJYPQv (ORCPT ); Tue, 25 Oct 2022 11:16:51 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D53BCE99B; Tue, 25 Oct 2022 08:16:47 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id DAB51C0002; Tue, 25 Oct 2022 15:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1666711006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Uly7ckkhJ2QaaComUjr1tUEanSEoMRUyfouydzaxF4Q=; b=af37qNXCOQfJN2YCS+hKn6lR8J5vIO2LiaMYB7Xu6AxkWBe5+JOGQIFTiq9aZQB6HfeM8Y 0pMFpTGKmlScEzWJUtTvBADhoIMZFRzhESRdc5j5L1I2bIaL7vAqsAoTJldg5Wmdy5yYQU Uymz6VfKcZ3jkK3Hadl5UPXyrxcE2sswBsVUzefbGTQPL47JnxZ+FMqEjevB474KiQCya6 +XyVSZ33YG0U2YXXsmo8eSC1LOvce1ZTaeY38n+xDnb7d3nCHvq1CfcJjq6e3o+eO/iIbl qxf85t8+KRx45IfwVOxfs51y+mT+JUqwCZcRN1UnjxdiULiS3Tu4ly4u12V1dg== Date: Tue, 25 Oct 2022 17:16:44 +0200 From: Paul Kocialkowski To: Jernej Skrabec Cc: mripard@kernel.org, mchehab@kernel.org, gregkh@linuxfoundation.org, wens@csie.org, samuel@sholland.org, hverkuil-cisco@xs4all.nl, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 05/11] media: cedrus: Filter controls based on capability Message-ID: References: <20221024201515.34129-1-jernej.skrabec@gmail.com> <20221024201515.34129-6-jernej.skrabec@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xdfw+kjfC1LhWNk0" Content-Disposition: inline In-Reply-To: <20221024201515.34129-6-jernej.skrabec@gmail.com> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 --xdfw+kjfC1LhWNk0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Mon 24 Oct 22, 22:15, Jernej Skrabec wrote: > Because not all Cedrus variants supports all codecs, controls should be > registered only if codec related to individual control is supported by > Cedrus. >=20 > Replace codec enum, which is not used at all, with capabilities flags > and register control only if capabilities are met. >=20 > Signed-off-by: Jernej Skrabec Acked-by: Paul Kocialkowski Cheers, Paul > --- > drivers/staging/media/sunxi/cedrus/cedrus.c | 45 +++++++++++---------- > drivers/staging/media/sunxi/cedrus/cedrus.h | 2 +- > 2 files changed, 25 insertions(+), 22 deletions(-) >=20 > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/stagin= g/media/sunxi/cedrus/cedrus.c > index 2f284a58d787..023566b02dc5 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c > @@ -77,56 +77,56 @@ static const struct cedrus_control cedrus_controls[] = =3D { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_MPEG2_SEQUENCE, > }, > - .codec =3D CEDRUS_CODEC_MPEG2, > + .capabilities =3D CEDRUS_CAPABILITY_MPEG2_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_MPEG2_PICTURE, > }, > - .codec =3D CEDRUS_CODEC_MPEG2, > + .capabilities =3D CEDRUS_CAPABILITY_MPEG2_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_MPEG2_QUANTISATION, > }, > - .codec =3D CEDRUS_CODEC_MPEG2, > + .capabilities =3D CEDRUS_CAPABILITY_MPEG2_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_H264_DECODE_PARAMS, > }, > - .codec =3D CEDRUS_CODEC_H264, > + .capabilities =3D CEDRUS_CAPABILITY_H264_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_H264_SLICE_PARAMS, > }, > - .codec =3D CEDRUS_CODEC_H264, > + .capabilities =3D CEDRUS_CAPABILITY_H264_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_H264_SPS, > .ops =3D &cedrus_ctrl_ops, > }, > - .codec =3D CEDRUS_CODEC_H264, > + .capabilities =3D CEDRUS_CAPABILITY_H264_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_H264_PPS, > }, > - .codec =3D CEDRUS_CODEC_H264, > + .capabilities =3D CEDRUS_CAPABILITY_H264_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_H264_SCALING_MATRIX, > }, > - .codec =3D CEDRUS_CODEC_H264, > + .capabilities =3D CEDRUS_CAPABILITY_H264_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_H264_PRED_WEIGHTS, > }, > - .codec =3D CEDRUS_CODEC_H264, > + .capabilities =3D CEDRUS_CAPABILITY_H264_DEC, > }, > { > .cfg =3D { > @@ -134,7 +134,7 @@ static const struct cedrus_control cedrus_controls[] = =3D { > .max =3D V4L2_STATELESS_H264_DECODE_MODE_SLICE_BASED, > .def =3D V4L2_STATELESS_H264_DECODE_MODE_SLICE_BASED, > }, > - .codec =3D CEDRUS_CODEC_H264, > + .capabilities =3D CEDRUS_CAPABILITY_H264_DEC, > }, > { > .cfg =3D { > @@ -142,7 +142,7 @@ static const struct cedrus_control cedrus_controls[] = =3D { > .max =3D V4L2_STATELESS_H264_START_CODE_NONE, > .def =3D V4L2_STATELESS_H264_START_CODE_NONE, > }, > - .codec =3D CEDRUS_CODEC_H264, > + .capabilities =3D CEDRUS_CAPABILITY_H264_DEC, > }, > /* > * We only expose supported profiles information, > @@ -160,20 +160,20 @@ static const struct cedrus_control cedrus_controls[= ] =3D { > .menu_skip_mask =3D > BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED), > }, > - .codec =3D CEDRUS_CODEC_H264, > + .capabilities =3D CEDRUS_CAPABILITY_H264_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_HEVC_SPS, > .ops =3D &cedrus_ctrl_ops, > }, > - .codec =3D CEDRUS_CODEC_H265, > + .capabilities =3D CEDRUS_CAPABILITY_H265_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_HEVC_PPS, > }, > - .codec =3D CEDRUS_CODEC_H265, > + .capabilities =3D CEDRUS_CAPABILITY_H265_DEC, > }, > { > .cfg =3D { > @@ -181,13 +181,13 @@ static const struct cedrus_control cedrus_controls[= ] =3D { > /* The driver can only handle 1 entry per slice for now */ > .dims =3D { 1 }, > }, > - .codec =3D CEDRUS_CODEC_H265, > + .capabilities =3D CEDRUS_CAPABILITY_H265_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_HEVC_SCALING_MATRIX, > }, > - .codec =3D CEDRUS_CODEC_H265, > + .capabilities =3D CEDRUS_CAPABILITY_H265_DEC, > }, > { > .cfg =3D { > @@ -197,7 +197,7 @@ static const struct cedrus_control cedrus_controls[] = =3D { > .max =3D 0xffffffff, > .step =3D 1, > }, > - .codec =3D CEDRUS_CODEC_H265, > + .capabilities =3D CEDRUS_CAPABILITY_H265_DEC, > }, > { > .cfg =3D { > @@ -205,7 +205,7 @@ static const struct cedrus_control cedrus_controls[] = =3D { > .max =3D V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED, > .def =3D V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED, > }, > - .codec =3D CEDRUS_CODEC_H265, > + .capabilities =3D CEDRUS_CAPABILITY_H265_DEC, > }, > { > .cfg =3D { > @@ -213,19 +213,19 @@ static const struct cedrus_control cedrus_controls[= ] =3D { > .max =3D V4L2_STATELESS_HEVC_START_CODE_NONE, > .def =3D V4L2_STATELESS_HEVC_START_CODE_NONE, > }, > - .codec =3D CEDRUS_CODEC_H265, > + .capabilities =3D CEDRUS_CAPABILITY_H265_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_VP8_FRAME, > }, > - .codec =3D CEDRUS_CODEC_VP8, > + .capabilities =3D CEDRUS_CAPABILITY_VP8_DEC, > }, > { > .cfg =3D { > .id =3D V4L2_CID_STATELESS_HEVC_DECODE_PARAMS, > }, > - .codec =3D CEDRUS_CODEC_H265, > + .capabilities =3D CEDRUS_CAPABILITY_H265_DEC, > }, > }; > =20 > @@ -275,6 +275,9 @@ static int cedrus_init_ctrls(struct cedrus_dev *dev, = struct cedrus_ctx *ctx) > return -ENOMEM; > =20 > for (i =3D 0; i < CEDRUS_CONTROLS_COUNT; i++) { > + if (!cedrus_is_capable(ctx, cedrus_controls[i].capabilities)) > + continue; > + > ctrl =3D v4l2_ctrl_new_custom(hdl, &cedrus_controls[i].cfg, > NULL); > if (hdl->error) { > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/stagin= g/media/sunxi/cedrus/cedrus.h > index 1a98790a99af..7a1619967513 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus.h > +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h > @@ -57,7 +57,7 @@ enum cedrus_h264_pic_type { > =20 > struct cedrus_control { > struct v4l2_ctrl_config cfg; > - enum cedrus_codec codec; > + unsigned int capabilities; > }; > =20 > struct cedrus_h264_run { > --=20 > 2.38.1 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --xdfw+kjfC1LhWNk0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmNX/dwACgkQ3cLmz3+f v9Gb+Af/dywkX70PM27smnwIoZUvkk+GkgAiROlYkJtOX3TFHHV60AL1U7hXh481 hv4ql8tekS+p4kwbYpAEcHYj4dYvRbGyNtqiBHYTvXrZ4XzWfK6fTvZLjhQqtJg+ iqRwuARVppbTy2yCEFH77daCfcWA17IpgFt0JwAohLKFK1uiWblcM7NvLx4AB6Oy BacxFsSAtdC7r0GrSKPLlxg/cq4CNjgwKKdqQQPjiyN4Kjvf4JyGDl7CAsmHM8Xy rgDQf97GQ5xFFQlBqaOWx/b6J1h/3mVTCfjI435CJiy45EIFLm8h/+9ak+rvtKB4 roCIOHld+cX2Fh2pXRFt5zoCobeuDg== =6s+C -----END PGP SIGNATURE----- --xdfw+kjfC1LhWNk0--