media: vicodec: set state->info before calling the encode/decode funcs
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 10 Sep 2018 15:00:40 +0000 (11:00 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 24 Sep 2018 13:12:06 +0000 (09:12 -0400)
state->info was NULL since I completely forgot to set state->info.
Oops.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
[hans.verkuil@cisco.com: re-add q_out which was removed by commit 703fe34bac]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vicodec/vicodec-core.c

index a044475d04699211a22bd0bfde02a7c38dd33995..152ac44b02772af9d3d2607993a5d0be08d35748 100644 (file)
@@ -175,12 +175,18 @@ static int device_process(struct vicodec_ctx *ctx,
        }
 
        if (ctx->is_enc) {
-               unsigned int size = v4l2_fwht_encode(state, p_in, p_out);
+               struct vicodec_q_data *q_out;
 
-               vb2_set_plane_payload(&out_vb->vb2_buf, 0, size);
+               q_out = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+               state->info = q_out->info;
+               ret = v4l2_fwht_encode(state, p_in, p_out);
+               if (ret < 0)
+                       return ret;
+               vb2_set_plane_payload(&out_vb->vb2_buf, 0, ret);
        } else {
+               state->info = q_cap->info;
                ret = v4l2_fwht_decode(state, p_in, p_out);
-               if (ret)
+               if (ret < 0)
                        return ret;
                vb2_set_plane_payload(&out_vb->vb2_buf, 0, q_cap->sizeimage);
        }