[libcamera-devel] [PATCH v5 01/12] libcamera: stream: Add stream hints to StreamConfiguration

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Jan 20 11:42:18 CET 2023


Quoting Naushir Patuck (2023-01-18 11:16:40)
> On Wed, 18 Jan 2023 at 10:09, Kieran Bingham <
> kieran.bingham at ideasonboard.com> wrote:
> 
> > Hi Naush,
> >
> > Quoting Naushir Patuck via libcamera-devel (2023-01-18 08:59:42)
> > > Add a new hints flags field in the StreamConfiguration structure to
> > allow the
> > > application to specify certain intended behavior when driving libcamera.
> > > Pipeline handlers are expected to look at these hint flags and may
> > optimise
> > > internal operations based on them.
> > >
> > > Currently, only one flag is listed, OptionalStream, which the
> > application can
> > > set to inform the pipeline handler that a buffer may not be provided on
> > every
> > > Request for a given stream.
> >
> > Sorry - Laurent had comments on this yesterday when I was discussing
> > with him, so I don't know which way it will go yet...
> >
> > I still think this is the better way around, but we'll have to consider
> > that this is an 'ABI' breakage, as now apps that were able to use two
> > streams won't unless they explicitly provide all buffers or inform
> > libcamera that they won't provide all buffers....
> >
> 
> In the earlier versions of this series, we didn't have hints but used config
> params to indicate this.  Perhaps I should go back to this mechanism for the
> time being to avoid any ABI breakages until there is an agreed path forward?

That's just swapping one ABI breakage for another - because then the
hint would change (or we'd have both a 'MandatoryStream' hint, and an
'OptionalStream' hint ?)



> 
> Naush
> 
> 
> >
> >
> > > Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> > > ---
> > >  include/libcamera/stream.h |  8 ++++++++
> > >  src/libcamera/stream.cpp   | 24 ++++++++++++++++++++++++
> > >  2 files changed, 32 insertions(+)
> > >
> > > diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
> > > index 29235ddf0d8a..233ff0450451 100644
> > > --- a/include/libcamera/stream.h
> > > +++ b/include/libcamera/stream.h
> > > @@ -13,6 +13,8 @@
> > >  #include <string>
> > >  #include <vector>
> > >
> > > +#include <libcamera/base/flags.h>
> > > +
> > >  #include <libcamera/color_space.h>
> > >  #include <libcamera/framebuffer.h>
> > >  #include <libcamera/geometry.h>
> > > @@ -51,6 +53,12 @@ struct StreamConfiguration {
> > >
> > >         std::optional<ColorSpace> colorSpace;
> > >
> > > +       enum class Hint {
> > > +               None = 0,
> > > +               OptionalStream = (1 << 0),
> > > +       };
> > > +       Flags<Hint> hints;
> > > +
> > >         Stream *stream() const { return stream_; }
> > >         void setStream(Stream *stream) { stream_ = stream; }
> > >         const StreamFormats &formats() const { return formats_; }
> > > diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> > > index 67f308157fbf..b7de85f8b9c7 100644
> > > --- a/src/libcamera/stream.cpp
> > > +++ b/src/libcamera/stream.cpp
> > > @@ -349,6 +349,30 @@ StreamConfiguration::StreamConfiguration(const
> > StreamFormats &formats)
> > >   * color spaces can be supported and in what combinations.
> > >   */
> > >
> > > +/**
> > > + * \enum StreamConfiguration::Hint
> > > + * \brief List of available hint flags provided by the application for
> > a stream
> > > + *
> > > + * \var StreamConfiguration::Hint::None
> > > + * No hints for this stream.
> > > + * \var StreamConfiguration::Hint::OptionalStream
> > > + * Informs the pipeline handler that the application may not always
> > provide a
> > > + * buffer for the configured stream in every Request. This may ensure
> > the
> > > + * pipeline handler allocates additional stream buffers for internal
> > use.
> > > + */
> > > +
> > > +/**
> > > + * \var StreamConfiguration::hints
> > > + * \brief Application provided StreamConfiguration::Hint flags for
> > specific
> > > + * stream behavior
> > > + *
> > > + * Provides hints from the application to the pipeline handlers on how
> > it
> > > + * intends on handling a given configured stream. These hints may alter
> > the
> > > + * behavior of the pipeline handlers, for example, by allocating
> > additional
> > > + * buffers for internal use if an application does not guarantee
> > buffers will be
> > > + * provided in every Request for a stream.
> > > + */
> > > +
> > >  /**
> > >   * \fn StreamConfiguration::stream()
> > >   * \brief Retrieve the stream associated with the configuration
> > > --
> > > 2.25.1
> > >
> >


More information about the libcamera-devel mailing list