summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2021-05-12 09:47:43 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-05-18 11:45:31 +0100
commitf1b7b68d209aa2fb074f39be7ca0d7e2c9edd631 (patch)
treef92f410b4a14cbb2858c734bfe2108f999b521c3
parent193ca8c353a42334f65ddfc988a105a47bca3547 (diff)
pipeline: raspberrypi: Store timestamp in the correct Request metadata
Write the controls::SensorTimestamp value in the Request metadata when the request is popped from the queue ready to run the pipeline. This ensures that the timestamp is written to the correct Request item, which may not be at the top of the queue when the Unicam buffer dequeue occurs. Fixes: fcfb1dc02a6b ("libcamera: raspberry: Report sensor timestamp") Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 6fbdba04..eb6d3167 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -221,6 +221,8 @@ public:
private:
void checkRequestCompleted();
+ void fillRequestMetadata(const ControlList &bufferControls,
+ Request *request);
void tryRunPipeline();
bool findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&embeddedBuffer);
@@ -1417,18 +1419,6 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)
if (stream == &unicam_[Unicam::Image]) {
/*
- * Record the sensor timestamp in the Request.
- *
- * \todo Do not assume the request in the front of the queue
- * is the correct one
- */
- Request *request = requestQueue_.front();
- ASSERT(request);
-
- request->metadata().set(controls::SensorTimestamp,
- buffer->metadata().timestamp);
-
- /*
* Lookup the sensor controls used for this frame sequence from
* DelayedControl and queue them along with the frame buffer.
*/
@@ -1689,6 +1679,13 @@ void RPiCameraData::applyScalerCrop(const ControlList &controls)
}
}
+void RPiCameraData::fillRequestMetadata(const ControlList &bufferControls,
+ Request *request)
+{
+ request->metadata().set(controls::SensorTimestamp,
+ bufferControls.get(controls::SensorTimestamp));
+}
+
void RPiCameraData::tryRunPipeline()
{
FrameBuffer *embeddedBuffer;
@@ -1709,6 +1706,14 @@ void RPiCameraData::tryRunPipeline()
applyScalerCrop(request->controls());
/*
+ * Clear the request metadata and fill it with some initial non-IPA
+ * related controls. We clear it first because the request metadata
+ * may have been populated if we have dropped the previous frame.
+ */
+ request->metadata().clear();
+ fillRequestMetadata(bayerFrame.controls, request);
+
+ /*
* Process all the user controls by the IPA. Once this is complete, we
* queue the ISP output buffer listed in the request to start the HW
* pipeline.