From: Cho KyongHo Date: Tue, 2 Jun 2015 07:27:54 +0000 (+0900) Subject: [COMMON] media: smfc: measure H/W delay X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0b03ae6650611118472bc30fd76c404a1025127d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] media: smfc: measure H/W delay The delay in usec. is stored to reserved2 field of v4l2_buffer of capture queue. Change-Id: I91165095d69003d67c48a36a147d03a386d9ed89 Signed-off-by: Cho KyongHo --- diff --git a/drivers/media/platform/exynos/smfc/smfc.c b/drivers/media/platform/exynos/smfc/smfc.c index c9fe83960601..9e3bebbc5931 100644 --- a/drivers/media/platform/exynos/smfc/smfc.c +++ b/drivers/media/platform/exynos/smfc/smfc.c @@ -292,11 +292,14 @@ static irqreturn_t exynos_smfc_irq_handler(int irq, void *priv) { struct smfc_dev *smfc = priv; struct smfc_ctx *ctx = v4l2_m2m_get_curr_priv(smfc->m2mdev); + ktime_t ktime; enum vb2_buffer_state state = VB2_BUF_STATE_DONE; u32 streamsize = smfc_get_streamsize(smfc); u32 thumb_streamsize = smfc_get_2nd_streamsize(smfc); bool suspending = false; + ktime = ktime_get(); + if (!(smfc->flags & SMFC_DEV_RUNNING)) { smfc_dump_registers(smfc); BUG(); @@ -333,6 +336,10 @@ static irqreturn_t exynos_smfc_irq_handler(int irq, void *priv) vb2_set_plane_payload(&vb_capture->vb2_buf, 1, thumb_streamsize); } + + vb_capture->vb2_buf.timestamp = + (__u32)ktime_us_delta(ktime, ctx->ktime_beg); + v4l2_m2m_buf_done(v4l2_m2m_src_buf_remove(ctx->m2mctx), state); v4l2_m2m_buf_done(vb_capture, state); if (!suspending) { @@ -1235,6 +1242,8 @@ static void smfc_m2m_device_run(void *priv) ctx->smfc->flags |= SMFC_DEV_RUNNING; spin_unlock_irqrestore(&ctx->smfc->flag_lock, flags); + ctx->ktime_beg = ktime_get(); + smfc_hwconfigure_start(ctx, restart_interval, !!enable_hwfc); return; diff --git a/drivers/media/platform/exynos/smfc/smfc.h b/drivers/media/platform/exynos/smfc/smfc.h index a59e01b6a25c..9a758adaaa0a 100644 --- a/drivers/media/platform/exynos/smfc/smfc.h +++ b/drivers/media/platform/exynos/smfc/smfc.h @@ -12,6 +12,8 @@ #ifndef _MEDIA_EXYNOS_SMFC_H_ #define _MEDIA_EXYNOS_SMFC_H_ +#include + #include #include #include @@ -68,6 +70,7 @@ struct smfc_ctx { struct v4l2_ctrl_handler v4l2_ctrlhdlr; struct smfc_dev *smfc; struct v4l2_m2m_ctx *m2mctx; + ktime_t ktime_beg; u32 flags; /* uncomressed image description */ const struct smfc_image_format *img_fmt;