[v2,21/32] ipa: rkisp1: Allow processStats() to be called without stats buffer
diff mbox series

Message ID 20260325151416.2114564-22-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • rkisp1: pipeline rework for PFC
Related show

Commit Message

Stefan Klug March 25, 2026, 3:13 p.m. UTC
When there are no stats available for a frame, it still makes sense to
call processStats() to fill in the metadata of that frame. This
mechanism is already used for the raw path. Allow it's use for non-raw
also.

The current code never produces buffers with id 0, but it is not
enforced. Add a assert to enforce that.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

---

Changes in v2:
- Added an assert to ensure there is no buffer with id 0
---
 src/ipa/rkisp1/rkisp1.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 3f943a08d011..88cf6afc219d 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -304,6 +304,9 @@  int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,
 void IPARkISP1::mapBuffers(const std::vector<IPABuffer> &buffers)
 {
 	for (const IPABuffer &buffer : buffers) {
+		/* A buffer id of 0 is considered invalid */
+		ASSERT(buffer.id != 0);
+
 		auto elem = buffers_.emplace(std::piecewise_construct,
 					     std::forward_as_tuple(buffer.id),
 					     std::forward_as_tuple(buffer.planes));
@@ -389,7 +392,7 @@  void IPARkISP1::processStats(const uint32_t frame, const uint32_t bufferId,
 	 * provided.
 	 */
 	const rkisp1_stat_buffer *stats = nullptr;
-	if (!context_.configuration.raw)
+	if (bufferId != 0)
 		stats = reinterpret_cast<rkisp1_stat_buffer *>(
 			mappedBuffers_.at(bufferId).planes()[0].data());