0004-v4l2object-Don-t-probe-UVC-devices-for-being-interla.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From fefa084bde0850447ca5ed84775c094fcf0b2351 Mon Sep 17 00:00:00 2001
  2. From: Hans de Goede <hdegoede@redhat.com>
  3. Date: Fri, 8 Jun 2012 20:38:34 +0200
  4. Subject: [PATCH] v4l2object: Don't probe UVC devices for being interlaced
  5. UVC devices are never interlaced, and doing VIDIOC_TRY_FMT on them
  6. causes expensive and slow USB IO, so don't probe them for interlaced.
  7. This shaves 2 seconds of the startup time of cheese with a Logitech
  8. Webcam Pro 9000.
  9. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  10. ---
  11. sys/v4l2/gstv4l2object.c | 16 ++++++++++++----
  12. 1 file changed, 12 insertions(+), 4 deletions(-)
  13. diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
  14. index 6564b91..ce52547 100644
  15. --- a/sys/v4l2/gstv4l2object.c
  16. +++ b/sys/v4l2/gstv4l2object.c
  17. @@ -1561,10 +1561,18 @@ gst_v4l2_object_probe_caps_for_format_and_size (GstV4l2Object * v4l2object,
  18. gint int_width = width;
  19. gint int_height = height;
  20. - /* interlaced detection using VIDIOC_TRY/S_FMT */
  21. - if (!gst_v4l2_object_get_nearest_size (v4l2object, pixelformat,
  22. - &int_width, &int_height, &interlaced))
  23. - return NULL;
  24. + if (!strcmp((char *)v4l2object->vcap.driver, "uvcvideo")) {
  25. + /*
  26. + * UVC devices are never interlaced, and doing VIDIOC_TRY_FMT on them
  27. + * causes expensive and slow USB IO, so don't probe them for interlaced
  28. + */
  29. + interlaced = FALSE;
  30. + } else {
  31. + /* Interlaced detection using VIDIOC_TRY/S_FMT */
  32. + if (!gst_v4l2_object_get_nearest_size (v4l2object, pixelformat,
  33. + &int_width, &int_height, &interlaced))
  34. + return NULL;
  35. + }
  36. memset (&ival, 0, sizeof (struct v4l2_frmivalenum));
  37. ival.index = 0;
  38. --
  39. 1.7.10.2