[v2,29/32] pipeline: rkisp1: Pass bufferId to paramsComputed()
diff mbox series

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

Commit Message

Stefan Klug March 25, 2026, 3:14 p.m. UTC
The frame number is not necessarily unique. This should not be the case,
but even misbehaving kernel drivers should not be able to interfere with
that on the libcamera side. Pass the bufferId, to have a guaranteed
unique handle.

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

---

Changes in v2:
- Added this patch
---
 include/libcamera/ipa/rkisp1.mojom       | 2 +-
 src/ipa/rkisp1/rkisp1.cpp                | 2 +-
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom
index 56c9fe8ab92a..e48bdf92c8f8 100644
--- a/include/libcamera/ipa/rkisp1.mojom
+++ b/include/libcamera/ipa/rkisp1.mojom
@@ -45,7 +45,7 @@  interface IPARkISP1Interface {
 };
 
 interface IPARkISP1EventInterface {
-	paramsComputed(uint32 frame, uint32 bytesused);
+	paramsComputed(uint32 frame, uint32 bufferId, uint32 bytesused);
 	setSensorControls(uint32 frame, libcamera.ControlList sensorControls);
 	metadataReady(uint32 frame, libcamera.ControlList metadata);
 };
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 8a657a170b0d..863cea13dfa3 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -381,7 +381,7 @@  void IPARkISP1::computeParams(const uint32_t frame, const uint32_t bufferId)
 	setSensorControls.emit(frame, ctrls);
 
 	if (bufferId != 0)
-		paramsComputed.emit(frame, size);
+		paramsComputed.emit(frame, bufferId, size);
 }
 
 void IPARkISP1::processStats(const uint32_t frame, const uint32_t bufferId,
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index b6592e87dcc4..c46515110ffc 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -105,7 +105,7 @@  public:
 	bool canUseDewarper_;
 	bool usesDewarper_;
 
-	void paramsComputed(unsigned int frame, unsigned int bytesused);
+	void paramsComputed(unsigned int frame, unsigned int bufferId, unsigned int bytesused);
 private:
 	void setSensorControls(unsigned int frame,
 			       const ControlList &sensorControls);
@@ -376,14 +376,14 @@  int RkISP1CameraData::loadTuningFile(const std::string &path)
 	return 0;
 }
 
-void RkISP1CameraData::paramsComputed(unsigned int frame, unsigned int bytesused)
+void RkISP1CameraData::paramsComputed(unsigned int frame, unsigned int bufferId, unsigned int bytesused)
 {
 	PipelineHandlerRkISP1 *pipe = RkISP1CameraData::pipe();
 	ParamBufferInfo &pInfo = pipe->computingParamBuffers_.front();
 	pipe->computingParamBuffers_.pop();
 
-	ASSERT(pInfo.expectedSequence == frame);
 	FrameBuffer *buffer = pInfo.buffer;
+	ASSERT(buffer->cookie() == bufferId);
 
 	LOG(RkISP1Schedule, Debug) << "Queue params for " << frame << " " << buffer;
 
@@ -1225,7 +1225,7 @@  int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL
 		availableParamBuffers_.pop();
 		computingParamBuffers_.push({ paramBuffer, nextParamsSequence_++ });
 		paramsSyncHelper_.pushCorrection(0);
-		data->paramsComputed(0, res.paramBufferBytesUsed);
+		data->paramsComputed(0, paramBufferId, res.paramBufferBytesUsed);
 	}
 
 	actions += [&]() { data->ipa_->stop(); };