From bdbd8598d4f9247d7cacb3b45c2ba36bf37020c4 Mon Sep 17 00:00:00 2001 From: Jeonghee Kim Date: Fri, 27 Oct 2017 18:24:41 +0900 Subject: [PATCH] media: mfc: changed the framerate calculation method Change-Id: If8c0d412671e9e0a52d19fc43a43aaf2b755319b Signed-off-by: Jeonghee Kim --- .../platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c | 2 +- drivers/media/platform/exynos/mfc/s5p_mfc_irq.c | 6 +++--- .../media/platform/exynos/mfc/s5p_mfc_nal_q.c | 6 +++--- drivers/media/platform/exynos/mfc/s5p_mfc_qos.c | 6 ++++++ drivers/media/platform/exynos/mfc/s5p_mfc_qos.h | 17 +++++++++-------- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c b/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c index a1d954533f89..67b696f3e51e 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c @@ -156,7 +156,7 @@ static int s5p_mfc_enc_buf_init(struct vb2_buffer *vb) if (IS_BUFFER_BATCH_MODE(ctx)) { int count = 0; - ctx->framerate = ctx->num_bufs_in_vb * ENC_DEFAULT_CAM_FPS; + ctx->framerate = ctx->num_bufs_in_vb * ENC_DEFAULT_CAM_CAPTURE_FPS; mfc_debug(3, "framerate: %ld\n", ctx->framerate); count = s5p_mfc_bufcon_get_daddr(ctx, buf, dmabuf, i); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c index 76d039fb4e00..c9c98d359228 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c @@ -778,9 +778,9 @@ static void mfc_handle_stream_copy_timestamp(struct s5p_mfc_ctx *ctx, struct s5p } start_timestamp = src_mb->vb.vb2_buf.timestamp; - interval = NSEC_PER_SEC / (ctx->framerate / 1000); - mfc_debug(3, "%ldfps, start timestamp: %lld, base interval: %lld\n", - ctx->framerate / 1000, start_timestamp, interval); + interval = NSEC_PER_SEC / (ENC_DEFAULT_CAM_VIDEO_FPS / 1000); + mfc_debug(3, "%dfps, start timestamp: %lld, base interval: %lld\n", + (ENC_DEFAULT_CAM_VIDEO_FPS / 1000), start_timestamp, interval); new_timestamp = start_timestamp + (interval * src_mb->done_index); mfc_debug(3, "new timestamp: %lld, interval: %lld\n", diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c b/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c index bad76fcd96a1..4d55a1f33f5c 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c @@ -819,9 +819,9 @@ static void mfc_nal_q_handle_stream_copy_timestamp(struct s5p_mfc_ctx *ctx, stru } start_timestamp = src_mb->vb.vb2_buf.timestamp; - interval = NSEC_PER_SEC / (ctx->framerate / 1000); - mfc_debug(3, "NAL Q: %ldfps, start timestamp: %lld, base interval: %lld\n", - ctx->framerate / 1000, start_timestamp, interval); + interval = NSEC_PER_SEC / (ENC_DEFAULT_CAM_VIDEO_FPS / 1000); + mfc_debug(3, "NAL Q: %dfps, start timestamp: %lld, base interval: %lld\n", + (ENC_DEFAULT_CAM_VIDEO_FPS / 1000), start_timestamp, interval); new_timestamp = start_timestamp + (interval * src_mb->done_index); mfc_debug(3, "NAL Q: new timestamp: %lld, interval: %lld\n", diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c index b9dabbbe2b5e..a3e9cc45c8dd 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c @@ -660,6 +660,12 @@ static unsigned long mfc_qos_get_fps_by_timestamp(struct s5p_mfc_ctx *ctx, struc time->tv_sec, time->tv_usec, ctx->ts_count); } + if (IS_BUFFER_BATCH_MODE(ctx)) { + mfc_debug(3, "Keep framerate if buffer batch mode is used, %ldfps\n", + ctx->framerate); + return ctx->framerate; + } + if (list_empty(&ctx->ts_list)) { mfc_qos_add_timestamp(ctx, time, &ctx->ts_list); return mfc_qos_get_framerate_by_interval(0); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.h b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.h index 61f3b03c3858..b8e13660040f 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.h @@ -15,16 +15,17 @@ #include "s5p_mfc_common.h" -#define MFC_MAX_FPS (480000) -#define DEC_DEFAULT_FPS (240000) -#define ENC_DEFAULT_FPS (240000) -#define ENC_DEFAULT_CAM_FPS (60000) +#define MFC_MAX_FPS (480000) +#define DEC_DEFAULT_FPS (240000) +#define ENC_DEFAULT_FPS (240000) +#define ENC_DEFAULT_CAM_CAPTURE_FPS (60000) +#define ENC_DEFAULT_CAM_VIDEO_FPS (30000) -#define MB_COUNT_PER_UHD_FRAME 32400 -#define MAX_FPS_PER_UHD_FRAME 120 -#define MIN_BW_PER_SEC 1 +#define MB_COUNT_PER_UHD_FRAME 32400 +#define MAX_FPS_PER_UHD_FRAME 120 +#define MIN_BW_PER_SEC 1 -#define MFC_DRV_TIME 500 +#define MFC_DRV_TIME 500 #define MFC_QOS_WEIGHT_3PLANE 80 #define MFC_QOS_WEIGHT_OTHER_CODEC 25 -- 2.20.1