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

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Jan 20 11:40:54 CET 2023


Quoting Naushir Patuck (2023-01-20 08:04:41)
> Hi all,
> 
> 
> 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....
> >
> 
> Has there been any consensus reached on this?
> I'm keen to get out an updated patch by the end of the day if any other
> changes are needed.

I'm still trying to get to the bottom of all the consequences either
way.

I'm afraid now I have a worry about 'my' suggestion to require
applications to specify optional streams.

At the moment, I think the only way to directly configure the sensor
mode is to configure a raw stream, and then simply not request buffers
on that stream. If we make it so applictions must declare that the
stream is an OptionalStream - setting the raw sensor mode would likely
have to directly inform that the raw buffers are not going to be
provided.

That might not be a bad thing, but I wanted to highlight it.

Are there any other / better options to configure the sensor mode?

--
Kieran



> 
> Regards,
> 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