summaryrefslogtreecommitdiffstats
path: root/drivers/media/common/videobuf2/videobuf2-core.c
diff options
context:
space:
mode:
authorSergey Senozhatsky <senozhatsky@chromium.org>2021-09-09 13:24:29 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-09-30 10:07:57 +0200
commitc0acf9cfeee061f041fab778dbdcb34b6ca5e2e7 (patch)
treee30af680eb9ce6bfaa6bdae802905f7ab5ffe963 /drivers/media/common/videobuf2/videobuf2-core.c
parentb00a9e59c539684d9e105feafaeee36df11ee493 (diff)
downloadlinux-c0acf9cfeee061f041fab778dbdcb34b6ca5e2e7.tar.bz2
media: videobuf2: handle V4L2_MEMORY_FLAG_NON_COHERENT flag
This patch lets user-space request a non-coherent memory allocation during CREATE_BUFS and REQBUFS ioctl calls. = CREATE_BUFS struct v4l2_create_buffers has seven 4-byte reserved areas, so reserved[0] is renamed to ->flags. The struct, thus, now has six reserved 4-byte regions. = CREATE_BUFS32 struct v4l2_create_buffers32 has seven 4-byte reserved areas, so reserved[0] is renamed to ->flags. The struct, thus, now has six reserved 4-byte regions. = REQBUFS We use one byte of a 4 byte ->reserved[1] member of struct v4l2_requestbuffers. The struct, thus, now has reserved 3 bytes. Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/common/videobuf2/videobuf2-core.c')
-rw-r--r--drivers/media/common/videobuf2/videobuf2-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index 60fb43b8f134..2266bbd239ab 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -761,7 +761,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
{
unsigned int num_buffers, allocated_buffers, num_planes = 0;
unsigned plane_sizes[VB2_MAX_PLANES] = { };
- bool non_coherent_mem = false;
+ bool non_coherent_mem = flags & V4L2_MEMORY_FLAG_NON_COHERENT;
unsigned int i;
int ret;
@@ -905,7 +905,7 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
{
unsigned int num_planes = 0, num_buffers, allocated_buffers;
unsigned plane_sizes[VB2_MAX_PLANES] = { };
- bool non_coherent_mem = false;
+ bool non_coherent_mem = flags & V4L2_MEMORY_FLAG_NON_COHERENT;
int ret;
if (q->num_buffers == VB2_MAX_FRAME) {