diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2012-08-29 08:22:00 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-09-26 16:56:56 -0300 |
commit | e34db0661dc7945e5412a568f38dd170c78099d1 (patch) | |
tree | 073feee74fba84ca16e2914868462a4b563a8a8e | |
parent | c566c78900acf38d6f2d004674b9cb062bbe3671 (diff) | |
download | linux-e34db0661dc7945e5412a568f38dd170c78099d1.tar.bz2 |
[media] media: coda: set up buffers to be sized as negotiated with s_fmt
This fixes a failure in vb2_qbuf in user pointer mode where
__qbuf_userptr checks if the buffer queued by userspace is large
enough. The failure would happen if coda_queue_setup was called
with empty fmt (and thus set the expected buffer size to the maximum
resolution), and userspace queues buffers of smaller size -
corresponding to the negotiated dimensions - were queued.
Explicitly setting sizeimage to the value negotiated via s_fmt
fixes the issue.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/platform/coda.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index bf8cb0a317bd..cd04ae252c30 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c @@ -818,18 +818,11 @@ static int coda_queue_setup(struct vb2_queue *vq, unsigned int sizes[], void *alloc_ctxs[]) { struct coda_ctx *ctx = vb2_get_drv_priv(vq); + struct coda_q_data *q_data; unsigned int size; - if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { - if (fmt) - size = fmt->fmt.pix.width * - fmt->fmt.pix.height * 3 / 2; - else - size = MAX_W * - MAX_H * 3 / 2; - } else { - size = CODA_MAX_FRAME_SIZE; - } + q_data = get_q_data(ctx, vq->type); + size = q_data->sizeimage; *nplanes = 1; sizes[0] = size; |