diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index 29bfc2bf796b..7e32d741b93b 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -1052,6 +1052,8 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) if (WARN_ON(vb->state != VB2_BUF_STATE_ACTIVE)) return; + else + pr_err("vb2_buffer_done Enter, vb->state %d\n", vb->state); if (WARN_ON(state != VB2_BUF_STATE_DONE && state != VB2_BUF_STATE_ERROR && @@ -1074,10 +1076,12 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) spin_lock_irqsave(&q->done_lock, flags); if (state == VB2_BUF_STATE_QUEUED) { vb->state = VB2_BUF_STATE_QUEUED; + pr_err("vb2_buffer_done doesn't add, vb->state %d\n", vb->state); } else { /* Add the buffer to the done buffers list */ list_add_tail(&vb->done_entry, &q->done_list); vb->state = state; + pr_err("vb2_buffer_done list_add_tail, vb->state %d\n", vb->state); } atomic_dec(&q->owned_by_drv_count); @@ -2490,9 +2494,15 @@ __poll_t vb2_core_poll(struct vb2_queue *q, struct file *file, poll_wait(file, &q->done_wq, wait); if (!q->is_output && !(req_events & (EPOLLIN | EPOLLRDNORM))) + { + pr_err("vb2_core_poll ERROR: line %d \n", __LINE__); return 0; + } if (q->is_output && !(req_events & (EPOLLOUT | EPOLLWRNORM))) + { + pr_err("vb2_core_poll ERROR: line %d \n", __LINE__); return 0; + } /* * Start file I/O emulator only if streaming API has not been used yet. @@ -2562,6 +2572,13 @@ __poll_t vb2_core_poll(struct vb2_queue *q, struct file *file, EPOLLOUT | EPOLLWRNORM : EPOLLIN | EPOLLRDNORM; } + if (vb) + pr_err("vb2_core_poll ERROR: line %d vb %p vb->state %d list_empty(&q->done_list) %d\n", + __LINE__, vb, vb->state, list_empty(&q->done_list)); + else + pr_err("vb2_core_poll ERROR: line %d list_empty(&q->done_list) %d\n", + __LINE__, list_empty(&q->done_list)); + return 0; } EXPORT_SYMBOL_GPL(vb2_core_poll); diff --git a/drivers/media/platform/virtio/virtio-camera.c b/drivers/media/platform/virtio/virtio-camera.c index 705f150cc0b3..f54491c2d9eb 100644 --- a/drivers/media/platform/virtio/virtio-camera.c +++ b/drivers/media/platform/virtio/virtio-camera.c @@ -149,6 +149,7 @@ static void virtio_camera_control_ack(struct virtqueue *vq) struct vb2_v4l2_buffer *vbuf; unsigned int len; + pr_err("virtio-camera: %s enter and wait vcam_vq->lock\n", __func__); spin_lock_irq(&vcam_vq->lock); while ((req = virtqueue_get_buf(vq, &len))) { complete(&req->completion); @@ -158,14 +159,18 @@ static void virtio_camera_control_ack(struct virtqueue *vq) vbuf->sequence = req->resp.u.buffer.sequence; vbuf->vb2_buf.timestamp = req->resp.u.buffer.timestamp; vbuf->planes[0].bytesused = req->resp.u.format.size.sizeimage; + pr_err("virtio-camera: %s enter and call vb2_buffer_done\n", __func__); vb2_buffer_done(req->vb, VB2_BUF_STATE_DONE); - pr_debug("virtio-camera: mark the buffer done. UUID is %d, ptr is %pK\n", + pr_err("virtio-camera: mark the buffer done. UUID is %d, ptr is %p\n", req->resp.u.buffer.uuid[0] + req->resp.u.buffer.uuid[1], req->vb); kfree(req); + } else { + pr_err("virtio-camera:%s req->vb is null\n", __func__); } } spin_unlock_irq(&vcam_vq->lock); + pr_err("virtio-camera: %s %d unblock vcam_vq->lock\n", __func__, __LINE__); } static int vcam_vq_request(struct virtio_camera_video *vnode, @@ -195,11 +200,13 @@ static int vcam_vq_request(struct virtio_camera_video *vnode, if (ret) { pr_err("%s: fail to add req to vq, errno is %d\n", __func__, ret); spin_unlock_irq(&vnode->ctr_vqx->lock); + pr_err("virtio-camera: %s %d unblock vcam_vq->lock\n", __func__, __LINE__); return ret; } virtqueue_kick(vnode->ctr_vqx->vq); spin_unlock_irq(&vnode->ctr_vqx->lock); + pr_err("virtio-camera: %s %d unblock vcam_vq->lock\n", __func__, __LINE__); if (async) return 0;