The driver only supports per-slice decoding, and in that mode
decode_params->num_slices must be set to 1 and the slice_params array
should contain only one element.

The current code already had this limitation but it made it look like
the slice_params control was a single struct while, according to the
spec, it's actually an array. Make it more explicit by setting dims[0]
and adding a comment explaining why we have this limitation.

Signed-off-by: Boris Brezillon <boris.brezil...@collabora.com>
---
 drivers/staging/media/sunxi/cedrus/cedrus.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c 
b/drivers/staging/media/sunxi/cedrus/cedrus.c
index 378032fe71f9..3661c6a04864 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
@@ -49,6 +49,12 @@ static const struct cedrus_control cedrus_controls[] = {
        {
                .cfg.id         = V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS,
                .cfg.elem_size  = sizeof(struct v4l2_ctrl_h264_slice_params),
+               /*
+                * This driver does not support per-frame decoding (yet?).
+                * Allow only on per-slice decoding operation, which implies
+                * that only 1 slice param is passed per decoding operation.
+                */
+               .cfg.dims[0]    = 1,
                .codec          = CEDRUS_CODEC_H264,
                .required       = true,
        },
-- 
2.20.1

Reply via email to