diff options
Diffstat (limited to 'drivers/media/video/s5p-fimc/fimc-capture.c')
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-capture.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 520217758c04..be5e4e237297 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -248,28 +248,37 @@ int fimc_capture_resume(struct fimc_dev *fimc) | |||
248 | 248 | ||
249 | } | 249 | } |
250 | 250 | ||
251 | static unsigned int get_plane_size(struct fimc_frame *fr, unsigned int plane) | 251 | static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, |
252 | { | ||
253 | if (!fr || plane >= fr->fmt->memplanes) | ||
254 | return 0; | ||
255 | return fr->f_width * fr->f_height * fr->fmt->depth[plane] / 8; | ||
256 | } | ||
257 | |||
258 | static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, | ||
259 | unsigned int *num_buffers, unsigned int *num_planes, | 252 | unsigned int *num_buffers, unsigned int *num_planes, |
260 | unsigned int sizes[], void *allocators[]) | 253 | unsigned int sizes[], void *allocators[]) |
261 | { | 254 | { |
255 | const struct v4l2_pix_format_mplane *pixm = NULL; | ||
262 | struct fimc_ctx *ctx = vq->drv_priv; | 256 | struct fimc_ctx *ctx = vq->drv_priv; |
263 | struct fimc_fmt *fmt = ctx->d_frame.fmt; | 257 | struct fimc_frame *frame = &ctx->d_frame; |
258 | struct fimc_fmt *fmt = frame->fmt; | ||
259 | unsigned long wh; | ||
264 | int i; | 260 | int i; |
265 | 261 | ||
266 | if (!fmt) | 262 | if (pfmt) { |
263 | pixm = &pfmt->fmt.pix_mp; | ||
264 | fmt = fimc_find_format(&pixm->pixelformat, NULL, | ||
265 | FMT_FLAGS_CAM | FMT_FLAGS_M2M, -1); | ||
266 | wh = pixm->width * pixm->height; | ||
267 | } else { | ||
268 | wh = frame->f_width * frame->f_height; | ||
269 | } | ||
270 | |||
271 | if (fmt == NULL) | ||
267 | return -EINVAL; | 272 | return -EINVAL; |
268 | 273 | ||
269 | *num_planes = fmt->memplanes; | 274 | *num_planes = fmt->memplanes; |
270 | 275 | ||
271 | for (i = 0; i < fmt->memplanes; i++) { | 276 | for (i = 0; i < fmt->memplanes; i++) { |
272 | sizes[i] = get_plane_size(&ctx->d_frame, i); | 277 | unsigned int size = (wh * fmt->depth[i]) / 8; |
278 | if (pixm) | ||
279 | sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); | ||
280 | else | ||
281 | sizes[i] = size; | ||
273 | allocators[i] = ctx->fimc_dev->alloc_ctx; | 282 | allocators[i] = ctx->fimc_dev->alloc_ctx; |
274 | } | 283 | } |
275 | 284 | ||