|
@@ -27,10 +27,10 @@
|
|
static int debug;
|
|
static int debug;
|
|
module_param(debug, int, 0644);
|
|
module_param(debug, int, 0644);
|
|
|
|
|
|
-#define dprintk(level, fmt, arg...) \
|
|
|
|
- do { \
|
|
|
|
- if (debug >= level) \
|
|
|
|
- printk(KERN_DEBUG "vb2: " fmt, ## arg); \
|
|
|
|
|
|
+#define dprintk(level, fmt, arg...) \
|
|
|
|
+ do { \
|
|
|
|
+ if (debug >= level) \
|
|
|
|
+ pr_debug("vb2: %s: " fmt, __func__, ## arg); \
|
|
} while (0)
|
|
} while (0)
|
|
|
|
|
|
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
|
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
|
@@ -444,7 +444,7 @@ static int __vb2_queue_free(struct vb2_queue *q, unsigned int buffers)
|
|
if (q->bufs[buffer] == NULL)
|
|
if (q->bufs[buffer] == NULL)
|
|
continue;
|
|
continue;
|
|
if (q->bufs[buffer]->state == VB2_BUF_STATE_PREPARING) {
|
|
if (q->bufs[buffer]->state == VB2_BUF_STATE_PREPARING) {
|
|
- dprintk(1, "reqbufs: preparing buffers, cannot free\n");
|
|
|
|
|
|
+ dprintk(1, "preparing buffers, cannot free\n");
|
|
return -EAGAIN;
|
|
return -EAGAIN;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -729,12 +729,12 @@ int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b)
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
if (b->type != q->type) {
|
|
if (b->type != q->type) {
|
|
- dprintk(1, "querybuf: wrong buffer type\n");
|
|
|
|
|
|
+ dprintk(1, "wrong buffer type\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (b->index >= q->num_buffers) {
|
|
if (b->index >= q->num_buffers) {
|
|
- dprintk(1, "querybuf: buffer index out of range\n");
|
|
|
|
|
|
+ dprintk(1, "buffer index out of range\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
vb = q->bufs[b->index];
|
|
vb = q->bufs[b->index];
|
|
@@ -794,12 +794,12 @@ static int __verify_memory_type(struct vb2_queue *q,
|
|
{
|
|
{
|
|
if (memory != V4L2_MEMORY_MMAP && memory != V4L2_MEMORY_USERPTR &&
|
|
if (memory != V4L2_MEMORY_MMAP && memory != V4L2_MEMORY_USERPTR &&
|
|
memory != V4L2_MEMORY_DMABUF) {
|
|
memory != V4L2_MEMORY_DMABUF) {
|
|
- dprintk(1, "reqbufs: unsupported memory type\n");
|
|
|
|
|
|
+ dprintk(1, "unsupported memory type\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (type != q->type) {
|
|
if (type != q->type) {
|
|
- dprintk(1, "reqbufs: requested type is incorrect\n");
|
|
|
|
|
|
+ dprintk(1, "requested type is incorrect\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -808,17 +808,17 @@ static int __verify_memory_type(struct vb2_queue *q,
|
|
* are available.
|
|
* are available.
|
|
*/
|
|
*/
|
|
if (memory == V4L2_MEMORY_MMAP && __verify_mmap_ops(q)) {
|
|
if (memory == V4L2_MEMORY_MMAP && __verify_mmap_ops(q)) {
|
|
- dprintk(1, "reqbufs: MMAP for current setup unsupported\n");
|
|
|
|
|
|
+ dprintk(1, "MMAP for current setup unsupported\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (memory == V4L2_MEMORY_USERPTR && __verify_userptr_ops(q)) {
|
|
if (memory == V4L2_MEMORY_USERPTR && __verify_userptr_ops(q)) {
|
|
- dprintk(1, "reqbufs: USERPTR for current setup unsupported\n");
|
|
|
|
|
|
+ dprintk(1, "USERPTR for current setup unsupported\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (memory == V4L2_MEMORY_DMABUF && __verify_dmabuf_ops(q)) {
|
|
if (memory == V4L2_MEMORY_DMABUF && __verify_dmabuf_ops(q)) {
|
|
- dprintk(1, "reqbufs: DMABUF for current setup unsupported\n");
|
|
|
|
|
|
+ dprintk(1, "DMABUF for current setup unsupported\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -828,7 +828,7 @@ static int __verify_memory_type(struct vb2_queue *q,
|
|
* do the memory and type validation.
|
|
* do the memory and type validation.
|
|
*/
|
|
*/
|
|
if (q->fileio) {
|
|
if (q->fileio) {
|
|
- dprintk(1, "reqbufs: file io in progress\n");
|
|
|
|
|
|
+ dprintk(1, "file io in progress\n");
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
@@ -863,7 +863,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
if (q->streaming) {
|
|
if (q->streaming) {
|
|
- dprintk(1, "reqbufs: streaming active\n");
|
|
|
|
|
|
+ dprintk(1, "streaming active\n");
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -873,7 +873,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
|
|
* are not in use and can be freed.
|
|
* are not in use and can be freed.
|
|
*/
|
|
*/
|
|
if (q->memory == V4L2_MEMORY_MMAP && __buffers_in_use(q)) {
|
|
if (q->memory == V4L2_MEMORY_MMAP && __buffers_in_use(q)) {
|
|
- dprintk(1, "reqbufs: memory in use, cannot free\n");
|
|
|
|
|
|
+ dprintk(1, "memory in use, cannot free\n");
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1000,8 +1000,7 @@ static int __create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
if (q->num_buffers == VIDEO_MAX_FRAME) {
|
|
if (q->num_buffers == VIDEO_MAX_FRAME) {
|
|
- dprintk(1, "%s(): maximum number of buffers already allocated\n",
|
|
|
|
- __func__);
|
|
|
|
|
|
+ dprintk(1, "maximum number of buffers already allocated\n");
|
|
return -ENOBUFS;
|
|
return -ENOBUFS;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1329,12 +1328,12 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
&& vb->v4l2_planes[plane].length == planes[plane].length)
|
|
&& vb->v4l2_planes[plane].length == planes[plane].length)
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- dprintk(3, "qbuf: userspace address for plane %d changed, "
|
|
|
|
|
|
+ dprintk(3, "userspace address for plane %d changed, "
|
|
"reacquiring memory\n", plane);
|
|
"reacquiring memory\n", plane);
|
|
|
|
|
|
/* Check if the provided plane buffer is large enough */
|
|
/* Check if the provided plane buffer is large enough */
|
|
if (planes[plane].length < q->plane_sizes[plane]) {
|
|
if (planes[plane].length < q->plane_sizes[plane]) {
|
|
- dprintk(1, "qbuf: provided buffer size %u is less than "
|
|
|
|
|
|
+ dprintk(1, "provided buffer size %u is less than "
|
|
"setup size %u for plane %d\n",
|
|
"setup size %u for plane %d\n",
|
|
planes[plane].length,
|
|
planes[plane].length,
|
|
q->plane_sizes[plane], plane);
|
|
q->plane_sizes[plane], plane);
|
|
@@ -1359,7 +1358,7 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
planes[plane].m.userptr,
|
|
planes[plane].m.userptr,
|
|
planes[plane].length, write);
|
|
planes[plane].length, write);
|
|
if (IS_ERR_OR_NULL(mem_priv)) {
|
|
if (IS_ERR_OR_NULL(mem_priv)) {
|
|
- dprintk(1, "qbuf: failed acquiring userspace "
|
|
|
|
|
|
+ dprintk(1, "failed acquiring userspace "
|
|
"memory for plane %d\n", plane);
|
|
"memory for plane %d\n", plane);
|
|
ret = mem_priv ? PTR_ERR(mem_priv) : -EINVAL;
|
|
ret = mem_priv ? PTR_ERR(mem_priv) : -EINVAL;
|
|
goto err;
|
|
goto err;
|
|
@@ -1382,14 +1381,14 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
*/
|
|
*/
|
|
ret = call_vb_qop(vb, buf_init, vb);
|
|
ret = call_vb_qop(vb, buf_init, vb);
|
|
if (ret) {
|
|
if (ret) {
|
|
- dprintk(1, "qbuf: buffer initialization failed\n");
|
|
|
|
|
|
+ dprintk(1, "buffer initialization failed\n");
|
|
goto err;
|
|
goto err;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
ret = call_vb_qop(vb, buf_prepare, vb);
|
|
ret = call_vb_qop(vb, buf_prepare, vb);
|
|
if (ret) {
|
|
if (ret) {
|
|
- dprintk(1, "qbuf: buffer preparation failed\n");
|
|
|
|
|
|
+ dprintk(1, "buffer preparation failed\n");
|
|
call_void_vb_qop(vb, buf_cleanup, vb);
|
|
call_void_vb_qop(vb, buf_cleanup, vb);
|
|
goto err;
|
|
goto err;
|
|
}
|
|
}
|
|
@@ -1438,7 +1437,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
struct dma_buf *dbuf = dma_buf_get(planes[plane].m.fd);
|
|
struct dma_buf *dbuf = dma_buf_get(planes[plane].m.fd);
|
|
|
|
|
|
if (IS_ERR_OR_NULL(dbuf)) {
|
|
if (IS_ERR_OR_NULL(dbuf)) {
|
|
- dprintk(1, "qbuf: invalid dmabuf fd for plane %d\n",
|
|
|
|
|
|
+ dprintk(1, "invalid dmabuf fd for plane %d\n",
|
|
plane);
|
|
plane);
|
|
ret = -EINVAL;
|
|
ret = -EINVAL;
|
|
goto err;
|
|
goto err;
|
|
@@ -1449,7 +1448,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
planes[plane].length = dbuf->size;
|
|
planes[plane].length = dbuf->size;
|
|
|
|
|
|
if (planes[plane].length < q->plane_sizes[plane]) {
|
|
if (planes[plane].length < q->plane_sizes[plane]) {
|
|
- dprintk(1, "qbuf: invalid dmabuf length for plane %d\n",
|
|
|
|
|
|
+ dprintk(1, "invalid dmabuf length for plane %d\n",
|
|
plane);
|
|
plane);
|
|
ret = -EINVAL;
|
|
ret = -EINVAL;
|
|
goto err;
|
|
goto err;
|
|
@@ -1462,7 +1461,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- dprintk(1, "qbuf: buffer for plane %d changed\n", plane);
|
|
|
|
|
|
+ dprintk(1, "buffer for plane %d changed\n", plane);
|
|
|
|
|
|
if (!reacquired) {
|
|
if (!reacquired) {
|
|
reacquired = true;
|
|
reacquired = true;
|
|
@@ -1477,7 +1476,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
mem_priv = call_ptr_memop(vb, attach_dmabuf, q->alloc_ctx[plane],
|
|
mem_priv = call_ptr_memop(vb, attach_dmabuf, q->alloc_ctx[plane],
|
|
dbuf, planes[plane].length, write);
|
|
dbuf, planes[plane].length, write);
|
|
if (IS_ERR(mem_priv)) {
|
|
if (IS_ERR(mem_priv)) {
|
|
- dprintk(1, "qbuf: failed to attach dmabuf\n");
|
|
|
|
|
|
+ dprintk(1, "failed to attach dmabuf\n");
|
|
ret = PTR_ERR(mem_priv);
|
|
ret = PTR_ERR(mem_priv);
|
|
dma_buf_put(dbuf);
|
|
dma_buf_put(dbuf);
|
|
goto err;
|
|
goto err;
|
|
@@ -1494,7 +1493,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
for (plane = 0; plane < vb->num_planes; ++plane) {
|
|
for (plane = 0; plane < vb->num_planes; ++plane) {
|
|
ret = call_memop(vb, map_dmabuf, vb->planes[plane].mem_priv);
|
|
ret = call_memop(vb, map_dmabuf, vb->planes[plane].mem_priv);
|
|
if (ret) {
|
|
if (ret) {
|
|
- dprintk(1, "qbuf: failed to map dmabuf for plane %d\n",
|
|
|
|
|
|
+ dprintk(1, "failed to map dmabuf for plane %d\n",
|
|
plane);
|
|
plane);
|
|
goto err;
|
|
goto err;
|
|
}
|
|
}
|
|
@@ -1515,14 +1514,14 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
*/
|
|
*/
|
|
ret = call_vb_qop(vb, buf_init, vb);
|
|
ret = call_vb_qop(vb, buf_init, vb);
|
|
if (ret) {
|
|
if (ret) {
|
|
- dprintk(1, "qbuf: buffer initialization failed\n");
|
|
|
|
|
|
+ dprintk(1, "buffer initialization failed\n");
|
|
goto err;
|
|
goto err;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
ret = call_vb_qop(vb, buf_prepare, vb);
|
|
ret = call_vb_qop(vb, buf_prepare, vb);
|
|
if (ret) {
|
|
if (ret) {
|
|
- dprintk(1, "qbuf: buffer preparation failed\n");
|
|
|
|
|
|
+ dprintk(1, "buffer preparation failed\n");
|
|
call_void_vb_qop(vb, buf_cleanup, vb);
|
|
call_void_vb_qop(vb, buf_cleanup, vb);
|
|
goto err;
|
|
goto err;
|
|
}
|
|
}
|
|
@@ -1561,8 +1560,7 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
|
|
|
|
ret = __verify_length(vb, b);
|
|
ret = __verify_length(vb, b);
|
|
if (ret < 0) {
|
|
if (ret < 0) {
|
|
- dprintk(1, "%s(): plane parameters verification failed: %d\n",
|
|
|
|
- __func__, ret);
|
|
|
|
|
|
+ dprintk(1, "plane parameters verification failed: %d\n", ret);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1606,7 +1604,7 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b)
|
|
}
|
|
}
|
|
|
|
|
|
if (ret)
|
|
if (ret)
|
|
- dprintk(1, "qbuf: buffer preparation failed: %d\n", ret);
|
|
|
|
|
|
+ dprintk(1, "buffer preparation failed: %d\n", ret);
|
|
vb->state = ret ? VB2_BUF_STATE_DEQUEUED : VB2_BUF_STATE_PREPARED;
|
|
vb->state = ret ? VB2_BUF_STATE_DEQUEUED : VB2_BUF_STATE_PREPARED;
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
@@ -1616,23 +1614,23 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b,
|
|
const char *opname)
|
|
const char *opname)
|
|
{
|
|
{
|
|
if (b->type != q->type) {
|
|
if (b->type != q->type) {
|
|
- dprintk(1, "%s(): invalid buffer type\n", opname);
|
|
|
|
|
|
+ dprintk(1, "%s: invalid buffer type\n", opname);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (b->index >= q->num_buffers) {
|
|
if (b->index >= q->num_buffers) {
|
|
- dprintk(1, "%s(): buffer index out of range\n", opname);
|
|
|
|
|
|
+ dprintk(1, "%s: buffer index out of range\n", opname);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (q->bufs[b->index] == NULL) {
|
|
if (q->bufs[b->index] == NULL) {
|
|
/* Should never happen */
|
|
/* Should never happen */
|
|
- dprintk(1, "%s(): buffer is NULL\n", opname);
|
|
|
|
|
|
+ dprintk(1, "%s: buffer is NULL\n", opname);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (b->memory != q->memory) {
|
|
if (b->memory != q->memory) {
|
|
- dprintk(1, "%s(): invalid memory type\n", opname);
|
|
|
|
|
|
+ dprintk(1, "%s: invalid memory type\n", opname);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1660,7 +1658,7 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b)
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
if (q->fileio) {
|
|
if (q->fileio) {
|
|
- dprintk(1, "%s(): file io in progress\n", __func__);
|
|
|
|
|
|
+ dprintk(1, "file io in progress\n");
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1670,7 +1668,7 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b)
|
|
|
|
|
|
vb = q->bufs[b->index];
|
|
vb = q->bufs[b->index];
|
|
if (vb->state != VB2_BUF_STATE_DEQUEUED) {
|
|
if (vb->state != VB2_BUF_STATE_DEQUEUED) {
|
|
- dprintk(1, "%s(): invalid buffer state %d\n", __func__,
|
|
|
|
|
|
+ dprintk(1, "invalid buffer state %d\n",
|
|
vb->state);
|
|
vb->state);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
@@ -1680,7 +1678,7 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b)
|
|
/* Fill buffer information for the userspace */
|
|
/* Fill buffer information for the userspace */
|
|
__fill_v4l2_buffer(vb, b);
|
|
__fill_v4l2_buffer(vb, b);
|
|
|
|
|
|
- dprintk(1, "%s() of buffer %d succeeded\n", __func__, vb->v4l2_buf.index);
|
|
|
|
|
|
+ dprintk(1, "prepare of buffer %d succeeded\n", vb->v4l2_buf.index);
|
|
}
|
|
}
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -1716,7 +1714,7 @@ static int vb2_start_streaming(struct vb2_queue *q)
|
|
if (!ret)
|
|
if (!ret)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- dprintk(1, "qbuf: driver refused to start streaming\n");
|
|
|
|
|
|
+ dprintk(1, "driver refused to start streaming\n");
|
|
if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
|
|
if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
|
|
unsigned i;
|
|
unsigned i;
|
|
|
|
|
|
@@ -1754,11 +1752,10 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b)
|
|
case VB2_BUF_STATE_PREPARED:
|
|
case VB2_BUF_STATE_PREPARED:
|
|
break;
|
|
break;
|
|
case VB2_BUF_STATE_PREPARING:
|
|
case VB2_BUF_STATE_PREPARING:
|
|
- dprintk(1, "qbuf: buffer still being prepared\n");
|
|
|
|
|
|
+ dprintk(1, "buffer still being prepared\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
default:
|
|
default:
|
|
- dprintk(1, "%s(): invalid buffer state %d\n", __func__,
|
|
|
|
- vb->state);
|
|
|
|
|
|
+ dprintk(1, "invalid buffer state %d\n", vb->state);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1805,7 +1802,7 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
- dprintk(1, "%s() of buffer %d succeeded\n", __func__, vb->v4l2_buf.index);
|
|
|
|
|
|
+ dprintk(1, "qbuf of buffer %d succeeded\n", vb->v4l2_buf.index);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1829,7 +1826,7 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b)
|
|
int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b)
|
|
int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b)
|
|
{
|
|
{
|
|
if (q->fileio) {
|
|
if (q->fileio) {
|
|
- dprintk(1, "%s(): file io in progress\n", __func__);
|
|
|
|
|
|
+ dprintk(1, "file io in progress\n");
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1990,7 +1987,7 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool n
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
if (b->type != q->type) {
|
|
if (b->type != q->type) {
|
|
- dprintk(1, "dqbuf: invalid buffer type\n");
|
|
|
|
|
|
+ dprintk(1, "invalid buffer type\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
ret = __vb2_get_done_vb(q, &vb, b, nonblocking);
|
|
ret = __vb2_get_done_vb(q, &vb, b, nonblocking);
|
|
@@ -1999,13 +1996,13 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool n
|
|
|
|
|
|
switch (vb->state) {
|
|
switch (vb->state) {
|
|
case VB2_BUF_STATE_DONE:
|
|
case VB2_BUF_STATE_DONE:
|
|
- dprintk(3, "dqbuf: Returning done buffer\n");
|
|
|
|
|
|
+ dprintk(3, "Returning done buffer\n");
|
|
break;
|
|
break;
|
|
case VB2_BUF_STATE_ERROR:
|
|
case VB2_BUF_STATE_ERROR:
|
|
- dprintk(3, "dqbuf: Returning done buffer with errors\n");
|
|
|
|
|
|
+ dprintk(3, "Returning done buffer with errors\n");
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
- dprintk(1, "dqbuf: Invalid buffer state\n");
|
|
|
|
|
|
+ dprintk(1, "Invalid buffer state\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2049,7 +2046,7 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool n
|
|
int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking)
|
|
int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking)
|
|
{
|
|
{
|
|
if (q->fileio) {
|
|
if (q->fileio) {
|
|
- dprintk(1, "dqbuf: file io in progress\n");
|
|
|
|
|
|
+ dprintk(1, "file io in progress\n");
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
return vb2_internal_dqbuf(q, b, nonblocking);
|
|
return vb2_internal_dqbuf(q, b, nonblocking);
|
|
@@ -2121,26 +2118,26 @@ static int vb2_internal_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
if (type != q->type) {
|
|
if (type != q->type) {
|
|
- dprintk(1, "streamon: invalid stream type\n");
|
|
|
|
|
|
+ dprintk(1, "invalid stream type\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (q->streaming) {
|
|
if (q->streaming) {
|
|
- dprintk(3, "streamon successful: already streaming\n");
|
|
|
|
|
|
+ dprintk(3, "already streaming\n");
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
if (!q->num_buffers) {
|
|
if (!q->num_buffers) {
|
|
- dprintk(1, "streamon: no buffers have been allocated\n");
|
|
|
|
|
|
+ dprintk(1, "no buffers have been allocated\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
if (!q->num_buffers) {
|
|
if (!q->num_buffers) {
|
|
- dprintk(1, "streamon: no buffers have been allocated\n");
|
|
|
|
|
|
+ dprintk(1, "no buffers have been allocated\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
if (q->num_buffers < q->min_buffers_needed) {
|
|
if (q->num_buffers < q->min_buffers_needed) {
|
|
- dprintk(1, "streamon: need at least %u allocated buffers\n",
|
|
|
|
|
|
+ dprintk(1, "need at least %u allocated buffers\n",
|
|
q->min_buffers_needed);
|
|
q->min_buffers_needed);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
@@ -2159,7 +2156,7 @@ static int vb2_internal_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
|
|
|
|
q->streaming = 1;
|
|
q->streaming = 1;
|
|
|
|
|
|
- dprintk(3, "Streamon successful\n");
|
|
|
|
|
|
+ dprintk(3, "successful\n");
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2179,7 +2176,7 @@ static int vb2_internal_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
{
|
|
{
|
|
if (q->fileio) {
|
|
if (q->fileio) {
|
|
- dprintk(1, "streamon: file io in progress\n");
|
|
|
|
|
|
+ dprintk(1, "file io in progress\n");
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
return vb2_internal_streamon(q, type);
|
|
return vb2_internal_streamon(q, type);
|
|
@@ -2189,7 +2186,7 @@ EXPORT_SYMBOL_GPL(vb2_streamon);
|
|
static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
{
|
|
{
|
|
if (type != q->type) {
|
|
if (type != q->type) {
|
|
- dprintk(1, "streamoff: invalid stream type\n");
|
|
|
|
|
|
+ dprintk(1, "invalid stream type\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2204,7 +2201,7 @@ static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
*/
|
|
*/
|
|
__vb2_queue_cancel(q);
|
|
__vb2_queue_cancel(q);
|
|
|
|
|
|
- dprintk(3, "Streamoff successful\n");
|
|
|
|
|
|
+ dprintk(3, "successful\n");
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2226,7 +2223,7 @@ static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
|
|
{
|
|
{
|
|
if (q->fileio) {
|
|
if (q->fileio) {
|
|
- dprintk(1, "streamoff: file io in progress\n");
|
|
|
|
|
|
+ dprintk(1, "file io in progress\n");
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
return vb2_internal_streamoff(q, type);
|
|
return vb2_internal_streamoff(q, type);
|
|
@@ -2294,7 +2291,7 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb)
|
|
}
|
|
}
|
|
|
|
|
|
if (eb->type != q->type) {
|
|
if (eb->type != q->type) {
|
|
- dprintk(1, "qbuf: invalid buffer type\n");
|
|
|
|
|
|
+ dprintk(1, "invalid buffer type\n");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2805,7 +2802,7 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
|
struct vb2_fileio_buf *buf;
|
|
struct vb2_fileio_buf *buf;
|
|
int ret, index;
|
|
int ret, index;
|
|
|
|
|
|
- dprintk(3, "file io: mode %s, offset %ld, count %zd, %sblocking\n",
|
|
|
|
|
|
+ dprintk(3, "mode %s, offset %ld, count %zd, %sblocking\n",
|
|
read ? "read" : "write", (long)*ppos, count,
|
|
read ? "read" : "write", (long)*ppos, count,
|
|
nonblock ? "non" : "");
|
|
nonblock ? "non" : "");
|
|
|
|
|
|
@@ -2817,7 +2814,7 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
|
*/
|
|
*/
|
|
if (!q->fileio) {
|
|
if (!q->fileio) {
|
|
ret = __vb2_init_fileio(q, read);
|
|
ret = __vb2_init_fileio(q, read);
|
|
- dprintk(3, "file io: vb2_init_fileio result: %d\n", ret);
|
|
|
|
|
|
+ dprintk(3, "vb2_init_fileio result: %d\n", ret);
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -2835,7 +2832,7 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
|
fileio->b.type = q->type;
|
|
fileio->b.type = q->type;
|
|
fileio->b.memory = q->memory;
|
|
fileio->b.memory = q->memory;
|
|
ret = vb2_internal_dqbuf(q, &fileio->b, nonblock);
|
|
ret = vb2_internal_dqbuf(q, &fileio->b, nonblock);
|
|
- dprintk(5, "file io: vb2_dqbuf result: %d\n", ret);
|
|
|
|
|
|
+ dprintk(5, "vb2_dqbuf result: %d\n", ret);
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
fileio->dq_count += 1;
|
|
fileio->dq_count += 1;
|
|
@@ -2865,14 +2862,14 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
|
/*
|
|
/*
|
|
* Transfer data to userspace.
|
|
* Transfer data to userspace.
|
|
*/
|
|
*/
|
|
- dprintk(3, "file io: copying %zd bytes - buffer %d, offset %u\n",
|
|
|
|
|
|
+ dprintk(3, "copying %zd bytes - buffer %d, offset %u\n",
|
|
count, index, buf->pos);
|
|
count, index, buf->pos);
|
|
if (read)
|
|
if (read)
|
|
ret = copy_to_user(data, buf->vaddr + buf->pos, count);
|
|
ret = copy_to_user(data, buf->vaddr + buf->pos, count);
|
|
else
|
|
else
|
|
ret = copy_from_user(buf->vaddr + buf->pos, data, count);
|
|
ret = copy_from_user(buf->vaddr + buf->pos, data, count);
|
|
if (ret) {
|
|
if (ret) {
|
|
- dprintk(3, "file io: error copying data\n");
|
|
|
|
|
|
+ dprintk(3, "error copying data\n");
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2892,7 +2889,7 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
|
*/
|
|
*/
|
|
if (read && (fileio->flags & VB2_FILEIO_READ_ONCE) &&
|
|
if (read && (fileio->flags & VB2_FILEIO_READ_ONCE) &&
|
|
fileio->dq_count == 1) {
|
|
fileio->dq_count == 1) {
|
|
- dprintk(3, "file io: read limit reached\n");
|
|
|
|
|
|
+ dprintk(3, "read limit reached\n");
|
|
return __vb2_cleanup_fileio(q);
|
|
return __vb2_cleanup_fileio(q);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2905,7 +2902,7 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
|
|
fileio->b.index = index;
|
|
fileio->b.index = index;
|
|
fileio->b.bytesused = buf->pos;
|
|
fileio->b.bytesused = buf->pos;
|
|
ret = vb2_internal_qbuf(q, &fileio->b);
|
|
ret = vb2_internal_qbuf(q, &fileio->b);
|
|
- dprintk(5, "file io: vb2_dbuf result: %d\n", ret);
|
|
|
|
|
|
+ dprintk(5, "vb2_dbuf result: %d\n", ret);
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
|
|
|