From: Jeonghee Kim Date: Wed, 18 Jul 2018 03:51:27 +0000 (+0900) Subject: [COMMON] media: mfc: parse QoS weight X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=edb7d6f6224cdfa5b6464a72c43740ad1171c10c;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] media: mfc: parse QoS weight Change-Id: Idbad3132753e989c25d2183ba38dccce9390e3a2 Signed-off-by: Jeonghee Kim --- diff --git a/drivers/media/platform/exynos/mfc/mfc.c b/drivers/media/platform/exynos/mfc/mfc.c index 5bc84f740c13..2e2563b59509 100644 --- a/drivers/media/platform/exynos/mfc/mfc.c +++ b/drivers/media/platform/exynos/mfc/mfc.c @@ -1038,6 +1038,17 @@ static void __mfc_parse_dt(struct device_node *np, struct mfc_dev *mfc) of_property_read_u32(np_qos, "freq_mif", &pdata->qos_boost_table->freq_mif); of_property_read_u32_array(np_qos, "freq_cluster", &pdata->qos_boost_table->freq_cluster[0], pdata->qos_boost_table->num_cluster); + + /* QoS weight */ + of_property_read_u32(np, "qos_weight_h264_hevc", &pdata->qos_weight.weight_h264_hevc); + of_property_read_u32(np, "qos_weight_vp8_vp9", &pdata->qos_weight.weight_vp8_vp9); + of_property_read_u32(np, "qos_weight_other_codec", &pdata->qos_weight.weight_other_codec); + of_property_read_u32(np, "qos_weight_3plane", &pdata->qos_weight.weight_3plane); + of_property_read_u32(np, "qos_weight_10bit", &pdata->qos_weight.weight_10bit); + of_property_read_u32(np, "qos_weight_422", &pdata->qos_weight.weight_422); + of_property_read_u32(np, "qos_weight_bframe", &pdata->qos_weight.weight_bframe); + of_property_read_u32(np, "qos_weight_num_of_ref", &pdata->qos_weight.weight_num_of_ref); + of_property_read_u32(np, "qos_weight_num_of_tile", &pdata->qos_weight.weight_num_of_tile); #endif } diff --git a/drivers/media/platform/exynos/mfc/mfc_data_struct.h b/drivers/media/platform/exynos/mfc/mfc_data_struct.h index ad7e82b713e8..504765aa5b61 100644 --- a/drivers/media/platform/exynos/mfc/mfc_data_struct.h +++ b/drivers/media/platform/exynos/mfc/mfc_data_struct.h @@ -393,6 +393,18 @@ struct mfc_qos_boost { unsigned int freq_mif; unsigned int freq_cluster[MAX_NUM_CLUSTER]; }; + +struct mfc_qos_weight { + unsigned int weight_h264_hevc; + unsigned int weight_vp8_vp9; + unsigned int weight_other_codec; + unsigned int weight_3plane; + unsigned int weight_10bit; + unsigned int weight_422; + unsigned int weight_bframe; + unsigned int weight_num_of_ref; + unsigned int weight_num_of_tile; +}; #endif struct mfc_feature { @@ -436,6 +448,9 @@ struct mfc_platdata { struct mfc_feature static_info_enc; #ifdef CONFIG_EXYNOS_BTS struct mfc_bw_info mfc_bw_info; +#endif +#ifdef CONFIG_MFC_USE_BUS_DEVFREQ + struct mfc_qos_weight qos_weight; #endif /* * new variables should be added above diff --git a/drivers/media/platform/exynos/mfc/mfc_qos.c b/drivers/media/platform/exynos/mfc/mfc_qos.c index e4ca3fd3081e..fc401a57c820 100644 --- a/drivers/media/platform/exynos/mfc/mfc_qos.c +++ b/drivers/media/platform/exynos/mfc/mfc_qos.c @@ -251,6 +251,7 @@ static inline unsigned long __mfc_qos_get_weighted_mb(struct mfc_ctx *ctx, struct mfc_enc *enc = ctx->enc_priv; struct mfc_dec *dec = ctx->dec_priv; struct mfc_enc_params *p; + struct mfc_qos_weight *qos_weight = &ctx->dev->pdata->qos_weight; u32 num_planes = ctx->dst_fmt->num_planes; int weight = 1000; unsigned long weighted_mb; @@ -260,25 +261,60 @@ static inline unsigned long __mfc_qos_get_weighted_mb(struct mfc_ctx *ctx, case MFC_REG_CODEC_H264_MVC_DEC: case MFC_REG_CODEC_H264_ENC: case MFC_REG_CODEC_H264_MVC_ENC: + weight = (weight * 100) / qos_weight->weight_h264_hevc; + mfc_debug(3, "[QoS] weight: h264, hevc codec, weight: %d\n", weight / 10); + if (num_planes == 3) { + weight = (weight * 100) / qos_weight->weight_3plane; + mfc_debug(3, "[QoS] weight: 3 plane, weight: %d\n", weight / 10); + } + break; + case MFC_REG_CODEC_VP8_DEC: case MFC_REG_CODEC_VP8_ENC: - if (num_planes == 3) - weight = (weight * 100) / MFC_QOS_WEIGHT_3PLANE; + weight = (weight * 100) / qos_weight->weight_vp8_vp9; + mfc_debug(3, "[QoS] weight: vp8, vp9 codec, weight: %d\n", weight / 10); + if (num_planes == 3) { + weight = (weight * 100) / qos_weight->weight_3plane; + mfc_debug(3, "[QoS] weight: 3 plane, weight: %d\n", weight / 10); + } break; case MFC_REG_CODEC_HEVC_DEC: case MFC_REG_CODEC_HEVC_ENC: - case MFC_REG_CODEC_VP9_DEC: - case MFC_REG_CODEC_VP9_ENC: case MFC_REG_CODEC_BPG_DEC: case MFC_REG_CODEC_BPG_ENC: + weight = (weight * 100) / qos_weight->weight_h264_hevc; + mfc_debug(3, "[QoS] weight: h264, hevc codec, weight: %d\n", weight / 10); + if (num_planes == 3) { + weight = (weight * 100) / qos_weight->weight_3plane; + mfc_debug(3, "[QoS] weight: 3 plane, weight: %d\n", weight / 10); + } else { + if (ctx->is_422) { + weight = (weight * 100) / qos_weight->weight_422; + mfc_debug(3, "[QoS] weight: 422foramt, weight: %d\n", weight / 10); + } else if (ctx->is_10bit) { + weight = (weight * 100) / qos_weight->weight_10bit; + mfc_debug(3, "[QoS] weight: 10bit, weight: %d\n", weight / 10); + } + } + break; + + case MFC_REG_CODEC_VP9_DEC: + case MFC_REG_CODEC_VP9_ENC: + weight = (weight * 100) / qos_weight->weight_vp8_vp9; + mfc_debug(3, "[QoS] weight: vp8, vp9 codec, weight: %d\n", weight / 10); + if (num_planes == 3) { - weight = (weight * 100) / MFC_QOS_WEIGHT_3PLANE; + weight = (weight * 100) / qos_weight->weight_3plane; + mfc_debug(3, "[QoS] weight: 3 plane, weight: %d\n", weight / 10); } else { - if (ctx->is_10bit) - weight = (weight * 100) / MFC_QOS_WEIGHT_10BIT; - else if (ctx->is_422) - weight = (weight * 100) / MFC_QOS_WEIGHT_422_10INTRA; + if (ctx->is_422) { + weight = (weight * 100) / qos_weight->weight_422; + mfc_debug(3, "[QoS] weight: 422foramt, weight: %d\n", weight / 10); + } else if (ctx->is_10bit) { + weight = (weight * 100) / qos_weight->weight_10bit; + mfc_debug(3, "[QoS] weight: 10bit, weight: %d\n", weight / 10); + } } break; @@ -293,7 +329,8 @@ static inline unsigned long __mfc_qos_get_weighted_mb(struct mfc_ctx *ctx, case MFC_REG_CODEC_MPEG2_DEC: case MFC_REG_CODEC_MPEG4_ENC: case MFC_REG_CODEC_H263_ENC: - weight = (weight * 100) / MFC_QOS_WEIGHT_OTHER_CODEC; + weight = (weight * 100) / qos_weight->weight_other_codec; + mfc_debug(3, "[QoS] weight: other codec, weight: %d\n", weight / 10); break; default: @@ -303,26 +340,26 @@ static inline unsigned long __mfc_qos_get_weighted_mb(struct mfc_ctx *ctx, if (enc) { p = &enc->params; if ((IS_H264_ENC(ctx) || IS_HEVC_ENC(ctx)) && p->num_b_frame) { - weight = (weight * 100) / MFC_QOS_WEIGHT_BFRAME; - mfc_debug(3, "[QoS] weight: B frame encoding\n"); + weight = (weight * 100) / qos_weight->weight_bframe; + mfc_debug(3, "[QoS] weight: B frame encoding, weight: %d\n", weight / 10); } if ((IS_H264_ENC(ctx) || IS_HEVC_ENC(ctx) || IS_VP8_ENC(ctx) || IS_VP9_ENC(ctx)) && (p->num_refs_for_p >= 2)) { - weight = (weight * 100) / MFC_QOS_WEIGHT_NUM_OF_REF; - mfc_debug(3, "[QoS] weight: num of ref >= 2\n"); + weight = (weight * 100) / qos_weight->weight_num_of_ref; + mfc_debug(3, "[QoS] weight: num of ref >= 2, weight: %d\n", weight / 10); } } if (dec) { if (dec->num_of_tile_over_4) { - weight = (weight * 100) / MFC_QOS_WEIGHT_NUM_OF_TILE; - mfc_debug(3, "[QoS] weight: num of tile >= 4\n"); + weight = (weight * 100) / qos_weight->weight_num_of_tile; + mfc_debug(3, "[QoS] weight: num of tile >= 4, weight: %d\n", weight / 10); } } weighted_mb = (mb * weight) / 1000; - mfc_debug(3, "[QoS] weight: %d.%03d, codec: %d, num planes: %d, " + mfc_debug(3, "[QoS] weight: %d, codec: %d, num planes: %d, " "10bit: %d, 422format: %d (mb: %ld)\n", - weight / 1000, weight % 1000, ctx->codec_mode, + weight / 10, ctx->codec_mode, num_planes, ctx->is_10bit, ctx->is_422, weighted_mb); diff --git a/drivers/media/platform/exynos/mfc/mfc_qos.h b/drivers/media/platform/exynos/mfc/mfc_qos.h index 8e3ed4a83d56..a56e57cb8bfb 100644 --- a/drivers/media/platform/exynos/mfc/mfc_qos.h +++ b/drivers/media/platform/exynos/mfc/mfc_qos.h @@ -26,14 +26,6 @@ #define MFC_DRV_TIME 500 -#define MFC_QOS_WEIGHT_3PLANE 80 -#define MFC_QOS_WEIGHT_OTHER_CODEC 25 -#define MFC_QOS_WEIGHT_10BIT 75 -#define MFC_QOS_WEIGHT_422_10INTRA 70 -#define MFC_QOS_WEIGHT_BFRAME 50 -#define MFC_QOS_WEIGHT_NUM_OF_REF 50 -#define MFC_QOS_WEIGHT_NUM_OF_TILE 75 - #ifdef CONFIG_MFC_USE_BUS_DEVFREQ void mfc_perf_boost_enable(struct mfc_dev *dev); void mfc_perf_boost_disable(struct mfc_dev *dev);