public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] Serialization flag example
@ 2010-04-01 17:37 Hans Verkuil
  2010-04-01 18:24 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 19+ messages in thread
From: Hans Verkuil @ 2010-04-01 17:37 UTC (permalink / raw)
  To: linux-media

I made a quick implementation which is available here:

http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-serialize

It's pretty easy to use and it also gives you a very simple way to block
access to the video device nodes until all have been allocated by simply
taking the serialization lock and holding it until we are done with the
initialization.

I converted radio-mr800.c and ivtv.

That said, almost all drivers that register multiple device nodes probably
suffer from a race condition when one of the device node registrations
returns an error and all devices have to be unregistered and the driver
needs to release all resources.

Currently most if not all drivers just release resources and free the memory.
But if an application managed to open one device before the driver removes it
again, then we have almost certainly a crash.

It is possible to do this correctly in the driver, but it really needs core
support where a release callback can be installed in v4l2_device that is
called when the last video_device is closed by the application.

We already can cleanup correctly after the last close of a video_device, but
there is no top-level release yet.


Anyway, I tried to use the serialization flag in bttv as well, but I ran into
problems with videobuf. Basically when you need to wait for some event you
should release the serialization lock and grab it after the event arrives.

Unfortunately videobuf has no access to v4l2_device at the moment. If we would
have that, then videobuf can just release the serialization lock while waiting
for something to happen.

Regards,

	Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Aw: Re: [RFC] Serialization flag example
@ 2010-04-03 11:55 hermann-pitton
  2010-04-04  3:14 ` David Ellingsworth
  0 siblings, 1 reply; 19+ messages in thread
From: hermann-pitton @ 2010-04-03 11:55 UTC (permalink / raw)
  To: awalls, mchehab; +Cc: dheitmueller, abraham.manu, hverkuil, linux-media

 


----- Original Nachricht ----
Von:     Andy Walls <awalls@md.metrocast.net>
An:      Mauro Carvalho Chehab <mchehab@redhat.com>
Datum:   03.04.2010 02:47
Betreff: Re: [RFC] Serialization flag example

> On Fri, 2010-04-02 at 18:15 -0300, Mauro Carvalho Chehab wrote:
> > Devin Heitmueller wrote:
> 
> > In the case of a V4L x DVB type of lock, this is not to protect some
> memory, but,
> > instead, to limit the usage of a hardware that is not capable of
> simultaneously
> > provide V4L and DVB streams. This is a common case on almost all devices,
> but, as
> > Hermann pointed, there are a few devices that are capable of doing both
> analog
> > and digital streams at the same time, but saa7134 driver currently doesn't
> support.

Mauro, to do digital and analog at once is not restricted to a few devices.

The only restriction, except those hybrid tuners do have, is that in dual mode only 
packed video formats are allowed for analog, since planar formats are using DMA 
channel five, which is already in use by the TS interface then.

> I know a driver that does:

Me too ;) and Trent tested on cx88xx, IIRC.
 
> cx18 can handle simultaneous streaming of DTV and analog.

Yup. Not to talk about recent PCIe devices.
During I'm writing this I watch DVB-S, DVB-T and Composite at once on a
single saa7231e on vista. Supports also S2 and HDTV, vbi and radio and can
have a dual remote interface.
http://www.creatix.de/produkte/multimedia/ctx1924.htm

> Some cards have both an analog and digital tuner, so both DTV and analog
> can come from an RF source simultaneously.  (No locking needed really.)

We have quite some such cards with two tuners on the saa7134 since 2005.
Also such with three and even four tuners, two of them hybrid.

Even the simplest variant, say with a single DVB-S only tuner, can still have external 
analog baseband at once from TV, STB, VCR or whatever.

> Some cards only have one tuner, which means simultaneous streaming is
> limited to DTV from RF and analog from baseband inputs.  Streaming
> analog from an RF source on these cards precludes streaming of DTV.  (An
> odd locking ruleset when you consider MPEG, YUV, PCM, and VBI from the
> bridge chip can independently be streamed from the selected analog
> source to 4 different device nodes.)

On that mentioned Medion Quad md8080/CTX944 it becomes even more interesting.
Each of the two PCI bridges can only handle one digital and one analog stream at once.
That one must know.

And if RF loopthrough is enabled or not is another important point for its usage configuration.
For the two hybrid tuners it is a manual switch the driver doesn't know about.

For the two DVB-S tuners it could be switchable in software and one of the LNB connectors
could even be used as RF out to another device. (Has usage restrictions)

The user can make a lot of decisions how to use such a card and for sure doesn't want
to have any limitations only because of the hybrid tuners.

Cheers,
Hermann
 
> Regards,
> Andy
> 



Frohe Ostern! Alles für's Fest der Hasen und Lämmer jetzt im Osterspecial auf Arcor.de: http://www.arcor.de/rd/footer.ostern

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2010-04-06 14:42 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-01 17:37 [RFC] Serialization flag example Hans Verkuil
2010-04-01 18:24 ` Mauro Carvalho Chehab
2010-04-01 20:57   ` Hans Verkuil
2010-04-01 21:32     ` Mauro Carvalho Chehab
2010-04-02  8:57       ` Hans Verkuil
2010-04-02 16:06         ` Mauro Carvalho Chehab
2010-04-03  0:30         ` Andy Walls
2010-04-02 17:43   ` Manu Abraham
2010-04-02 17:53     ` Devin Heitmueller
2010-04-02 18:24       ` Manu Abraham
2010-04-02 18:34         ` Devin Heitmueller
2010-04-02 21:15       ` Mauro Carvalho Chehab
2010-04-03  0:47         ` Andy Walls
  -- strict thread matches above, loose matches on Subject: below --
2010-04-03 11:55 Aw: " hermann-pitton
2010-04-04  3:14 ` David Ellingsworth
2010-04-05 22:46   ` Laurent Pinchart
2010-04-05 22:58     ` Hans Verkuil
2010-04-06  6:30       ` Hans Verkuil
2010-04-06 12:59         ` Mauro Carvalho Chehab
2010-04-06 13:54           ` Hans Verkuil
2010-04-06 14:42             ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox