Commit 0a08088f authored by Dillon Min's avatar Dillon Min Committed by Mauro Carvalho Chehab

media: v4l2-mem2mem: add v4l2_m2m_get_unmapped_area for no-mmu platform

For platforms without MMU the m2m provides a helper method
v4l2_m2m_get_unmapped_area(), The mmap() routines will call
this to get a proposed address for the mapping.

More detailed information about get_unmapped_area can be found in
Documentation/nommu-mmap.txt
Signed-off-by: default avatarDillon Min <dillon.minfei@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 68dda3e0
......@@ -966,6 +966,27 @@ int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
}
EXPORT_SYMBOL(v4l2_m2m_mmap);
#ifndef CONFIG_MMU
unsigned long v4l2_m2m_get_unmapped_area(struct file *file, unsigned long addr,
unsigned long len, unsigned long pgoff,
unsigned long flags)
{
struct v4l2_fh *fh = file->private_data;
unsigned long offset = pgoff << PAGE_SHIFT;
struct vb2_queue *vq;
if (offset < DST_QUEUE_OFF_BASE) {
vq = v4l2_m2m_get_src_vq(fh->m2m_ctx);
} else {
vq = v4l2_m2m_get_dst_vq(fh->m2m_ctx);
pgoff -= (DST_QUEUE_OFF_BASE >> PAGE_SHIFT);
}
return vb2_get_unmapped_area(vq, addr, len, pgoff, flags);
}
EXPORT_SYMBOL_GPL(v4l2_m2m_get_unmapped_area);
#endif
#if defined(CONFIG_MEDIA_CONTROLLER)
void v4l2_m2m_unregister_media_controller(struct v4l2_m2m_dev *m2m_dev)
{
......
......@@ -495,6 +495,11 @@ __poll_t v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
struct vm_area_struct *vma);
#ifndef CONFIG_MMU
unsigned long v4l2_m2m_get_unmapped_area(struct file *file, unsigned long addr,
unsigned long len, unsigned long pgoff,
unsigned long flags);
#endif
/**
* v4l2_m2m_init() - initialize per-driver m2m data
*
......
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