Message ID | 20221219155616.848690-4-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2468635wrn; Mon, 19 Dec 2022 07:59:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf60aO0w/khBEMk3xnO2cRoGUGmi6Rca4RTAnZfvsllFQVGGhZU9zvGt13yUuncg6OEDDWUu X-Received: by 2002:a17:90a:fe0a:b0:219:8cba:cbbd with SMTP id ck10-20020a17090afe0a00b002198cbacbbdmr44990924pjb.32.1671465551649; Mon, 19 Dec 2022 07:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671465551; cv=none; d=google.com; s=arc-20160816; b=Zcdxaz+XH4T+0qFa7Bh+7CzEoQ1jKILRUyhqnYHVSnzkVPd2iZ+AL1ZCUYxCdnhn7q lurfcp4HvTp55FiuB3od5B4tzL2giz+aOYbP4P/9R2jOiNYLCVzJG+WXTh53Z/JbzQSj jqx2EYsOtKsKGKU4uvuV9EXBPuvO92/h1W+ngN6B9+dBJpn+I2BOuijQXFmbieMLXCxn DpWPhLJxFk/xnUeeZv1TjBId5Veoi1ShPtK/NuYLAyUR9ZFHuFhs2Ul/pCC0R2+AXop2 ORyqEBQ0onKXIszBojK7nJn3zXoORAztMqtHpY9qV8YKDI3lypkQE4OqR7vmXoYA9lzY yehg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KL0l6w5XuBm+HSZxkl4l/+2+/d5P/zeO9upNQmXwrq0=; b=0A7q7FG9RMRFt/l1FDLcBPqu8jvyj8Euu+MTfyDObULqE5xXNiJ1LWRsQhK683OZCF v1iFUfVqAgV1yc8YxlPx7noheTY25v+a/i4lTszyYCdqVitWlp/jyUWyba5bVknx7naD SN3XDfDdo9KR7Q1ufqKqy87k/JQ+FmukMBGl4OMPln0DDEa3BIBUcdI9JoHzRFaszCIy Yr7wIOyv/VYDTKilB2YUEms8ts7kkqo4zNW7haVihxLdod9ou6M/Xnf1o0D49iVViD3j sbCD8PHIPY1clg26HSTqrhkt0lJwHw9OPXC3tk6G19NSZqwESmsXdS/QZcvydNYkXeS4 e5/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="gv/CtYTK"; 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=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga11-20020a17090b038b00b00219a2721d64si10301053pjb.72.2022.12.19.07.58.58; Mon, 19 Dec 2022 07:59:11 -0800 (PST) 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=@collabora.com header.s=mail header.b="gv/CtYTK"; 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=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232521AbiLSP44 (ORCPT <rfc822;abdi.embedded@gmail.com> + 99 others); Mon, 19 Dec 2022 10:56:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232268AbiLSP43 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 19 Dec 2022 10:56:29 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC6CA65E4; Mon, 19 Dec 2022 07:56:26 -0800 (PST) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:f69c:5603:d4ce:7aa2]) (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 16E876602C51; Mon, 19 Dec 2022 15:56:25 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1671465385; bh=WKnUc4065UFAP8ex+HL2CHU0GCNHlvHhtIo5+EmiUnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gv/CtYTKPpRno7W9iePoA/tVBB01PPhcSkj3Av1aX/MRnENraKw8IJFuwOP5jcmQJ iBXgMqX3pe2+ZhTOna8ITfVdMqWeZa7nBB673QG5eAAbQN4jSVWH9mqLSslmmqDQlH uePkfM2INX8y45vPOiQKJTdP8gkYcarVz6OS4k+7+UcQbn4AeY8cT0V9VRhVZ6hPkq ibyLQG6dnly9Vg5svXvGE2mVq7x2diTRNP4JKXSGmZCao8H7c879G29pJ+rJv1LSxz dBMelhXjkr7pij8N458GPYXkkSrBidR69h+hbEezr6S03HFKl3kf6tiUqZpM1X7Gtf kZOWkbjIn7fnQ== From: Benjamin Gaignard <benjamin.gaignard@collabora.com> To: ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, mchehab@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, heiko@sntech.de, daniel.almeida@collabora.com, nicolas.dufresne@collabora.co.uk Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Benjamin Gaignard <benjamin.gaignard@collabora.com> Subject: [PATCH v1 3/9] media: verisilicon: Save bit depth for AV1 decoder Date: Mon, 19 Dec 2022 16:56:10 +0100 Message-Id: <20221219155616.848690-4-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221219155616.848690-1-benjamin.gaignard@collabora.com> References: <20221219155616.848690-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752658661998845017?= X-GMAIL-MSGID: =?utf-8?q?1752658661998845017?= |
Series |
AV1 stateless decoder for RK3588
|
|
Commit Message
Benjamin Gaignard
Dec. 19, 2022, 3:56 p.m. UTC
Store bit depth information from AV1 sequence control.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
.../media/platform/verisilicon/hantro_drv.c | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
Comments
Le lundi 19 décembre 2022 à 16:56 +0100, Benjamin Gaignard a écrit : > Store bit depth information from AV1 sequence control. > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > --- > .../media/platform/verisilicon/hantro_drv.c | 26 +++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c > index 4500e1fc0f2c..8e93710dcfed 100644 > --- a/drivers/media/platform/verisilicon/hantro_drv.c > +++ b/drivers/media/platform/verisilicon/hantro_drv.c > @@ -324,6 +324,25 @@ static int hantro_vp9_s_ctrl(struct v4l2_ctrl *ctrl) > return 0; > } > > +static int hantro_av1_s_ctrl(struct v4l2_ctrl *ctrl) > +{ > + struct hantro_ctx *ctx; > + > + ctx = container_of(ctrl->handler, > + struct hantro_ctx, ctrl_handler); > + > + switch (ctrl->id) { > + case V4L2_CID_STATELESS_AV1_SEQUENCE: > + ctx->bit_depth = ctrl->p_new.p_av1_sequence->bit_depth; That seems a little be weak, what happens if you change the bit_depth with a non-request s_ctrl while its decoding ? To be this deserve a little bit of protection, a something that validate and copy it at the start of the decoding. p.s. I know, VP9 seems similar, though arguably that was copied from jpeg, for which it seems totally save to change the quality at run-time. > + break; > + default: > + return -EINVAL; > + } > + > + return 0; > +} > + > + > static const struct v4l2_ctrl_ops hantro_ctrl_ops = { > .try_ctrl = hantro_try_ctrl, > }; > @@ -336,6 +355,12 @@ static const struct v4l2_ctrl_ops hantro_vp9_ctrl_ops = { > .s_ctrl = hantro_vp9_s_ctrl, > }; > > +static const struct v4l2_ctrl_ops hantro_av1_ctrl_ops = { > + .try_ctrl = hantro_try_ctrl, > + .s_ctrl = hantro_av1_s_ctrl, > +}; > + > + > #define HANTRO_JPEG_ACTIVE_MARKERS (V4L2_JPEG_ACTIVE_MARKER_APP0 | \ > V4L2_JPEG_ACTIVE_MARKER_COM | \ > V4L2_JPEG_ACTIVE_MARKER_DQT | \ > @@ -513,6 +538,7 @@ static const struct hantro_ctrl controls[] = { > .codec = HANTRO_AV1_DECODER, > .cfg = { > .id = V4L2_CID_STATELESS_AV1_SEQUENCE, > + .ops = &hantro_av1_ctrl_ops, > }, > }, { > .codec = HANTRO_AV1_DECODER,
Bonjour Nicolas, On Mon, Dec 19, 2022 at 5:37 PM Nicolas Dufresne <nicolas@ndufresne.ca> wrote: > > Le lundi 19 décembre 2022 à 16:56 +0100, Benjamin Gaignard a écrit : > > Store bit depth information from AV1 sequence control. > > > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > > --- > > .../media/platform/verisilicon/hantro_drv.c | 26 +++++++++++++++++++ > > 1 file changed, 26 insertions(+) > > > > diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c > > index 4500e1fc0f2c..8e93710dcfed 100644 > > --- a/drivers/media/platform/verisilicon/hantro_drv.c > > +++ b/drivers/media/platform/verisilicon/hantro_drv.c > > @@ -324,6 +324,25 @@ static int hantro_vp9_s_ctrl(struct v4l2_ctrl *ctrl) > > return 0; > > } > > > > +static int hantro_av1_s_ctrl(struct v4l2_ctrl *ctrl) > > +{ > > + struct hantro_ctx *ctx; > > + > > + ctx = container_of(ctrl->handler, > > + struct hantro_ctx, ctrl_handler); > > + > > + switch (ctrl->id) { > > + case V4L2_CID_STATELESS_AV1_SEQUENCE: > > + ctx->bit_depth = ctrl->p_new.p_av1_sequence->bit_depth; > > That seems a little be weak, what happens if you change the bit_depth with a > non-request s_ctrl while its decoding ? To be this deserve a little bit of > protection, a something that validate and copy it at the start of the decoding. > Oh, nice catch. We need to return EBUSY, see https://www.kernel.org/doc/html/v5.0/media/uapi/v4l/buffer.html#interactions-between-formats-controls-and-buffers. There's already an API in the V4L2 control framework for drivers to use, see v4l2_ctrl_grab in https://www.kernel.org/doc/html/v5.0/media/kapi/v4l2-controls.html#active-and-grabbed-controls. > p.s. I know, VP9 seems similar, though arguably that was copied from jpeg, for > which it seems totally save to change the quality at run-time. > No, wasn't copied from JPEG :-) I just didn't realize this was an issue, but it is given the bit_depth affects the buffers so you are correct, it needs to be fixed for VP9 too. Thanks! Ezequiel > > + break; > > + default: > > + return -EINVAL; > > + } > > + > > + return 0; > > +} > > + > > + > > static const struct v4l2_ctrl_ops hantro_ctrl_ops = { > > .try_ctrl = hantro_try_ctrl, > > }; > > @@ -336,6 +355,12 @@ static const struct v4l2_ctrl_ops hantro_vp9_ctrl_ops = { > > .s_ctrl = hantro_vp9_s_ctrl, > > }; > > > > +static const struct v4l2_ctrl_ops hantro_av1_ctrl_ops = { > > + .try_ctrl = hantro_try_ctrl, > > + .s_ctrl = hantro_av1_s_ctrl, > > +}; > > + > > + > > #define HANTRO_JPEG_ACTIVE_MARKERS (V4L2_JPEG_ACTIVE_MARKER_APP0 | \ > > V4L2_JPEG_ACTIVE_MARKER_COM | \ > > V4L2_JPEG_ACTIVE_MARKER_DQT | \ > > @@ -513,6 +538,7 @@ static const struct hantro_ctrl controls[] = { > > .codec = HANTRO_AV1_DECODER, > > .cfg = { > > .id = V4L2_CID_STATELESS_AV1_SEQUENCE, > > + .ops = &hantro_av1_ctrl_ops, > > }, > > }, { > > .codec = HANTRO_AV1_DECODER, >
Hi Benjamin, I love your patch! Yet something to improve: [auto build test ERROR on media-tree/master] [also build test ERROR on rockchip/for-next linus/master v6.1 next-20221219] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Benjamin-Gaignard/AV1-stateless-decoder-for-RK3588/20221220-000013 base: git://linuxtv.org/media_tree.git master patch link: https://lore.kernel.org/r/20221219155616.848690-4-benjamin.gaignard%40collabora.com patch subject: [PATCH v1 3/9] media: verisilicon: Save bit depth for AV1 decoder config: m68k-allmodconfig compiler: m68k-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/c29cd881c9b7abf03a59462032928b13ff014c22 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Benjamin-Gaignard/AV1-stateless-decoder-for-RK3588/20221220-000013 git checkout c29cd881c9b7abf03a59462032928b13ff014c22 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/media/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/media/platform/verisilicon/hantro_drv.c: In function 'hantro_av1_s_ctrl': >> drivers/media/platform/verisilicon/hantro_drv.c:335:14: error: 'V4L2_CID_STATELESS_AV1_SEQUENCE' undeclared (first use in this function); did you mean 'V4L2_CID_STATELESS_MPEG2_SEQUENCE'? 335 | case V4L2_CID_STATELESS_AV1_SEQUENCE: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | V4L2_CID_STATELESS_MPEG2_SEQUENCE drivers/media/platform/verisilicon/hantro_drv.c:335:14: note: each undeclared identifier is reported only once for each function it appears in >> drivers/media/platform/verisilicon/hantro_drv.c:336:46: error: 'union v4l2_ctrl_ptr' has no member named 'p_av1_sequence'; did you mean 'p_mpeg2_sequence'? 336 | ctx->bit_depth = ctrl->p_new.p_av1_sequence->bit_depth; | ^~~~~~~~~~~~~~ | p_mpeg2_sequence drivers/media/platform/verisilicon/hantro_drv.c: At top level: drivers/media/platform/verisilicon/hantro_drv.c:529:31: error: 'V4L2_CID_STATELESS_AV1_FRAME' undeclared here (not in a function); did you mean 'V4L2_CID_STATELESS_VP9_FRAME'? 529 | .id = V4L2_CID_STATELESS_AV1_FRAME, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | V4L2_CID_STATELESS_VP9_FRAME drivers/media/platform/verisilicon/hantro_drv.c:534:31: error: 'V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY' undeclared here (not in a function) 534 | .id = V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/platform/verisilicon/hantro_drv.c:535:35: error: 'V4L2_AV1_MAX_TILE_COUNT' undeclared here (not in a function) 535 | .dims = { V4L2_AV1_MAX_TILE_COUNT }, | ^~~~~~~~~~~~~~~~~~~~~~~ drivers/media/platform/verisilicon/hantro_drv.c:540:31: error: 'V4L2_CID_STATELESS_AV1_SEQUENCE' undeclared here (not in a function); did you mean 'V4L2_CID_STATELESS_MPEG2_SEQUENCE'? 540 | .id = V4L2_CID_STATELESS_AV1_SEQUENCE, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | V4L2_CID_STATELESS_MPEG2_SEQUENCE drivers/media/platform/verisilicon/hantro_drv.c:546:31: error: 'V4L2_CID_STATELESS_AV1_FILM_GRAIN' undeclared here (not in a function); did you mean 'V4L2_CID_STATELESS_VP9_FRAME'? 546 | .id = V4L2_CID_STATELESS_AV1_FILM_GRAIN, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | V4L2_CID_STATELESS_VP9_FRAME vim +335 drivers/media/platform/verisilicon/hantro_drv.c 326 327 static int hantro_av1_s_ctrl(struct v4l2_ctrl *ctrl) 328 { 329 struct hantro_ctx *ctx; 330 331 ctx = container_of(ctrl->handler, 332 struct hantro_ctx, ctrl_handler); 333 334 switch (ctrl->id) { > 335 case V4L2_CID_STATELESS_AV1_SEQUENCE: > 336 ctx->bit_depth = ctrl->p_new.p_av1_sequence->bit_depth; 337 break; 338 default: 339 return -EINVAL; 340 } 341 342 return 0; 343 } 344
Le 19/12/2022 à 22:29, Ezequiel Garcia a écrit : > Bonjour Nicolas, > > On Mon, Dec 19, 2022 at 5:37 PM Nicolas Dufresne <nicolas@ndufresne.ca> wrote: >> Le lundi 19 décembre 2022 à 16:56 +0100, Benjamin Gaignard a écrit : >>> Store bit depth information from AV1 sequence control. >>> >>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> >>> --- >>> .../media/platform/verisilicon/hantro_drv.c | 26 +++++++++++++++++++ >>> 1 file changed, 26 insertions(+) >>> >>> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c >>> index 4500e1fc0f2c..8e93710dcfed 100644 >>> --- a/drivers/media/platform/verisilicon/hantro_drv.c >>> +++ b/drivers/media/platform/verisilicon/hantro_drv.c >>> @@ -324,6 +324,25 @@ static int hantro_vp9_s_ctrl(struct v4l2_ctrl *ctrl) >>> return 0; >>> } >>> >>> +static int hantro_av1_s_ctrl(struct v4l2_ctrl *ctrl) >>> +{ >>> + struct hantro_ctx *ctx; >>> + >>> + ctx = container_of(ctrl->handler, >>> + struct hantro_ctx, ctrl_handler); >>> + >>> + switch (ctrl->id) { >>> + case V4L2_CID_STATELESS_AV1_SEQUENCE: >>> + ctx->bit_depth = ctrl->p_new.p_av1_sequence->bit_depth; >> That seems a little be weak, what happens if you change the bit_depth with a >> non-request s_ctrl while its decoding ? To be this deserve a little bit of >> protection, a something that validate and copy it at the start of the decoding. >> > Oh, nice catch. We need to return EBUSY, see > https://www.kernel.org/doc/html/v5.0/media/uapi/v4l/buffer.html#interactions-between-formats-controls-and-buffers. > > There's already an API in the V4L2 control framework for drivers to use, > see v4l2_ctrl_grab in > https://www.kernel.org/doc/html/v5.0/media/kapi/v4l2-controls.html#active-and-grabbed-controls. > >> p.s. I know, VP9 seems similar, though arguably that was copied from jpeg, for >> which it seems totally save to change the quality at run-time. >> > No, wasn't copied from JPEG :-) I just didn't realize this was an > issue, but it is > given the bit_depth affects the buffers so you are correct, it needs > to be fixed for VP9 too. I will use v4l2_ctrl_grab() in codecs->ops init() and exit() functions but it will be on patch 7 because it where they appear for this codec. Benjamin > > Thanks! > Ezequiel > >>> + break; >>> + default: >>> + return -EINVAL; >>> + } >>> + >>> + return 0; >>> +} >>> + >>> + >>> static const struct v4l2_ctrl_ops hantro_ctrl_ops = { >>> .try_ctrl = hantro_try_ctrl, >>> }; >>> @@ -336,6 +355,12 @@ static const struct v4l2_ctrl_ops hantro_vp9_ctrl_ops = { >>> .s_ctrl = hantro_vp9_s_ctrl, >>> }; >>> >>> +static const struct v4l2_ctrl_ops hantro_av1_ctrl_ops = { >>> + .try_ctrl = hantro_try_ctrl, >>> + .s_ctrl = hantro_av1_s_ctrl, >>> +}; >>> + >>> + >>> #define HANTRO_JPEG_ACTIVE_MARKERS (V4L2_JPEG_ACTIVE_MARKER_APP0 | \ >>> V4L2_JPEG_ACTIVE_MARKER_COM | \ >>> V4L2_JPEG_ACTIVE_MARKER_DQT | \ >>> @@ -513,6 +538,7 @@ static const struct hantro_ctrl controls[] = { >>> .codec = HANTRO_AV1_DECODER, >>> .cfg = { >>> .id = V4L2_CID_STATELESS_AV1_SEQUENCE, >>> + .ops = &hantro_av1_ctrl_ops, >>> }, >>> }, { >>> .codec = HANTRO_AV1_DECODER,
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c index 4500e1fc0f2c..8e93710dcfed 100644 --- a/drivers/media/platform/verisilicon/hantro_drv.c +++ b/drivers/media/platform/verisilicon/hantro_drv.c @@ -324,6 +324,25 @@ static int hantro_vp9_s_ctrl(struct v4l2_ctrl *ctrl) return 0; } +static int hantro_av1_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct hantro_ctx *ctx; + + ctx = container_of(ctrl->handler, + struct hantro_ctx, ctrl_handler); + + switch (ctrl->id) { + case V4L2_CID_STATELESS_AV1_SEQUENCE: + ctx->bit_depth = ctrl->p_new.p_av1_sequence->bit_depth; + break; + default: + return -EINVAL; + } + + return 0; +} + + static const struct v4l2_ctrl_ops hantro_ctrl_ops = { .try_ctrl = hantro_try_ctrl, }; @@ -336,6 +355,12 @@ static const struct v4l2_ctrl_ops hantro_vp9_ctrl_ops = { .s_ctrl = hantro_vp9_s_ctrl, }; +static const struct v4l2_ctrl_ops hantro_av1_ctrl_ops = { + .try_ctrl = hantro_try_ctrl, + .s_ctrl = hantro_av1_s_ctrl, +}; + + #define HANTRO_JPEG_ACTIVE_MARKERS (V4L2_JPEG_ACTIVE_MARKER_APP0 | \ V4L2_JPEG_ACTIVE_MARKER_COM | \ V4L2_JPEG_ACTIVE_MARKER_DQT | \ @@ -513,6 +538,7 @@ static const struct hantro_ctrl controls[] = { .codec = HANTRO_AV1_DECODER, .cfg = { .id = V4L2_CID_STATELESS_AV1_SEQUENCE, + .ops = &hantro_av1_ctrl_ops, }, }, { .codec = HANTRO_AV1_DECODER,