Commit daba4dfb authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Mauro Carvalho Chehab

[media] exynos-gsc: don't clear format when freeing buffers with REQBUFS(0)

User-space applications can use the VIDIOC_REQBUFS ioctl to determine if a
memory mapped, user pointer or DMABUF based I/O is supported by a driver.

For example, GStreamer attempts to determine the I/O methods supported by
the driver by doing many VIDIOC_REQBUFS ioctl calls with different memory
types and count 0. And then the real VIDIOC_REQBUFS call with count == n
is be made to allocate the buffers. But for count 0, the driver not only
frees the buffers but also clears the format set before with VIDIOC_S_FMT.

This is a problem since STREAMON fails if a format isn't set but GStreamer
first sets a format and then tries to determine the supported I/O methods,
so the format will be cleared on REQBUFS(0), before the call to STREAMON.

To avoid this issue, only free the buffers on VIDIOC_REQBUFS(0) but don't
clear the format. Since is completely valid to set the format and then do
different calls to REQBUFS before a call to STREAMON.
Signed-off-by: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent def2cc8c
......@@ -365,14 +365,8 @@ static int gsc_m2m_reqbufs(struct file *file, void *fh,
max_cnt = (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) ?
gsc->variant->in_buf_cnt : gsc->variant->out_buf_cnt;
if (reqbufs->count > max_cnt) {
if (reqbufs->count > max_cnt)
return -EINVAL;
} else if (reqbufs->count == 0) {
if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
gsc_ctx_state_lock_clear(GSC_SRC_FMT, ctx);
else
gsc_ctx_state_lock_clear(GSC_DST_FMT, ctx);
}
return v4l2_m2m_reqbufs(file, ctx->m2m_ctx, reqbufs);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment