tristate
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
-@@ -439,6 +439,7 @@ int v4l2_m2m_create_bufs(struct file *fi
+@@ -440,6 +440,7 @@ int v4l2_m2m_create_bufs(struct file *fi
}
EXPORT_SYMBOL_GPL(v4l2_m2m_create_bufs);
/**
* v4l2_m2m_expbuf() - export a source or destination buffer, depending on
* the type
-@@ -452,6 +453,7 @@ int v4l2_m2m_expbuf(struct file *file, s
+@@ -453,6 +454,7 @@ int v4l2_m2m_expbuf(struct file *file, s
return vb2_expbuf(vq, eb);
}
EXPORT_SYMBOL_GPL(v4l2_m2m_expbuf);
/**
* v4l2_m2m_streamon() - turn on streaming for a video queue
*/
-@@ -798,6 +800,7 @@ int v4l2_m2m_ioctl_dqbuf(struct file *fi
+@@ -803,6 +805,7 @@ int v4l2_m2m_ioctl_dqbuf(struct file *fi
}
EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_dqbuf);
int v4l2_m2m_ioctl_expbuf(struct file *file, void *priv,
struct v4l2_exportbuffer *eb)
{
-@@ -806,6 +809,7 @@ int v4l2_m2m_ioctl_expbuf(struct file *f
+@@ -811,6 +814,7 @@ int v4l2_m2m_ioctl_expbuf(struct file *f
return v4l2_m2m_expbuf(file, fh->m2m_ctx, eb);
}
EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_expbuf);
else
__vb2_buf_userptr_put(vb);
}
-@@ -777,6 +781,7 @@ static int __verify_mmap_ops(struct vb2_
+@@ -781,6 +785,7 @@ static int __verify_mmap_ops(struct vb2_
return 0;
}
/**
* __verify_dmabuf_ops() - verify that all memory operations required for
* DMABUF queue type have been provided
-@@ -790,6 +795,7 @@ static int __verify_dmabuf_ops(struct vb
+@@ -794,6 +799,7 @@ static int __verify_dmabuf_ops(struct vb
return 0;
}
/**
* __verify_memory_type() - Check whether the memory type and buffer type
-@@ -823,10 +829,12 @@ static int __verify_memory_type(struct v
+@@ -827,10 +833,12 @@ static int __verify_memory_type(struct v
return -EINVAL;
}
/*
* Place the busy tests at the end: -EBUSY can be ignored when
-@@ -1445,6 +1453,7 @@ err:
+@@ -1443,6 +1451,7 @@ err:
return ret;
}
/**
* __qbuf_dmabuf() - handle qbuf of a DMABUF buffer
*/
-@@ -1562,6 +1571,7 @@ err:
+@@ -1560,6 +1569,7 @@ err:
return ret;
}
/**
* __enqueue_in_driver() - enqueue a vb2_buffer in driver for processing
-@@ -1637,9 +1647,11 @@ static int __buf_prepare(struct vb2_buff
+@@ -1640,9 +1650,11 @@ static int __buf_prepare(struct vb2_buff
up_read(mmap_sem);
break;
default:
WARN(1, "Invalid queue type\n");
ret = -EINVAL;
-@@ -2004,8 +2016,10 @@ EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffe
+@@ -2015,8 +2027,10 @@ EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffe
*/
static void __vb2_dqbuf(struct vb2_buffer *vb)
{
/* nothing to do if the buffer is already dequeued */
if (vb->state == VB2_BUF_STATE_DEQUEUED)
-@@ -2013,6 +2027,7 @@ static void __vb2_dqbuf(struct vb2_buffe
+@@ -2024,6 +2038,7 @@ static void __vb2_dqbuf(struct vb2_buffe
vb->state = VB2_BUF_STATE_DEQUEUED;
/* unmap DMABUF buffer */
if (q->memory == V4L2_MEMORY_DMABUF)
for (i = 0; i < vb->num_planes; ++i) {
-@@ -2021,6 +2036,7 @@ static void __vb2_dqbuf(struct vb2_buffe
+@@ -2032,6 +2047,7 @@ static void __vb2_dqbuf(struct vb2_buffe
call_void_memop(vb, unmap_dmabuf, vb->planes[i].mem_priv);
vb->planes[i].dbuf_mapped = 0;
}
}
static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking)
-@@ -2298,6 +2314,7 @@ static int __find_plane_by_offset(struct
+@@ -2331,6 +2347,7 @@ static int __find_plane_by_offset(struct
return -EINVAL;
}
/**
* vb2_expbuf() - Export a buffer as a file descriptor
* @q: videobuf2 queue
-@@ -2375,6 +2392,7 @@ int vb2_expbuf(struct vb2_queue *q, stru
+@@ -2408,6 +2425,7 @@ int vb2_expbuf(struct vb2_queue *q, stru
return 0;
}
EXPORT_SYMBOL_GPL(vb2_expbuf);
/**
* vb2_mmap() - map video buffers into application address space
-@@ -3290,6 +3308,7 @@ int vb2_ioctl_streamoff(struct file *fil
+@@ -3324,6 +3342,7 @@ int vb2_ioctl_streamoff(struct file *fil
}
EXPORT_SYMBOL_GPL(vb2_ioctl_streamoff);
int vb2_ioctl_expbuf(struct file *file, void *priv, struct v4l2_exportbuffer *p)
{
struct video_device *vdev = video_devdata(file);
-@@ -3299,6 +3318,7 @@ int vb2_ioctl_expbuf(struct file *file,
+@@ -3333,6 +3352,7 @@ int vb2_ioctl_expbuf(struct file *file,
return vb2_expbuf(vdev->queue, p);
}
EXPORT_SYMBOL_GPL(vb2_ioctl_expbuf);
/*********************************************/
/* DMABUF ops for exporters */
/*********************************************/
-@@ -460,6 +461,7 @@ static struct dma_buf *vb2_dc_get_dmabuf
+@@ -463,6 +466,7 @@ static struct dma_buf *vb2_dc_get_dmabuf
return dbuf;
}
/*********************************************/
/* callbacks for USERPTR buffers */
-@@ -744,6 +746,7 @@ fail_buf:
+@@ -747,6 +751,7 @@ fail_buf:
return ERR_PTR(ret);
}
.num_users = vb2_vmalloc_num_users,
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
-@@ -117,8 +117,10 @@ int v4l2_m2m_dqbuf(struct file *file, st
+@@ -119,8 +119,10 @@ int v4l2_m2m_dqbuf(struct file *file, st
int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
struct v4l2_create_buffers *create);
int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
enum v4l2_buf_type type);
-@@ -240,8 +242,10 @@ int v4l2_m2m_ioctl_create_bufs(struct fi
+@@ -242,8 +244,10 @@ int v4l2_m2m_ioctl_create_bufs(struct fi
struct v4l2_create_buffers *create);
int v4l2_m2m_ioctl_querybuf(struct file *file, void *fh,
struct v4l2_buffer *buf);
void *(*vaddr)(void *buf_priv);
void *(*cookie)(void *buf_priv);
-@@ -446,7 +450,9 @@ int __must_check vb2_queue_init(struct v
- void vb2_queue_release(struct vb2_queue *q);
+@@ -449,7 +453,9 @@ void vb2_queue_release(struct vb2_queue
+ void vb2_queue_error(struct vb2_queue *q);
int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking);
int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type);
-@@ -602,8 +608,10 @@ int vb2_ioctl_qbuf(struct file *file, vo
+@@ -605,8 +611,10 @@ int vb2_ioctl_qbuf(struct file *file, vo
int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p);
int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i);
int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i);