• Laurent Pinchart's avatar
    [media] v4l: Clearly document interactions between formats, controls and buffers · 99bb078e
    Laurent Pinchart authored
    V4L2 exposes parameters that influence buffers sizes through the format
    ioctls (VIDIOC_G_FMT, VIDIOC_TRY_FMT, VIDIOC_S_FMT, and possibly
    VIDIOC_G_SELECTION and VIDIOC_S_SELECTION). Other parameters not part of
    the format structure may also influence buffer sizes or buffer layout in
    general. One existing such parameter is rotation, which is implemented
    by the V4L2_CID_ROTATE control and thus exposed through the V4L2 control
    ioctls.
    
    The interaction between those parameters and buffers is currently only
    partially specified by the V4L2 API. In particular interactions between
    controls and buffers isn't specified at all. The behaviour of the
    VIDIOC_S_FMT and VIDIOC_S_SELECTION ioctls when buffers are allocated is
    also not fully specified.
    
    This patch clearly defines and documents the interactions between
    formats, selections, controls and buffers.
    
    The preparatory discussions for the documentation change considered
    completely disallowing controls that change the buffer size or layout,
    in favour of extending the format API with a new ioctl that would bundle
    those controls with format information. The idea has been rejected, as
    this would essentially be a restricted version of the upcoming request
    API that wouldn't bring any additional value.
    
    Another option we have considered was to mandate the use of the request
    API to modify controls that influence buffer size or layout. This has
    also been rejected on the grounds that requiring the request API to
    change rotation even when streaming is stopped would significantly
    complicate implementation of drivers and usage of the V4L2 API for
    applications.
    
    Applications will however be required to use the upcoming request API to
    change at runtime formats or controls that influence the buffer size or
    layout, because of the need to synchronize buffers with the formats and
    controls. Otherwise there would be no way to interpret the content of a
    buffer correctly.
    Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
    Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
    99bb078e
buffer.rst 27.2 KB