Received: from eggs.gnu.org ([140.186.70.92]:50001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QR5Tp-00033H-VM for qemu-devel@nongnu.org; Mon, 30 May 2011 12:38:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QR5QU-0004lk-Af for qemu-devel@nongnu.org; Mon, 30 May 2011 12:34:48 -0400 Received: from nm30.bullet.mail.ac4.yahoo.com ([98.139.52.227]:32426) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QR5QU-0004ld-3C for qemu-devel@nongnu.org; Mon, 30 May 2011 12:34:46 -0400 Message-ID: <2522.8641.qm@web65305.mail.ac2.yahoo.com> Date: Mon, 30 May 2011 09:34:43 -0700 (PDT) From: Peter Baitz In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1313974051-1306773283=:8641" Subject: Re: [Qemu-devel] Webcams under KVM and Linux List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Natalia Portillo Cc: =?iso-8859-1?Q?Andreas_F=E4rber?= , QEMU Developers , Hoffmann Gerd --0-1313974051-1306773283=:8641 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Sounds great Natalia. Two things I'd like to let you all know. (1)=A0 I am using a VM guest because I need the slightly older pwc driver i= n Fedora 11 which works with long exposure mods - so that is why I was tryi= ng it in a VM.=A0=A0 If you use a generic or use the hosts pwc driver, it w= ill break certain things.=A0 That's why it's important the guest driver is = used for me anyway. (2) I tried this with VMware Player, and you will be happen to know, even t= hough the guest OS detected the pwc webcam and loaded the driver and the vi= deo device /dev/video0 and lsusb shows the Philips cam there, all video sof= tware tested reports it cannot find the video camera.=A0=A0=A0 Opposite of = this is KVM/Qemu which does all the same as described, but at least video s= oftware reports it finds the webcam, but no video at this time - since you = all are working on that.=A0=A0=A0=A0=A0 So KVM might be doing better in thi= s regard.=20 Peter --- On Mon, 5/30/11, Natalia Portillo wrote: From: Natalia Portillo Subject: Re: [Qemu-devel] Webcams under KVM and Linux To: "Peter Baitz" Cc: "Andreas F=E4rber" , "QEMU Developers" , "Hoffmann Gerd" Date: Monday, May 30, 2011, 12:50 PM Exactly what my webcam does is: Takes a frame from ANY available V4L2 device (/dev/video0), caches it, and = sends it completely to the guest before requesting any other frame. With this way you need your host driver loaded, but you will get never a bl= ackout. What it happens is a thing commonly known in game emulators (like for examp= le ePSX) as framedrop, that is, you get a slower framerate but not blackout= s. The guest sees a common USB Video Class Device webcam with no controls (thi= s can be enhanced easily), so basically you cannot change any parameter.How= ever all the webcams I tested automatically managed that in the firmware wi= th no intervention from any of the drivers (host or guest), changing white = balance and brightness to the adequate values. You can see it working without KVM in:http://www.youtube.com/watch?v=3D_Yo9= TWPDXCohttp://www.youtube.com/watch?v=3DfzGYvjZzx6E The webcam emulation works with TCG (without KVM), albeit slower, enough to= do videoconference because of the following: Using direct connection method (USB passthrough) even when the ISO xfers an= d ECHI 2.0 are completely emulated will always find the following: the host= is faster than the guest, so the real webcam will always be streaming fast= er than the guest can process it.Frames are sent in pieces, and if the fram= e does not arrive completely from start to end on all pieces the guest will= blackout, and continue black until it receives a complete frame. With fast webcams, like 60 fps ones, this will happen so commonly that ther= e will be no image at all. You can easily see this in VMWare, Parallels or VirtualBox, all of them emu= late ISO xfers and EHCI 2.0 and when using a webcam it's not really practic= al. Framedrop prevents that. From the 60 frames sent in a second by the host, i= f the guest can process only 10, it will receive 10 complete frames, and se= e the webcam as a 10fps one.That's atomic. Also my patch supports, as I already said, any V4L2 device including webcam= s, DV cameras, TV tuners from any kind of interface be it Firewire, USB, PC= I, Serial, AGP, so on. El 29/05/2011, a las 15:03, Peter Baitz escribi=F3: Hello Natalia and Andreas, Thank you for the replies and suggestions.=A0 I will lookup V4L.=A0=20 Natalia, So your patch creates a generic webcam under KVM/Qemu to allow many webcams= to work? My only concern is the following:=A0=A0 I use specific Philips webcams, and= one in particular has a long exposure modification that the PWC driver (Fe= dora 11 guest on Fedora 15 host) coupled with Qastrocam-G2 (v4.9) allows th= e "shutter" to remain open through USB control of the LED.=A0 If the guest = restorts to using a generic webcam driver, I think this would preclude func= tionality that the native driver supports ?=A0=20 Also, can you tell me - when KVM is running my guest, should the PWC webcam= driver be loaded and/or the /dev/video0 on the HOST (F15), versus the gues= t (F11) ?=A0=A0 I am confused as to which=0A components are supposed to be = enabled or disabled while running the guest webcam. =A0 What I see is when = I enable the webcam USB device in KVM, it appears to disable the /dev/video= 0 on the host an brings it up in the guest. =A0 And the pwc driver loads an= d remains on both host and guest.=A0=20 Peter --- On Sun, 5/29/11, Natalia Portillo wrote: From: Natalia Portillo Subject: Re: [Qemu-devel] Webcams under KVM and Linux To: "Andreas F=E4rber" Cc: "Peter Baitz" , "QEMU Developers" = Date: Sunday, May 29, 2011, 1:53 PM -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 More concretely search for patches sent by=0A me. Even when EHCI is finished still is the problem of isochronous transfer not= working well because of timing issues on QEMU. My patches overcome the need for ISO transfer and EHCI controllers complete= ly, as well as providing an universal device to the guest that works with e= very Windows >XP, every Linux and even Mac OS X. El 29/05/2011, a las 14:37, Andreas F=E4rber escribi=F3: > Hello, >=20 > Am 29.05.2011 um 15:01 schrieb Peter Baitz: >=20 >>=20 >>> [...] You should notice that it is not just adding >>> ISOC and USB 2.0 support, but also to prioritize the processing of isoc >>> packets on a virtual environment, and to provide enough throughput for >>> video streams >>=20 >> [...] Please check the qemu-devel mailing list archive, specifically reg= arding recent discussions about EHCI (USB 2.0). Some of those threads addre= ss isochronous=0A transfer as well. >>=20 >> In the meantime, you could also try to assign a complete host controller= to the guest to get a webcam working. I tried this a while ago, though the= result was only moderately well working here. >=20 >> [...] I would indeed like to hear more about what the project is adding = to KVM - Qemu to allow video to work with webcams > [...] >> I was told I could try to add a complete host controller to the guest, b= ut am not entirely sure I understand what that means?=A0 Looking for specif= ics?=A0 Is there a suggestion for doing this during install of the KVM gues= t, or can this be done while the guest is running, or otherwise? >=20 > Independent of the ongoing EHCI work, I remember a patch specifically for= webcams a while ago, try searching the archives for V4L. >=20 > Andreas -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment:=0A GPGTools - http://gpgtools.org iF4EAREIAAYFAk3iT+QACgkQv/wfOsykIRTtxQD+KCTGZhuzrZMzmYDvY5NFO0+F QQwdE0aYVntQWpHMG5YBAJsFT5wd7/8FxOIt3aL1lwFqXtKc9y9TrrNog95gnoVh =3Dn0hn -----END PGP SIGNATURE----- --0-1313974051-1306773283=:8641 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Sounds great Natalia.

Two things I'd l= ike to let you all know.

(1)  I am using a VM guest because I n= eed the slightly older pwc driver in Fedora 11 which works with long exposu= re mods - so that is why I was trying it in a VM.   If you use a = generic or use the hosts pwc driver, it will break certain things.  Th= at's why it's important the guest driver is used for me anyway.

(2) = I tried this with VMware Player, and you will be happen to know, even thoug= h the guest OS detected the pwc webcam and loaded the driver and the video = device /dev/video0 and lsusb shows the Philips cam there, all video softwar= e tested reports it cannot find the video camera.    Opposit= e of this is KVM/Qemu which does all the same as described, but at least vi= deo software reports it finds the webcam, but no video at this time - since you all are working on that.      So KVM might be= doing better in this regard.

Peter

--- On Mon, 5/30/11, = Natalia Portillo <claunia@claunia.com> wrote:

From: Natalia Portillo <claunia@claunia.com>
S= ubject: Re: [Qemu-devel] Webcams under KVM and Linux
To: "Peter Baitz" &= lt;ussenterprisencc1701@rocketmail.com>
Cc: "Andreas F=E4rber" <an= dreas.faerber@web.de>, "QEMU Developers" <qemu-devel@nongnu.org>, = "Hoffmann Gerd" <kraxel@redhat.com>
Date: Monday, May 30, 2011, 12= :50 PM

Exactly what my webcam does is:
=
Takes a frame from ANY available V4L2 device (/dev/video0), = caches it, and sends it completely to the guest before requesting any other= frame.

With this way you need your host driver loaded, but you will get never a blackout.

What i= t happens is a thing commonly known in game emulators (like for example ePS= X) as framedrop, that is, you get a slower framerate but not blackouts.

The guest sees a common USB Video Class Device webcam= with no controls (this can be enhanced easily), so basically you cannot ch= ange any parameter.
However all the webcams I tested automaticall= y managed that in the firmware with no intervention from any of the drivers= (host or guest), changing white balance and brightness to the adequate val= ues.

You can see it working without KVM in:
<= div>http://www.youtube.com/watch?v=3D_Yo9TWPDXCo
=

The webcam emulation = works with TCG (without KVM), albeit slower, enough to do videoconference b= ecause of the following:

Using direct connection m= ethod (USB passthrough) even when the ISO xfers and ECHI 2.0 are completely= emulated will always find the following: the host is faster than the guest= , so the real webcam will always be streaming faster than the guest can pro= cess it.
Frames are sent in pieces, and if the frame does not arr= ive completely from start to end on all pieces the guest will blackout, and= continue black until it receives a complete frame.

With fast webcams, like 60 fps ones, this will happen so commonly that th= ere will be no image at all.

You can easily see th= is in VMWare, Parallels or VirtualBox, all of them emulate ISO xfers and EHCI 2.0 and when using a webcam it's not really practical.

=
Framedrop prevents that. From the 60 frames sent in a second by = the host, if the guest can process only 10, it will receive 10 complete fra= mes, and see the webcam as a 10fps one.
That's atomic.
=
Also my patch supports, as I already said, any V4L2 device i= ncluding webcams, DV cameras, TV tuners from any kind of interface be it Fi= rewire, USB, PCI, Serial, AGP, so on.

El 29/05/2011= , a las 15:03, Peter Baitz escribi=F3:

Hello Natalia and Andreas,

Thank you for the replies and su= ggestions.  I will lookup V4L. 

Natalia,

So your p= atch creates a generic webcam under KVM/Qemu to allow many webcams to work?=

My only concern is the following:   I use specific Philips webcams,= and one in particular has a long exposure modification that the PWC driver= (Fedora 11 guest on Fedora 15 host) coupled with Qastrocam-G2 (v4.9) allow= s the "shutter" to remain open through USB control of the LED.  If the= guest restorts to using a generic webcam driver, I think this would preclu= de functionality that the native driver supports ? 

Also, can = you tell me - when KVM is running my guest, should the PWC webcam driver be= loaded and/or the /dev/video0 on the HOST (F15), versus the guest (F11) ?&= nbsp;  I am confused as to which=0A components are supposed to be enab= led or disabled while running the guest webcam.   What I see is when I= enable the webcam USB device in KVM, it appears to disable the /dev/video0= on the host an brings it up in the guest.   And the pwc driver loads = and remains on both host and guest. 

Peter


--- On <= b>Sun, 5/29/11, Natalia Portillo <claunia@claunia.com> wrote:

From: Natalia Portillo <claunia@claunia.com>
Subject: Re: [Qemu-devel] Webcams un= der KVM and Linux
To: "Andreas F=E4rber" <andreas.faerber@web.de>
Cc: "Peter Baitz" <
ussenterprisencc1701@rocketmail.com= >, "QEMU Developers" <qemu-devel@nongnu.org>
Date: Sunday, May 29, 2011, 1:53 PM
-----BEGIN PGP SIGNED MESSAGE---= --
Hash: SHA256

More concretely search for patches sent by=0A me.=

Even when EHCI is finished still is the problem of isochronous tran= sfer not working well because of timing issues on QEMU.

My patches o= vercome the need for ISO transfer and EHCI controllers completely, as well = as providing an universal device to the guest that works with every Windows= >XP, every Linux and even Mac OS X.

El 29/05/2011, a las 14:37, = Andreas F=E4rber escribi=F3:

> Hello,
>
> Am 29.05.2= 011 um 15:01 schrieb Peter Baitz:
>
>>
>>> [..= .] You should notice that it is not just adding
>>> ISOC and US= B 2.0 support, but also to prioritize the processing of isoc
>>>= ; packets on a virtual environment, and to provide enough throughput for>>> video streams
>>
>> [...] Please check the= qemu-devel mailing list archive, specifically regarding recent discussions= about EHCI (USB 2.0). Some of those threads address isochronous=0A transfe= r as well.
>>
>> In the meantime, you could also try to = assign a complete host controller to the guest to get a webcam working. I t= ried this a while ago, though the result was only moderately well working h= ere.
>
>> [...] I would indeed like to hear more about what= the project is adding to KVM - Qemu to allow video to work with webcams> [...]
>> I was told I could try to add a complete host contr= oller to the guest, but am not entirely sure I understand what that means?&= nbsp; Looking for specifics?  Is there a suggestion for doing this dur= ing install of the KVM guest, or can this be done while the guest is runnin= g, or otherwise?
>
> Independent of the ongoing EHCI work, I r= emember a patch specifically for webcams a while ago, try searching the arc= hives for V4L.
>
> Andreas

-----BEGIN PGP SIGNATURE----= -
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment:=0A GPGTools - http://gpgt= ools.org

iF4EAREIAAYFAk3iT+QACgkQv/wfOsykIRTtxQD+KCTGZhuzrZMzmYD= vY5NFO0+F
QQwdE0aYVntQWpHMG5YBAJsFT5wd7/8FxOIt3aL1lwFqXtKc9y9TrrNog95gno= Vh
=3Dn0hn
-----END PGP SIGNATURE-----

--0-1313974051-1306773283=:8641--