* [PATCH 1/4] closing uvc file when init fails
2013-12-10 11:40 [PATCH 0/4] Bugfixes for UVC gadget test application Robert Baldyga
@ 2013-12-10 11:40 ` Robert Baldyga
2013-12-10 11:40 ` [PATCH 2/4] remove set_format from uvc_events_process_data Robert Baldyga
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Robert Baldyga @ 2013-12-10 11:40 UTC (permalink / raw)
Cc: linux-media, linux-usb, laurent.pinchart, Robert Baldyga
This patch adds uvc device file closing when inits in uvc_open() function fails.
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
uvc-gadget.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/uvc-gadget.c b/uvc-gadget.c
index 0764838..5512e2c 100644
--- a/uvc-gadget.c
+++ b/uvc-gadget.c
@@ -880,6 +880,7 @@ uvc_open(struct uvc_device **uvc, char *devname)
return 0;
err:
+ close(fd);
return ret;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] remove set_format from uvc_events_process_data
2013-12-10 11:40 [PATCH 0/4] Bugfixes for UVC gadget test application Robert Baldyga
2013-12-10 11:40 ` [PATCH 1/4] closing uvc file when init fails Robert Baldyga
@ 2013-12-10 11:40 ` Robert Baldyga
2013-12-10 11:40 ` [PATCH 3/4] fix v4l2 stream handling Robert Baldyga
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Robert Baldyga @ 2013-12-10 11:40 UTC (permalink / raw)
Cc: linux-media, linux-usb, laurent.pinchart, Robert Baldyga
Format is based on application parameters, and it stay unchanged, so we
don't need to do uvc_video_set_format() and v4l2_set_format() in
uvc_events_process_data() function. In addition it allow us to do
VIDIOC_REQBUFS ioctl once at the beginning, and skip it in STREAMON and
STREAMOFF events.
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
uvc-gadget.c | 38 --------------------------------------
1 file changed, 38 deletions(-)
diff --git a/uvc-gadget.c b/uvc-gadget.c
index 5512e2c..c964f37 100644
--- a/uvc-gadget.c
+++ b/uvc-gadget.c
@@ -1949,44 +1949,6 @@ uvc_events_process_data(struct uvc_device *dev, struct uvc_request_data *data)
dev->width = frame->width;
dev->height = frame->height;
- /*
- * Try to set the default format at the V4L2 video capture
- * device as requested by the user.
- */
- CLEAR(fmt);
-
- fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- fmt.fmt.pix.field = V4L2_FIELD_ANY;
- fmt.fmt.pix.width = frame->width;
- fmt.fmt.pix.height = frame->height;
- fmt.fmt.pix.pixelformat = format->fcc;
-
- switch (format->fcc) {
- case V4L2_PIX_FMT_YUYV:
- fmt.fmt.pix.sizeimage =
- (fmt.fmt.pix.width * fmt.fmt.pix.height * 2);
- break;
- case V4L2_PIX_FMT_MJPEG:
- fmt.fmt.pix.sizeimage = dev->imgsize;
- break;
- }
-
- /*
- * As per the new commit command received from the UVC host
- * change the current format selection at both UVC and V4L2
- * sides.
- */
- ret = uvc_video_set_format(dev);
- if (ret < 0)
- goto err;
-
- if (!dev->run_standalone) {
- /* UVC - V4L2 integrated path. */
- ret = v4l2_set_format(dev->vdev, &fmt);
- if (ret < 0)
- goto err;
- }
-
if (dev->bulk) {
ret = uvc_handle_streamon_event(dev);
if (ret < 0)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] fix v4l2 stream handling
2013-12-10 11:40 [PATCH 0/4] Bugfixes for UVC gadget test application Robert Baldyga
2013-12-10 11:40 ` [PATCH 1/4] closing uvc file when init fails Robert Baldyga
2013-12-10 11:40 ` [PATCH 2/4] remove set_format from uvc_events_process_data Robert Baldyga
@ 2013-12-10 11:40 ` Robert Baldyga
2013-12-10 11:40 ` [PATCH 4/4] remove flooding debugs Robert Baldyga
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Robert Baldyga @ 2013-12-10 11:40 UTC (permalink / raw)
Cc: linux-media, linux-usb, laurent.pinchart, Robert Baldyga
This patch fixes v4l2 stream handling. It improves few things:
- Fix dqbuf_count check in v4l2_process_data() function.
- Removes freeing v4l2 device buffers in STREAMOFF event. It's because
this buffers are requested once at the beginning, and it's not needed
to free them on STREAMOFF and request again on STREAMON every time.
- Removes v4l2_qbuf() function from main(). It should be rather called from
uvc_handle_streamon_event().
- Clears first_buffer_queued field of uvc device in STREAMOFF event handler.
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
uvc-gadget.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/uvc-gadget.c b/uvc-gadget.c
index c964f37..8f06a1f 100644
--- a/uvc-gadget.c
+++ b/uvc-gadget.c
@@ -432,7 +432,7 @@ v4l2_process_data(struct v4l2_device *dev)
return 0;
if (dev->udev->first_buffer_queued)
- if ((dev->dqbuf_count + 1) >= dev->qbuf_count)
+ if (dev->dqbuf_count >= dev->qbuf_count)
return 0;
/* Dequeue spent buffer rom V4L2 domain. */
@@ -1351,11 +1351,11 @@ uvc_handle_streamon_event(struct uvc_device *dev)
ret = v4l2_reqbufs(dev->vdev, dev->vdev->nbufs);
if (ret < 0)
goto err;
-
- ret = v4l2_qbuf(dev->vdev);
- if (ret < 0)
- goto err;
}
+ ret = v4l2_qbuf(dev->vdev);
+ if (ret < 0)
+ goto err;
+
/* Start V4L2 capturing now. */
ret = v4l2_start_capturing(dev->vdev);
@@ -2011,8 +2011,6 @@ uvc_events_process(struct uvc_device *dev)
if (!dev->run_standalone && dev->vdev->is_streaming) {
/* UVC - V4L2 integrated path. */
v4l2_stop_capturing(dev->vdev);
- v4l2_uninit_device(dev->vdev);
- v4l2_reqbufs(dev->vdev, 0);
dev->vdev->is_streaming = 0;
}
@@ -2022,6 +2020,7 @@ uvc_events_process(struct uvc_device *dev)
uvc_uninit_device(dev);
uvc_video_reqbufs(dev, 0);
dev->is_streaming = 0;
+ dev->first_buffer_queued = 0;
}
return;
@@ -2365,7 +2364,6 @@ main(int argc, char *argv[])
* buffers queued.
*/
v4l2_reqbufs(vdev, vdev->nbufs);
- v4l2_qbuf(vdev);
}
if (mjpeg_image)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] remove flooding debugs
2013-12-10 11:40 [PATCH 0/4] Bugfixes for UVC gadget test application Robert Baldyga
` (2 preceding siblings ...)
2013-12-10 11:40 ` [PATCH 3/4] fix v4l2 stream handling Robert Baldyga
@ 2013-12-10 11:40 ` Robert Baldyga
2013-12-12 1:24 ` [PATCH 0/4] Bugfixes for UVC gadget test application Laurent Pinchart
2013-12-12 1:25 ` Laurent Pinchart
5 siblings, 0 replies; 7+ messages in thread
From: Robert Baldyga @ 2013-12-10 11:40 UTC (permalink / raw)
Cc: linux-media, linux-usb, laurent.pinchart, Robert Baldyga
Those debugs are printed very often killing the efficiency, so they should
be removed from final code.
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
uvc-gadget.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/uvc-gadget.c b/uvc-gadget.c
index 8f06a1f..4ff0d80 100644
--- a/uvc-gadget.c
+++ b/uvc-gadget.c
@@ -451,11 +451,8 @@ v4l2_process_data(struct v4l2_device *dev)
}
ret = ioctl(dev->v4l2_fd, VIDIOC_DQBUF, &vbuf);
- if (ret < 0) {
- printf("V4L2: Unable to dequeue buffer: %s (%d).\n",
- strerror(errno), errno);
+ if (ret < 0)
return ret;
- }
dev->dqbuf_count++;
@@ -953,11 +950,8 @@ uvc_video_process(struct uvc_device *dev)
if (dev->run_standalone) {
/* UVC stanalone setup. */
ret = ioctl(dev->uvc_fd, VIDIOC_DQBUF, &ubuf);
- if (ret < 0) {
- printf("UVC: Unable to dequeue buffer: %s (%d).\n",
- strerror(errno), errno);
+ if (ret < 0)
return ret;
- }
dev->dqbuf_count++;
@@ -999,11 +993,8 @@ uvc_video_process(struct uvc_device *dev)
/* Dequeue the spent buffer from UVC domain */
ret = ioctl(dev->uvc_fd, VIDIOC_DQBUF, &ubuf);
- if (ret < 0) {
- printf("UVC: Unable to dequeue buffer: %s (%d).\n",
- strerror(errno), errno);
+ if (ret < 0)
return ret;
- }
if (dev->io == IO_METHOD_USERPTR)
for (i = 0; i < dev->nbufs; ++i)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] Bugfixes for UVC gadget test application
2013-12-10 11:40 [PATCH 0/4] Bugfixes for UVC gadget test application Robert Baldyga
` (3 preceding siblings ...)
2013-12-10 11:40 ` [PATCH 4/4] remove flooding debugs Robert Baldyga
@ 2013-12-12 1:24 ` Laurent Pinchart
2013-12-12 1:25 ` Laurent Pinchart
5 siblings, 0 replies; 7+ messages in thread
From: Laurent Pinchart @ 2013-12-12 1:24 UTC (permalink / raw)
To: Robert Baldyga; +Cc: linux-media, linux-usb, Bhupesh SHARMA
Hi Robert,
On Tuesday 10 December 2013 12:40:33 Robert Baldyga wrote:
> Hello,
>
> This patchset fixes UVC gadget test application, created by Laurent Pinchart
> (git tree available here: git://git.ideasonboard.org/uvc-gadget.git), with
> applied patches created by Bhupesh Sharma (which can be found here:
> http://www.spinics.net/lists/linux-usb/msg84376.html).
>
> It improves video-capture device handling, and adds few other fixes.
> More details can be found in commit messages.
Thank you for the patches. This is a nice reminder that I still haven't
reviewed Bhupesh's patches. I've tried to get back to them, but the size of
the first patch makes it too complex to review for the limited time I have
now. Unless the "UVC gadget: Add support for integration with a video-capture
device and other fixes" patch gets split in smaller chunks I won't have time
to handle it before February at the earliest.
> Best regards
> Robert Baldyga
> Samsung R&D Institute Poland
>
> Robert Baldyga (4):
> closing uvc file when init fails
> remove set_format from uvc_events_process_data
> fix v4l2 stream handling
> remove flooding debugs
>
> uvc-gadget.c | 68 +++++++++---------------------------------------------
> 1 file changed, 10 insertions(+), 58 deletions(-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] Bugfixes for UVC gadget test application
2013-12-10 11:40 [PATCH 0/4] Bugfixes for UVC gadget test application Robert Baldyga
` (4 preceding siblings ...)
2013-12-12 1:24 ` [PATCH 0/4] Bugfixes for UVC gadget test application Laurent Pinchart
@ 2013-12-12 1:25 ` Laurent Pinchart
5 siblings, 0 replies; 7+ messages in thread
From: Laurent Pinchart @ 2013-12-12 1:25 UTC (permalink / raw)
To: Robert Baldyga, Bhupesh SHARMA; +Cc: linux-media, linux-usb
Hi Robert,
[Repost with Bhupesh's hopefully correct e-mail address]
On Tuesday 10 December 2013 12:40:33 Robert Baldyga wrote:
> Hello,
>
> This patchset fixes UVC gadget test application, created by Laurent Pinchart
> (git tree available here: git://git.ideasonboard.org/uvc-gadget.git), with
> applied patches created by Bhupesh Sharma (which can be found here:
> http://www.spinics.net/lists/linux-usb/msg84376.html).
>
> It improves video-capture device handling, and adds few other fixes.
> More details can be found in commit messages.
Thank you for the patches. This is a nice reminder that I still haven't
reviewed Bhupesh's patches. I've tried to get back to them, but the size of
the first patch makes it too complex to review for the limited time I have
now. Unless the "UVC gadget: Add support for integration with a video-capture
device and other fixes" patch gets split in smaller chunks I won't have time
to handle it before February at the earliest.
> Best regards
> Robert Baldyga
> Samsung R&D Institute Poland
>
> Robert Baldyga (4):
> closing uvc file when init fails
> remove set_format from uvc_events_process_data
> fix v4l2 stream handling
> remove flooding debugs
>
> uvc-gadget.c | 68 +++++++++---------------------------------------------
> 1 file changed, 10 insertions(+), 58 deletions(-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 7+ messages in thread