[Q] vb2 userptr: struct vb2_ops::buf_cleanup() is called without buf_init()

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

 



Hi

A recent report

http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/47594

has revealed the following asymmetry in how videobuf2 functions:

as is also documented in videobuf2-core.h, the user's struct 
vb2_ops::buf_init() method in the MMAP case is called after allocating the 
respective buffer, which happens at REQBUFS time, in the USERPTR case it 
is called after acquiring a new buffer at QBUF time. If the allocation in 
MMAP case fails, the respective buffer simply doesn't get created. 
However, if acquiring a new USERPTR buffer at QBUF time fails, the buffer 
object remains on the queue, but the user-provided .buf_init() method is 
not called for it. When the queue is destroyed, the user's .buf_cleanup() 
method is called on an uninitialised buffer. This is exactly the reason 
for the BUG() in the above referenced report.

Therefore my question: is this videobuf2-core behaviour really correct and 
we should be prepared in .buf_cleanup() to process uninitialised buffers, 
or should the videobuf2-core be adjusted?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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