[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-video
Subject:    Re: Bug in CX88-Blackbird drivers?
From:       Jelle Foks <jelle () foks ! 8m ! com>
Date:       2007-11-25 18:36:09
Message-ID: 4749C099.9040609 () foks ! 8m ! com
[Download RAW message or body]

Sam Logen wrote:
> Ok I found you post I think.
> Is this it?
> https://www.redhat.com/mailman/private/video4linux-list/2007-May/msg00386.html
>   
Yes, that's the one, it removes the locking functionality by simply not
returning an error but continuing normally if it find the lock has
already been taken...

> It doesn't seem like anyone got back to you on it. 
>   
That's right, I never got feedback, but then again I never really
pursued it either (I was assuming the person who made the lock would
inevitably learn about the mythtv incompatibility and adjust it).

> Perhaps the check should be managed such that it is
> only enabled on hybrid cards like the HVR1300.
>   
Then those cards would still not work with mythtv... Maybe only grab the
lock when read()-ing, not for simple ioctl's that only set parameters.
Still, I'm not sure if that would be sufficient because who knows what
mythtv is doing with the two fd's. Is it changing channels, bitrates,
resolution during a read()? For maximum flexibility for the
applications, it may be necessary to only grab the lock when actually
reading, and for all other ioctl's, when necessary fire off a "if
(dev->mpeg_active) blackbird_stop_codec();", to make the blackbird
encoder restart.

And then still, I don't know how atomic ioctl's calls are (it probably
has no additional protection), so besides making sure the encoder is
stopped when that is needed, there may still be need for another lock to
prevent (mainly on SMP) two processes from 'being inside' the ioctl at
the same time, (for example, you definitely don't want to interrupt a
communications sequence to the cx23416 on the mpegport
(memory_read()/memory_write()/register_read()/register_write()) by
another, and there may be other things you don't want to do in parallel).

>   I've been using the latest cx88-blackbird repository
> tips, so there's no worry about out-dated drivers. 
> I'll try the patch, and run it on an un-patched MythTV
> install.  Maybe the hardware needs to be accessed
> twice to stream the captioning, I don't know.
>   
I don't know why mythtv opens a separate fd for the ioctl's and a
separate one for reading...

I think the lock is only for the blackbird device, so I don't think it's
related to the closed captioning.

Maybe it's something like this: A cx88-blackbird device has a
/dev/video0 for uncompressed video, and a /dev/video1 for compressed
video, and (I think) a /dev/vbi0 for cc. Perhaps mythtv doesn't know
that the /dev/vbi0 can be used not just for /dev/video0 but also for
/dev/video1... But that's a wild guess...

Jelle.

> If anyone else has ideas on this, I'd love to hear
> 'em.
>
> Sam
>
>
> --- Jelle Foks <jelle@foks.8m.com> wrote:
>
>
> ---------------------------------
>     Sam Logen wrote:  
> Hi,Well, closed captioning is important for me. 
> Thereare two hard of hearing individuals here that
> wouldbenefit from it.Is there a way to use mplayer or
> another program totest for closed captioning being
> treated right by thedevice and the drivers?  Note that
> I am testingeverything over an SSH connection with X
> forwarding. I want to see for myself closed captions
> with the cardand my current drivers.  Then I'd know
> for sure it wasMythTV that was at fault for not
> displaying them.  
> I never ever had closed captioning work on Linux, so I
> know nothing ofit, except that it is supplied by a
> device called '/dev/vbi', short for'vertical blanking
> interval'... You'll have to ask others for any
> moreinfo on closed captioning, because that's all I
> know.
>   
> As for MythTV and the patch, if you don't mind,
> I'lltell them what you told me, and perhaps a solution
> canbe arranged.  
> I'm fine with that, of course. It would probably help
> if you couldinvolve the person who added that lock to
> the driver (maybe ask a v4lmaintainer who may know
> more about the who/why of that lock).
>   
> Sam
> Sam Logen wrote:  
> Oh one other thing.  Jelle, if the Avermedia
> carddoesn't support qam/atsc, then would it be safe
> toremove this check as you say you have done on
> yoursystem - if you also have an ATSC card installed
> thatuses the same series of cx88 drivers?  
> It depends on your software setup... If your software
> never does the'bad thing' that the lock is trying to
> prevent, removing the check willnot have an effect...
> But, besides theorizing, I'm not sure what exact'bad
> thing' that actually happens in reality the lock is
> intended toprevent (maybe the person who added the
> lock can elaborate?).
>
> I've been using three blackbird cards in a mythbackend
> with that lockremoved for many months now without
> problems (search the ml archivesfor the patch, I'm
> pretty sure I've posted it before). I don't have
> anATSC card.
>
> ps: The driver in the kernel release is pretty old
> (even the one in2.6.24-rc1 is). You'll probably have
> best results with the v4l tree. Ifthe cx88-blackbird.c
> you have has a blackbird_initialize_codec(), butnot a
> blackbird_start_codec(), it's old... The newer one has
> someimportant improvements, mostly related to audio.
>
> Jelle.
>
>   
> Sam--- Jelle Foks <jelle@foks.8m.com> wrote:  
>       
> The patch that you included makes the change tomythtv
> so that it opensthe video device once instead of
> twice. Thecx88-mpeg device can only beopened once (it
> checks for that). I believe that wasadded as some
> kindof protection for some cards that can choose
> betweeneither hardwareencoding or qam/atsc
> demodulation on the mpeg port,to prevent
> arecording-in-progress from being screwed up byanother
> program openingthe device... On my own setup, I simply
> use apatched driver where thatcheck/lock is
> disabled...I wouldn't say it's a bug in the driver
> though,because afaik it's not abug if a device can't
> be opened more than once atthe same time... I'dsay
> it's simply not right that mythtv needs to openthe
> device twice(afaics, there is no need to do so, as
> shown by theresult of the patch)...It's an issue that
> needs to be resolved, either onmythtv's side or
> thecx88-mpeg drive side. I'm not the one who added
> thelock on the driverside, nor am I a mythtv
> developer, so I'll leave thefight between whohas to
> change what over to others...About closed-captioning,
> I don't know anything aboutthat, but afaik ithas
> nothing to do with cx88-blackbird, becauseclosed
> captioning is thevbi device, which is supplied by
> another part of thecx88 driver set.I've never been
> able to get closed captioning towork with
> mythtvanyway, including with the pvr-350 card
> supported bythe ivtv driver, soI've always felt there
> was something borked aboutmythtv's closedcaptioning
> support... I don't need closed captioningsupport
> myself, soit never bothered me, really...Jelle.    
>           
> Sam--- Daniel Kristjansson <danielk@cuymedia.net>     
>
>         
> wrote:    
>                   
> >From the patch it looks like the problem is withthe
> Avermedia M150driver, so it needs to be patched. The
> problemappears to be thatthe driver only allows the
> device to be opened        
>               
> once,    
>                   
> this is a bug.I wouldn't totally reject a patch that
> worked        
>               
> around    
>                   
> the driver bug,but it would need to do the right thing
> when the        
>               
> bug    
>                   
> isn't presentin the drivers, and also properly keep
> track of        
>               
> the    
>                   
> open filedescriptors when the buggy driver is present.
> Thepatch you attachedappears to be more of a
> proof-of-concept patch.--
> Daniel_______________________________________________mythtv-dev
> mailing listmythtv-dev@mythtv.org        
>               
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev 
>
>             
> ---Mythtv patch begins here (might be word      
>         
> wrapped)---    
>           
> Index: libs/libmythtv/mpegrecorder.cpp      
>         
> ===================================================================
>  
>             
> --- libs/libmythtv/mpegrecorder.cpp    
> (revision14704)+++ libs/libmythtv/mpegrecorder.cpp    
> (working      
>         
> copy)    
>           
> @@ -324,7 +324,7 @@ bool
> MpegRecorder::OpenV4L2DeviceAsInput(void) {-    chanfd
> = open(videodevice.ascii(), O_RDWR);+    chanfd =
> open(videodevice.ascii(), O_RDWR |O_NONBLOCK);     if
> (chanfd < 0)     {         VERBOSE(VB_IMPORTANT,
> LOC_ERR + "Can't      
>         
> open    
>           
> video device. " + ENO);@@ -447,7 +447,7 @@    
> SetVBIOptions(chanfd);-    readfd =
> open(videodevice.ascii(), O_RDWR |O_NONBLOCK);+   
> readfd = chanfd;     if (readfd < 0)     {        
> VERBOSE(VB_IMPORTANT, LOC_ERR + "Can't      
>         
> open    
>           
> video device." + ENO);           
>         
> ____________________________________________________________________________________
>  
>             
> Never miss a thing.  Make Yahoo your home page.
> http://www.yahoo.com/r/hs--video4linux-list mailing
> listUnsubscribe      
>         
> mailto:video4linux-list-request@redhat.com?subject=unsubscribe
>  
>   
> https://www.redhat.com/mailman/listinfo/video4linux-list
>  
>   
>      
> ____________________________________________________________________________________Be
> a better sports nut!  Let your teams follow you with
> Yahoo Mobile. Try it now. 
> http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
>  
>
>
>
>
>
>       ____________________________________________________________________________________
> Be a better pen pal. 
> Text or chat with friends inside Yahoo! Mail. See how.  http://overview.mail.yahoo.com/
>
>   

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic