summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-05-07 05:30:24 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-06-11 11:31:42 -0400
commit8307f0ab0331ad8b8bb8af85df372e6bfda688e7 (patch)
treeeb69cf3ac6587e34b9878da011a84243dd32677a
parentfbbbb2cd0b39acba0720354d4beb98f39b69a29f (diff)
media: vicodec: use correct sizeimage value when draining
After a resolution change is detected, q_data->sizeimage is updated to the new format, but buf_prepare is still draining buffers that need to use the old pre-resolution-change value. So store the sizeimage value in q_data->vb2_sizeimage in queue_setup and use that in buf_prepare. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--drivers/media/platform/vicodec/vicodec-core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c
index 4b0062ac880c..ce7f7bf1b998 100644
--- a/drivers/media/platform/vicodec/vicodec-core.c
+++ b/drivers/media/platform/vicodec/vicodec-core.c
@@ -84,6 +84,7 @@ struct vicodec_q_data {
unsigned int visible_width;
unsigned int visible_height;
unsigned int sizeimage;
+ unsigned int vb2_sizeimage;
unsigned int sequence;
const struct v4l2_fwht_pixfmt_info *info;
};
@@ -1361,6 +1362,7 @@ static int vicodec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
*nplanes = 1;
sizes[0] = size;
+ q_data->vb2_sizeimage = size;
return 0;
}
@@ -1391,11 +1393,11 @@ static int vicodec_buf_prepare(struct vb2_buffer *vb)
}
}
- if (vb2_plane_size(vb, 0) < q_data->sizeimage) {
+ if (vb2_plane_size(vb, 0) < q_data->vb2_sizeimage) {
dprintk(ctx->dev,
"%s data will not fit into plane (%lu < %lu)\n",
__func__, vb2_plane_size(vb, 0),
- (long)q_data->sizeimage);
+ (long)q_data->vb2_sizeimage);
return -EINVAL;
}