Le 04/01/2023 à 20:33, Ezequiel Garcia a écrit :
Hi Benjamin,
Thanks for the patch.
On Tue, Jan 3, 2023 at 2:01 PM Benjamin Gaignard
<benjamin.gaignard@xxxxxxxxxxxxx> wrote:
The driver supports 8 and 10 bits bitstreams, make sure to discard
other cases.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxxxxx>
---
drivers/media/platform/verisilicon/hantro_drv.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 8e93710dcfed..16539e89935c 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -282,7 +282,13 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
/* We only support profile 0 */
if (dec_params->profile != 0)
return -EINVAL;
+ } else if (ctrl->id == V4L2_CID_STATELESS_AV1_SEQUENCE) {
+ const struct v4l2_ctrl_av1_sequence *sequence = ctrl->p_new.p_av1_sequence;
+
+ if (sequence->bit_depth != 8 && sequence->bit_depth != 10)
+ return -EINVAL;
}
+
return 0;
}
@@ -333,7 +339,13 @@ static int hantro_av1_s_ctrl(struct v4l2_ctrl *ctrl)
switch (ctrl->id) {
case V4L2_CID_STATELESS_AV1_SEQUENCE:
- ctx->bit_depth = ctrl->p_new.p_av1_sequence->bit_depth;
+ int bit_depth = ctrl->p_new.p_av1_sequence->bit_depth;
+
+ if (vb2_is_streaming(v4l2_m2m_get_src_vq(ctx->fh.m2m_ctx)))
+ if (ctx->bit_depth != bit_depth)
+ return -EINVAL;
+
Please use the v4l2_ctrl_grab API. Can you send a separate series to address
this for the other codecs?
I have tried to use v4l2_ctrl_grab API but when you grab a control you can set it anymore
and V4L2_CID_STATELESS_AV1_SEQUENCE is send for each frame so it blocks everything.
Benjamin
Thanks a lot!
Ezequiel
+ ctx->bit_depth = bit_depth;
break;
default:
return -EINVAL;
--
2.34.1