From 7925249eb46f0782251dc9ab4c77568dbfe85860 Mon Sep 17 00:00:00 2001 From: Ayoung Sim Date: Tue, 17 Apr 2018 19:22:54 +0900 Subject: [PATCH] media: mfc: DRV4.0: use the crop information for QoS When driver calculates the size for QoS control, there is a difference between decoder and encoder. - encoder: cropped width, cropped height - decoder: full image width, full image height So in case of decoder, crop_width and img_width have same value. Change-Id: I92acf2448b8541999889fbfb4bd1cacf261272d4 Signed-off-by: Ayoung Sim --- drivers/media/platform/exynos/mfc/s5p_mfc_common.h | 4 ++-- drivers/media/platform/exynos/mfc/s5p_mfc_irq.c | 2 ++ drivers/media/platform/exynos/mfc/s5p_mfc_qos.c | 10 +++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_common.h b/drivers/media/platform/exynos/mfc/s5p_mfc_common.h index 81bf93214183..750a9144a428 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_common.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_common.h @@ -152,8 +152,8 @@ /* UHD resoluition */ #define MFC_UHD_RES (3840 * 2160) -#define IS_UHD_RES(ctx) (((ctx)->img_width * (ctx)->img_height) == MFC_UHD_RES) -#define OVER_UHD_ENC60(ctx) ((((ctx)->img_width * (ctx)->img_height) == MFC_UHD_RES) && \ +#define IS_UHD_RES(ctx) (((ctx)->crop_width * (ctx)->crop_height) == MFC_UHD_RES) +#define OVER_UHD_ENC60(ctx) ((((ctx)->crop_width * (ctx)->crop_height) == MFC_UHD_RES) && \ ((ctx)->type == MFCINST_ENCODER) && \ ((ctx)->framerate / 1000) >= 60) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c index 4dcc963d6636..c986b6dcb838 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c @@ -1134,6 +1134,8 @@ static int mfc_handle_seq_dec(struct s5p_mfc_ctx *ctx) if (ctx->src_fmt->fourcc != V4L2_PIX_FMT_FIMV1) { ctx->img_width = s5p_mfc_get_img_width(); ctx->img_height = s5p_mfc_get_img_height(); + ctx->crop_width = ctx->img_width; + ctx->crop_height = ctx->img_height; mfc_info_ctx("width: %d, height: %d\n", ctx->img_width, ctx->img_height); } diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c index 07fb2ef28586..9afcecd6858f 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_qos.c @@ -275,14 +275,14 @@ static inline unsigned long mfc_qos_get_mb_per_second(struct s5p_mfc_ctx *ctx) { unsigned long mb_width, mb_height, fps, mb; - mb_width = (ctx->img_width + 15) / 16; - mb_height = (ctx->img_height + 15) / 16; + mb_width = (ctx->crop_width + 15) / 16; + mb_height = (ctx->crop_height + 15) / 16; fps = ctx->framerate / 1000; mb = mb_width * mb_height * fps; mfc_debug(4, "QoS ctx[%d:%s] %d x %d @ %ld fps (mb: %ld)\n", ctx->num, ctx->type == MFCINST_ENCODER ? "ENC" : "DEC", - ctx->img_width, ctx->img_height, fps, mb); + ctx->crop_width, ctx->crop_height, fps, mb); return mfc_qos_get_weighted_mb(ctx, mb); } @@ -314,8 +314,8 @@ static void mfc_qos_get_bw_per_second(struct s5p_mfc_ctx *ctx, struct bts_bw *mf unsigned long mb_count_per_uhd_frame = MB_COUNT_PER_UHD_FRAME; unsigned long max_fps_per_uhd_frame = MAX_FPS_PER_UHD_FRAME; - mb_width = (ctx->img_width + 15) / 16; - mb_height = (ctx->img_height + 15) / 16; + mb_width = (ctx->crop_width + 15) / 16; + mb_height = (ctx->crop_height + 15) / 16; fps = ctx->framerate / 1000; mb = mb_width * mb_height * fps; -- 2.20.1