Re: [PATCH] make dvb_ringbuffer compatible to dmxdev_buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2006-03-14 at 01:03 +0100, Oliver Endriss wrote:
> Andreas Oberritter wrote:
> > From: Andreas Oberritter <obi@xxxxxxxxxxx>
> > 
> > Added variable 'error' to struct dvb_ringbuffer, which is set to zero on
> > init() and flush(). Also reset read an write pointers to zero on flush()
> > to get less fragmented data.
> > 
> > Signed-off-by: Andreas Oberritter <obi@xxxxxxxxxxx>
> > ---
> > 
> > A patch to make dmxdev use dvb_ringbuffer will follow.
> > 
> > diff -r 427667c87c7b linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
> > --- a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c	Sun Mar 12 00:03:47 2006 -0300
> > +++ b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c	Mon Mar 13 16:02:46 2006 +0100
> > ...
> > @@ -86,7 +87,8 @@ ssize_t dvb_ringbuffer_avail(struct dvb_
> >  
> >  void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
> >  {
> > -	rbuf->pread = rbuf->pwrite;
> > +	rbuf->pread = rbuf->pwrite = 0;
>                                    +++
> 
> Attention, this will convert dvb_ringbuffer_flush() into a writer!
> 
> from dvb_ringbuffer.h:
> | ** (2) If there is exactly one reader and one writer, there is no need
> | **     to lock read or write operations.
> | **     Two or more readers must be locked against each other.
> | **     Flushing the buffer counts as a read operation.
>          +++++++++++++++++++++++++++++++++++++++++++++++
> | **     Two or more writers must be locked against each other.
> 
> With this patch flushing the ring buffer is a read _and_ a write
> operation. It might break existing code. Are you aware of that?

Oliver, can you please take a look at the existing code? It's a
performance gain if it doesn't break.

Generally I'd expect a flush to return a buffer into its initial state.

Regards,
Andreas


_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux