aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2018-09-01 08:38:07 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-11 08:38:12 -0400
commit55f6fe09f14bc3aa690463027ad3f9cb6b9831ce (patch)
tree58cae91b9bbc6928dc016f00c8a19d6ea749daba
parent96cb579cc47380a22d3f64da7877e13a7566e296 (diff)
media: vicodec: fix wrong sizeimage
The initial sizeimage for the compressed decoder output was wrong. The size of the output was incorrectly used to calculate the image size, that should have been the size of the capture. Rework the code to fix this. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--drivers/media/platform/vicodec/vicodec-core.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c
index fdd77441a47b..47e9ad0941ab 100644
--- a/drivers/media/platform/vicodec/vicodec-core.c
+++ b/drivers/media/platform/vicodec/vicodec-core.c
@@ -1186,23 +1186,28 @@ static int vicodec_open(struct file *file)
1186 ctx->q_data[V4L2_M2M_SRC].height = 720; 1186 ctx->q_data[V4L2_M2M_SRC].height = 720;
1187 size = 1280 * 720 * ctx->q_data[V4L2_M2M_SRC].info->sizeimage_mult / 1187 size = 1280 * 720 * ctx->q_data[V4L2_M2M_SRC].info->sizeimage_mult /
1188 ctx->q_data[V4L2_M2M_SRC].info->sizeimage_div; 1188 ctx->q_data[V4L2_M2M_SRC].info->sizeimage_div;
1189 ctx->q_data[V4L2_M2M_SRC].sizeimage = size; 1189 if (ctx->is_enc)
1190 ctx->q_data[V4L2_M2M_SRC].sizeimage = size;
1191 else
1192 ctx->q_data[V4L2_M2M_SRC].sizeimage =
1193 size + sizeof(struct fwht_cframe_hdr);
1190 ctx->q_data[V4L2_M2M_DST] = ctx->q_data[V4L2_M2M_SRC]; 1194 ctx->q_data[V4L2_M2M_DST] = ctx->q_data[V4L2_M2M_SRC];
1191 ctx->q_data[V4L2_M2M_DST].info = 1195 ctx->q_data[V4L2_M2M_DST].info =
1192 ctx->is_enc ? &pixfmt_fwht : v4l2_fwht_get_pixfmt(0); 1196 ctx->is_enc ? &pixfmt_fwht : v4l2_fwht_get_pixfmt(0);
1193 size = 1280 * 720 * ctx->q_data[V4L2_M2M_DST].info->sizeimage_mult / 1197 size = 1280 * 720 * ctx->q_data[V4L2_M2M_DST].info->sizeimage_mult /
1194 ctx->q_data[V4L2_M2M_DST].info->sizeimage_div; 1198 ctx->q_data[V4L2_M2M_DST].info->sizeimage_div;
1195 ctx->q_data[V4L2_M2M_DST].sizeimage = size; 1199 if (ctx->is_enc)
1200 ctx->q_data[V4L2_M2M_DST].sizeimage =
1201 size + sizeof(struct fwht_cframe_hdr);
1202 else
1203 ctx->q_data[V4L2_M2M_DST].sizeimage = size;
1196 ctx->state.colorspace = V4L2_COLORSPACE_REC709; 1204 ctx->state.colorspace = V4L2_COLORSPACE_REC709;
1197 1205
1198 size += sizeof(struct fwht_cframe_hdr);
1199 if (ctx->is_enc) { 1206 if (ctx->is_enc) {
1200 ctx->q_data[V4L2_M2M_DST].sizeimage = size;
1201 ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->enc_dev, ctx, 1207 ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->enc_dev, ctx,
1202 &queue_init); 1208 &queue_init);
1203 ctx->lock = &dev->enc_lock; 1209 ctx->lock = &dev->enc_lock;
1204 } else { 1210 } else {
1205 ctx->q_data[V4L2_M2M_SRC].sizeimage = size;
1206 ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->dec_dev, ctx, 1211 ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->dec_dev, ctx,
1207 &queue_init); 1212 &queue_init);
1208 ctx->lock = &dev->dec_lock; 1213 ctx->lock = &dev->dec_lock;