RE: Allocating videobuf_buffer, but lists not being initialized

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

 



Hello,

On Tuesday, November 16, 2010 8:38 AM Hans Verkuil wrote:

> On Tuesday, November 16, 2010 02:10:39 Andrew Chew wrote:
> > I'm looking at drivers/media/video/videobuf-dma-contig.c's __videobuf_alloc() routine.  We call
> kzalloc() to allocate the videobuf_buffer.  However, I don't see where the two lists (vb->stream and
> vb->queue) that are a part of struct videobuf_buffer get initialized (with, say, INIT_LIST_HEAD).
> 
> Yuck. The videobuf framework doesn't initialize vb-stream at all. It relies on
> list_add_tail to effectively initialize it for it. It works, but it is not
> exactly clean programming :-(
> 
> The vb->queue list has to be initialized in the driver. Never understood the
> reason for that either.
> 
> Marek, can you make sure that videobuf2 will initialize these lists correctly?
> That is, vb2 should do this initialization instead of the driver.

In the current version of vb2 there is no such list, so the driver has to keep
list tracking entries inside its own structures. Usually v4l2 drivers embed
video_buf structure inside some custom buffer structure to track some driver
specific per-buffer stuff, so there is no problem in adding struct list_head
there. This resolves all design problems like who is responsible of initializing
it.

> > This results in a warning in the V4L2 camera host driver that I'm developing when the buf_prepare
> method gets called.  I do a similar sanity check to the sh_mobile_ceu_camera driver (WARN_ON(!list-
> >empty(&vb->queue));) in my buf_prepare method, and see the warning.  If I add INIT_LIST_HEAD to
> __videobuf_alloc(), this warning goes away.
> >
> > Is this a known bug?
> 
> Well, videobuf is one big bug. We hope that we can merge the videobuf replacement
> (called videobuf2, amazingly enough :-) ) for 2.6.38. Fingers crossed.
> 
> So you might want to wait until vb2 arrives, depending on your schedule.

I'm sorry for the delay, but I work hard to track some well hidden bug. I hope to post
a new version of videobuf2 patches tomorrow.

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux