diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2015-03-24 20:30:51 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-10 16:06:46 +0300 |
commit | 73751da61c00db9914ae1c47a25f7462722bc76b (patch) | |
tree | 33a095f7aa8aabe88375b55a032ee3ed2e1f4f24 /drivers/media/platform/coda/coda-common.c | |
parent | bf249daf079492d60306ad1c5c78d53255ff15a3 (diff) | |
download | linux-73751da61c00db9914ae1c47a25f7462722bc76b.tar.xz |
[media] coda: allocate per-context buffers from REQBUFS
Allocate the per-context buffers from REQBUFS instead in start_encoding or
start_decoding. This allows to stop and start streaming independently of
buffer (re)allocation
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/coda/coda-common.c')
-rw-r--r-- | drivers/media/platform/coda/coda-common.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index 443886535230..a8a6c36a1f00 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -696,6 +696,26 @@ static int coda_s_fmt_vid_out(struct file *file, void *priv, return coda_s_fmt(ctx, &f_cap); } +static int coda_reqbufs(struct file *file, void *priv, + struct v4l2_requestbuffers *rb) +{ + struct coda_ctx *ctx = fh_to_ctx(priv); + int ret; + + ret = v4l2_m2m_reqbufs(file, ctx->fh.m2m_ctx, rb); + if (ret) + return ret; + + /* + * Allow to allocate instance specific per-context buffers, such as + * bitstream ringbuffer, slice buffer, work buffer, etc. if needed. + */ + if (rb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && ctx->ops->reqbufs) + return ctx->ops->reqbufs(ctx, rb); + + return 0; +} + static int coda_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { @@ -841,7 +861,7 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = { .vidioc_try_fmt_vid_out = coda_try_fmt_vid_out, .vidioc_s_fmt_vid_out = coda_s_fmt_vid_out, - .vidioc_reqbufs = v4l2_m2m_ioctl_reqbufs, + .vidioc_reqbufs = coda_reqbufs, .vidioc_querybuf = v4l2_m2m_ioctl_querybuf, .vidioc_qbuf = coda_qbuf, |