Re: [PATCH v6 2/4] vb2: add allow_zero_bytesused flag to the vb2_queue struct

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

 



Hi Hans, Laurent,

On Tue, Oct 04, 2022 at 11:12:45AM +0200, Hans Verkuil wrote:
> 
> 
> On 10/2/22 01:48, Laurent Pinchart wrote:
> > Hello,
> > 
> > While working on fixing occurrences of
> > 
> > [   54.375534] use of bytesused == 0 is deprecated and will be removed in the future,
> > [   54.388026] use the actual size instead.
> > 
> > in libcamera, I realized that the patch that initially introduced the
> > warning and deprecated setting bytesused to 0 didn't change the V4L2 API
> > specification, which still documents bytesused as
> > 
> >     [...] If the application sets this to 0 for an output stream, then
> >     bytesused will be set to the size of the buffer (see the length
> >     field of this struct) by the driver. [...]
> > 
> > for both v4l2_buffer and v4l2_plane.
> > 
> > This deprecated behaviour has been present in the kernel for 7 years and
> > a half now. I'm wondering if it's really deprecated, in which case we
> > should update the API specification, or if it should be considered
> > supported, in which case the warning should be dropped.
> 
> It's a good question.
> 
> I do believe it should be removed from the spec. It is IMHO a bad idea to
> just leave bytesused at 0 for an output buffer. Applications should be explicit.
> 
> But on the other hand, I think we need to keep the current behavior in the
> kernel of replacing bytesused == 0 with the length of the buffer. I don't
> think we can return an error in that case, it would almost certainly break
> userspace.
> 
> Regarding the warning: I think we need to keep it, to warn applications that
> what they are doing is a bad idea, but that the text should change from:
> 
> "use of bytesused == 0 is deprecated and will be removed in the future"
> 
> to:
> 
> "use of bytesused == 0 is not recommended"

If we ever intend to drop this support, we should warn we're going to do
so. Otherwise there's little point in recommending against using it. The
spec should document it as deprecated and to be removed in the future as
well. (Or alternatively, the warning should be removed altogether.)

-- 
Kind regards,

Sakari Ailus



[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