Bug 36152 - iSight (uvcvideo) VIDIOC_TRY_FMT has side-effects
iSight (uvcvideo) VIDIOC_TRY_FMT has side-effects
Status: RESOLVED OBSOLETE
Product: v4l-dvb
Classification: Unclassified
Component: webcam
All Linux
: P1 normal
Assigned To: webcam
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-29 10:36 UTC by Dave Vasilevsky
Modified: 2013-12-23 13:37 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.38.6
Tree: Fedora
Regression: No


Attachments
Test case (2.88 KB, text/x-csrc)
2011-05-29 10:36 UTC, Dave Vasilevsky
Details

Description Dave Vasilevsky 2011-05-29 10:36:37 UTC
Created attachment 59952 [details]
Test case

The ioctl VIDIOC_TRY_FMT is supposed to modify its argument, and make no changes to the video driver. However, on my MacBook4,1 with the built-in iSight, invoking TRY_FMT causes the video capture output to change mysteriously.

The attached test case performs the following steps:
1. Sets the format to UYVY 640 x 480
2. Uses TRY_FMT to check if 320 x 240 would work
3. Verifies that the format is still 640 x 480
4. Captures frames, but they are not of the expected size

Output is:
	Set 640 x 480
	Driver claims 640 x 480, image size 614400
	Tried 320 x 240
	Driver claims 640 x 480, image size 614400
	Actual image size 262477
	Actual image size 262692
	Actual image size 262908
	Actual image size 262102
	Actual image size 262144
	Actual image size 262144
	Actual image size 262144
	Actual image size 262144
	Actual image size 262144
	Actual image size 262144

Expected output would have actual size 614400, the same as the driver claims it should be.

I have no idea what the ~256k buffer being received actually is, it's not the proper size for 320 x 240 either!
Comment 1 Diego Escalante Urrelo 2011-07-14 19:09:38 UTC
I can confirm, your testcase "works" here too:

diego:downloads$ ./isight 
Set 640 x 480
Driver claims 640 x 480, image size 614400
Tried 320 x 240
Driver claims 640 x 480, image size 614400
Actual image size 262144
Actual image size 262371
Actual image size 262145
Actual image size 262144
Actual image size 262803
Actual image size 262144
Actual image size 262144
Actual image size 262463
Actual image size 262144
Actual image size 262144

I first saw this with GNOME's Cheese, where I have to go to preferences and switch back and forth to another video format before I actually see something (640x480 -> 320x240 -> 640x480)
Comment 2 Diego Escalante Urrelo 2011-07-14 19:10:11 UTC
GNOME bugzilla btw: https://bugzilla.gnome.org/show_bug.cgi?id=649067

Note You need to log in before you can comment on or make changes to this bug.