[libcamera-devel,v2,12/20] pipeline: rpi: Add SW downscale status to RPi::Stream
diff mbox series

Message ID 20231013074841.16972-13-naush@raspberrypi.com
State Accepted
Headers show
Series
  • Raspberry Pi: Preliminary PiSP support
Related show

Commit Message

Naushir Patuck Oct. 13, 2023, 7:48 a.m. UTC
Record if additional software downscaling is needed for a particular
stream in the RPi::Stream class. Additional software downscaling may be
needed if the user required downscale factor is greater than what the
ISP hardware is capable of.

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 | 10 ++++++++++
 src/libcamera/pipeline/rpi/common/rpi_stream.h   | 11 +++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

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 20864aeed2d1..70f115f17977 100644
--- a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
@@ -57,6 +57,16 @@  const std::string &Stream::name() const
 	return name_;
 }
 
+unsigned int Stream::swDownscale() const
+{
+	return swDownscale_;
+}
+
+void Stream::setSwDownscale(unsigned int swDownscale)
+{
+	swDownscale_ = swDownscale;
+}
+
 void Stream::resetBuffers()
 {
 	/* Add all internal buffers to the queue of usable buffers. */
diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h
index c5e35d134926..fc2bdfe25d4a 100644
--- a/src/libcamera/pipeline/rpi/common/rpi_stream.h
+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h
@@ -86,13 +86,14 @@  public:
 	using StreamFlags = Flags<StreamFlag>;
 
 	Stream()
-		: flags_(StreamFlag::None), id_(0)
+		: flags_(StreamFlag::None), id_(0), swDownscale_(0)
 	{
 	}
 
 	Stream(const char *name, MediaEntity *dev, StreamFlags flags = StreamFlag::None)
 		: flags_(flags), name_(name),
-		  dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(0)
+		  dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(0),
+		  swDownscale_(0)
 	{
 	}
 
@@ -104,6 +105,9 @@  public:
 	const std::string &name() const;
 	void resetBuffers();
 
+	unsigned int swDownscale() const;
+	void setSwDownscale(unsigned int swDownscale);
+
 	void setExportedBuffers(std::vector<std::unique_ptr<FrameBuffer>> *buffers);
 	const BufferMap &getBuffers() const;
 	unsigned int getBufferId(FrameBuffer *buffer) const;
@@ -139,6 +143,9 @@  private:
 	/* Tracks a unique id key for the bufferMap_ */
 	unsigned int id_;
 
+	/* Power of 2 greater than one if software downscaling will be required. */
+	unsigned int swDownscale_;
+
 	/* All frame buffers associated with this device stream. */
 	BufferMap bufferMap_;