ipa: ipu3: Provide frame timestamps through IPU3Event

Pass in frame timestamps from IPU3 pipeline handler to IPU3 IPA via
IPU3Event. Frame timestamps are helpful to IPA algorithms to
convergence, by setting them via IPA stats.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Umang Jain 2021-05-26 18:40:25 +05:30 committed by Laurent Pinchart
parent abbc4bd11b
commit c43c12a24b
3 changed files with 7 additions and 3 deletions

View file

@ -21,6 +21,7 @@ enum IPU3Operations {
struct IPU3Event { struct IPU3Event {
IPU3Operations op; IPU3Operations op;
uint32 frame; uint32 frame;
int64 frameTimestamp;
uint32 bufferId; uint32 bufferId;
libcamera.ControlList controls; libcamera.ControlList controls;
}; };

View file

@ -53,6 +53,7 @@ private:
void processControls(unsigned int frame, const ControlList &controls); void processControls(unsigned int frame, const ControlList &controls);
void fillParams(unsigned int frame, ipu3_uapi_params *params); void fillParams(unsigned int frame, ipu3_uapi_params *params);
void parseStatistics(unsigned int frame, void parseStatistics(unsigned int frame,
int64_t frameTimestamp,
const ipu3_uapi_stats_3a *stats); const ipu3_uapi_stats_3a *stats);
void setControls(unsigned int frame); void setControls(unsigned int frame);
@ -214,7 +215,7 @@ void IPAIPU3::processEvent(const IPU3Event &event)
const ipu3_uapi_stats_3a *stats = const ipu3_uapi_stats_3a *stats =
reinterpret_cast<ipu3_uapi_stats_3a *>(mem.data()); reinterpret_cast<ipu3_uapi_stats_3a *>(mem.data());
parseStatistics(event.frame, stats); parseStatistics(event.frame, event.frameTimestamp, stats);
break; break;
} }
case EventFillParams: { case EventFillParams: {
@ -257,6 +258,7 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)
} }
void IPAIPU3::parseStatistics(unsigned int frame, void IPAIPU3::parseStatistics(unsigned int frame,
[[maybe_unused]] int64_t frameTimestamp,
[[maybe_unused]] const ipu3_uapi_stats_3a *stats) [[maybe_unused]] const ipu3_uapi_stats_3a *stats)
{ {
ControlList ctrls(controls::controls); ControlList ctrls(controls::controls);

View file

@ -1357,6 +1357,8 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer)
if (!info) if (!info)
return; return;
Request *request = info->request;
if (buffer->metadata().status == FrameMetadata::FrameCancelled) { if (buffer->metadata().status == FrameMetadata::FrameCancelled) {
info->metadataProcessed = true; info->metadataProcessed = true;
@ -1364,8 +1366,6 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer)
* tryComplete() will delete info if it completes the IPU3Frame. * tryComplete() will delete info if it completes the IPU3Frame.
* In that event, we must have obtained the Request before hand. * In that event, we must have obtained the Request before hand.
*/ */
Request *request = info->request;
if (frameInfos_.tryComplete(info)) if (frameInfos_.tryComplete(info))
pipe_->completeRequest(request); pipe_->completeRequest(request);
@ -1376,6 +1376,7 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer)
ev.op = ipa::ipu3::EventStatReady; ev.op = ipa::ipu3::EventStatReady;
ev.frame = info->id; ev.frame = info->id;
ev.bufferId = info->statBuffer->cookie(); ev.bufferId = info->statBuffer->cookie();
ev.frameTimestamp = request->metadata().get(controls::SensorTimestamp);
ipa_->processEvent(ev); ipa_->processEvent(ev);
} }