[libcamera-devel,02/20] pipeline: rpi: Add Recurrent and Needs32bitConv flags to RPi::Stream
diff mbox series

Message ID 20231006132000.23504-3-naush@raspberrypi.com
State Superseded
Headers show
Series
  • Raspberry Pi: Preliminary PiSP support
Related show

Commit Message

Naushir Patuck Oct. 6, 2023, 1:19 p.m. UTC
Add a new "Recurrent" stream flag. This flag indicates the stream buffer
handling/management happend from the pipeline handler exclusively. This
is used for TDN/Stitch and Config streams.

Add a new Needs32bitConv stream flag to indicate that this stream needs
a software postprocessing conversion run on it before returning out to
the application.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/libcamera/pipeline/rpi/common/rpi_stream.cpp |  4 ++--
 src/libcamera/pipeline/rpi/common/rpi_stream.h   | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

Comments

Jacopo Mondi Oct. 12, 2023, 7:50 a.m. UTC | #1
On Fri, Oct 06, 2023 at 02:19:42PM +0100, Naushir Patuck via libcamera-devel wrote:
> Add a new "Recurrent" stream flag. This flag indicates the stream buffer
> handling/management happend from the pipeline handler exclusively. This
> is used for TDN/Stitch and Config streams.
>
> Add a new Needs32bitConv stream flag to indicate that this stream needs
> a software postprocessing conversion run on it before returning out to
> the application.
>
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>


> ---
>  src/libcamera/pipeline/rpi/common/rpi_stream.cpp |  4 ++--
>  src/libcamera/pipeline/rpi/common/rpi_stream.h   | 11 +++++++++++
>  2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
> index 83c2205f7ca0..fd6f2efc6e27 100644
> --- a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
> +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
> @@ -155,7 +155,7 @@ int Stream::queueBuffer(FrameBuffer *buffer)
>
>  void Stream::returnBuffer(FrameBuffer *buffer)
>  {
> -	if (!(flags_ & StreamFlag::External)) {
> +	if (!(flags_ & StreamFlag::External) && !(flags_ & StreamFlag::Recurrent)) {
>  		/* For internal buffers, simply requeue back to the device. */
>  		queueToDevice(buffer);
>  		return;
> @@ -217,7 +217,7 @@ int Stream::queueAllBuffers()
>  {
>  	int ret;
>
> -	if (flags_ & StreamFlag::External)
> +	if ((flags_ & StreamFlag::External) || (flags_ & StreamFlag::Recurrent))
>  		return 0;
>
>  	while (!availableBuffers_.empty()) {
> diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h
> index 861e9c8e7dab..c5e35d134926 100644
> --- a/src/libcamera/pipeline/rpi/common/rpi_stream.h
> +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h
> @@ -70,6 +70,17 @@ public:
>  		 * to the pipeline handler when requested.
>  		 */
>  		RequiresMmap	= (1 << 2),
> +		/*
> +		 * Indicates a stream that needs buffers recycled every frame internally
> +		 * in the pipeline handler, e.g. stitch, TDN, config. All buffer
> +		 * management will be handled by the pipeline handler.
> +		 */
> +		Recurrent	= (1 << 3),
> +		/*
> +		 * Indicates that the output stream needs a software format conversion
> +		 * to be applied after ISP processing.
> +		 */
> +		Needs32bitConv	= (1 << 4),
>  	};
>
>  	using StreamFlags = Flags<StreamFlag>;
> --
> 2.34.1
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
index 83c2205f7ca0..fd6f2efc6e27 100644
--- a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
@@ -155,7 +155,7 @@  int Stream::queueBuffer(FrameBuffer *buffer)
 
 void Stream::returnBuffer(FrameBuffer *buffer)
 {
-	if (!(flags_ & StreamFlag::External)) {
+	if (!(flags_ & StreamFlag::External) && !(flags_ & StreamFlag::Recurrent)) {
 		/* For internal buffers, simply requeue back to the device. */
 		queueToDevice(buffer);
 		return;
@@ -217,7 +217,7 @@  int Stream::queueAllBuffers()
 {
 	int ret;
 
-	if (flags_ & StreamFlag::External)
+	if ((flags_ & StreamFlag::External) || (flags_ & StreamFlag::Recurrent))
 		return 0;
 
 	while (!availableBuffers_.empty()) {
diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h
index 861e9c8e7dab..c5e35d134926 100644
--- a/src/libcamera/pipeline/rpi/common/rpi_stream.h
+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h
@@ -70,6 +70,17 @@  public:
 		 * to the pipeline handler when requested.
 		 */
 		RequiresMmap	= (1 << 2),
+		/*
+		 * Indicates a stream that needs buffers recycled every frame internally
+		 * in the pipeline handler, e.g. stitch, TDN, config. All buffer
+		 * management will be handled by the pipeline handler.
+		 */
+		Recurrent	= (1 << 3),
+		/*
+		 * Indicates that the output stream needs a software format conversion
+		 * to be applied after ISP processing.
+		 */
+		Needs32bitConv	= (1 << 4),
 	};
 
 	using StreamFlags = Flags<StreamFlag>;