diff mbox series

[PATCHv2] media: vicodec: add V4L2_CID_MIN_BUFFERS_FOR_* controls

Message ID 1159d3c9-10be-4856-8d1a-09acc8d5ddbe@xs4all.nl
State New
Headers show
Series [PATCHv2] media: vicodec: add V4L2_CID_MIN_BUFFERS_FOR_* controls | expand

Commit Message

Hans Verkuil Nov. 4, 2024, 5:26 p.m. UTC
Stateful codecs must support the V4L2_CID_MIN_BUFFERS_FOR_OUTPUT
and V4L2_CID_MIN_BUFFERS_FOR_CAPTURE controls. The vicodec driver
was missing support for these controls. Add them.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
---
Change since v1: V4L2_CID_MIN_BUFFERS_FOR_OUTPUT was already
supported, so that patch led to duplicated controls. That's now
fixed.
---
 drivers/media/test-drivers/vicodec/vicodec-core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c
index 00c84a06f343..60a644dc89a1 100644
--- a/drivers/media/test-drivers/vicodec/vicodec-core.c
+++ b/drivers/media/test-drivers/vicodec/vicodec-core.c
@@ -1852,9 +1852,12 @@  static int vicodec_open(struct file *file)
 			  1, 31, 1, 20);
 	v4l2_ctrl_new_std(hdl, &vicodec_ctrl_ops, V4L2_CID_FWHT_P_FRAME_QP,
 			  1, 31, 1, 20);
-	if (ctx->is_enc)
-		v4l2_ctrl_new_std(hdl, &vicodec_ctrl_ops,
-				  V4L2_CID_MIN_BUFFERS_FOR_OUTPUT, 1, 1, 1, 1);
+	if (!ctx->is_stateless)
+		v4l2_ctrl_new_std(hdl, &vicodec_ctrl_ops, ctx->is_enc ?
+				  V4L2_CID_MIN_BUFFERS_FOR_OUTPUT :
+				  V4L2_CID_MIN_BUFFERS_FOR_CAPTURE,
+				  2, 2, 1, 2);
+
 	if (ctx->is_stateless)
 		v4l2_ctrl_new_custom(hdl, &vicodec_ctrl_stateless_state, NULL);
 	if (hdl->error) {