diff --git a/msm/sde/sde_encoder_phys_wb.c b/msm/sde/sde_encoder_phys_wb.c index 89d3b482..01b8d700 100644 --- a/msm/sde/sde_encoder_phys_wb.c +++ b/msm/sde/sde_encoder_phys_wb.c @@ -181,15 +181,18 @@ static void sde_encoder_phys_wb_set_qos(struct sde_encoder_phys *phys_enc) qos_cfg.danger_safe_en = true; - if (phys_enc->in_clone_mode) + if (phys_enc->in_clone_mode && (SDE_FORMAT_IS_TILE(wb_enc->wb_fmt) || + SDE_FORMAT_IS_UBWC(wb_enc->wb_fmt))) + lut_index = SDE_QOS_LUT_USAGE_CWB_TILE; + else if (phys_enc->in_clone_mode) lut_index = SDE_QOS_LUT_USAGE_CWB; else lut_index = SDE_QOS_LUT_USAGE_NRT; - index = (fps_index * SDE_QOS_LUT_USAGE_MAX) + lut_index; + index = (fps_index * SDE_QOS_LUT_USAGE_MAX) + lut_index; qos_cfg.danger_lut = perf->danger_lut[index]; qos_cfg.safe_lut = (u32) perf->safe_lut[index]; - qos_cfg.creq_lut = perf->creq_lut[index]; + qos_cfg.creq_lut = perf->creq_lut[index * SDE_CREQ_LUT_TYPE_MAX]; SDE_DEBUG("wb_enc:%d hw idx:%d fps:%d mode:%d luts[0x%x,0x%x 0x%llx]\n", DRMID(phys_enc->parent), hw_wb->idx - WB_0, diff --git a/msm/sde/sde_hw_catalog.c b/msm/sde/sde_hw_catalog.c index 53627e82..cba5ba66 100644 --- a/msm/sde/sde_hw_catalog.c +++ b/msm/sde/sde_hw_catalog.c @@ -243,12 +243,7 @@ enum { QOS_REFRESH_RATES, QOS_DANGER_LUT, QOS_SAFE_LUT, - QOS_CREQ_LUT_LINEAR, - QOS_CREQ_LUT_MACROTILE, - QOS_CREQ_LUT_NRT, - QOS_CREQ_LUT_CWB, - QOS_CREQ_LUT_MACROTILE_QSEED, - QOS_CREQ_LUT_LINEAR_QSEED, + QOS_CREQ_LUT, QOS_PROP_MAX, }; @@ -650,18 +645,7 @@ static struct sde_prop_type sde_qos_prop[] = { PROP_TYPE_U32_ARRAY}, {QOS_DANGER_LUT, "qcom,sde-danger-lut", false, PROP_TYPE_U32_ARRAY}, {QOS_SAFE_LUT, "qcom,sde-safe-lut", false, PROP_TYPE_U32_ARRAY}, - {QOS_CREQ_LUT_LINEAR, "qcom,sde-qos-lut-linear", false, - PROP_TYPE_U32_ARRAY}, - {QOS_CREQ_LUT_MACROTILE, "qcom,sde-qos-lut-macrotile", false, - PROP_TYPE_U32_ARRAY}, - {QOS_CREQ_LUT_NRT, "qcom,sde-qos-lut-nrt", false, - PROP_TYPE_U32_ARRAY}, - {QOS_CREQ_LUT_CWB, "qcom,sde-qos-lut-cwb", false, - PROP_TYPE_U32_ARRAY}, - {QOS_CREQ_LUT_MACROTILE_QSEED, "qcom,sde-qos-lut-macrotile-qseed", - false, PROP_TYPE_U32_ARRAY}, - {QOS_CREQ_LUT_LINEAR_QSEED, "qcom,sde-qos-lut-linear-qseed", - false, PROP_TYPE_U32_ARRAY}, + {QOS_CREQ_LUT, "qcom,sde-creq-lut", false, PROP_TYPE_U32_ARRAY}, }; static struct sde_prop_type sspp_prop[] = { @@ -4238,7 +4222,7 @@ static int _sde_qos_parse_dt_cfg(struct sde_mdss_cfg *cfg, int *prop_count, struct sde_prop_value *prop_value, bool *prop_exists) { int i, j; - u32 qos_count = 1, index; + u32 qos_count = 1; if (prop_exists[QOS_REFRESH_RATES]) { qos_count = prop_count[QOS_REFRESH_RATES]; @@ -4262,7 +4246,7 @@ static int _sde_qos_parse_dt_cfg(struct sde_mdss_cfg *cfg, int *prop_count, cfg->perf.safe_lut = kcalloc(qos_count, sizeof(u64) * SDE_QOS_LUT_USAGE_MAX, GFP_KERNEL); cfg->perf.creq_lut = kcalloc(qos_count, - sizeof(u64) * SDE_QOS_LUT_USAGE_MAX, GFP_KERNEL); + sizeof(u64) * SDE_QOS_LUT_USAGE_MAX * SDE_CREQ_LUT_TYPE_MAX, GFP_KERNEL); if (!cfg->perf.creq_lut || !cfg->perf.safe_lut || !cfg->perf.danger_lut) goto end; @@ -4288,37 +4272,16 @@ static int _sde_qos_parse_dt_cfg(struct sde_mdss_cfg *cfg, int *prop_count, } } - for (i = 0; i < SDE_QOS_LUT_USAGE_MAX; i++) { - static const u32 prop_key[SDE_QOS_LUT_USAGE_MAX] = { - [SDE_QOS_LUT_USAGE_LINEAR] = - QOS_CREQ_LUT_LINEAR, - [SDE_QOS_LUT_USAGE_MACROTILE] = - QOS_CREQ_LUT_MACROTILE, - [SDE_QOS_LUT_USAGE_NRT] = - QOS_CREQ_LUT_NRT, - [SDE_QOS_LUT_USAGE_CWB] = - QOS_CREQ_LUT_CWB, - [SDE_QOS_LUT_USAGE_MACROTILE_QSEED] = - QOS_CREQ_LUT_MACROTILE_QSEED, - [SDE_QOS_LUT_USAGE_LINEAR_QSEED] = - QOS_CREQ_LUT_LINEAR_QSEED, - }; - int key = prop_key[i]; + if (prop_exists[QOS_CREQ_LUT] && + (prop_count[QOS_CREQ_LUT] >= + (SDE_QOS_LUT_USAGE_MAX * qos_count * SDE_CREQ_LUT_TYPE_MAX))) { u64 lut_hi, lut_lo; - if (!prop_exists[key]) - continue; - - for (j = 0; j < qos_count; j++) { - lut_hi = PROP_VALUE_ACCESS(prop_value, key, - (j * 2) + 0); - lut_lo = PROP_VALUE_ACCESS(prop_value, key, - (j * 2) + 1); - index = (j * SDE_QOS_LUT_USAGE_MAX) + i; - cfg->perf.creq_lut[index] = - (lut_hi << 32) | lut_lo; - SDE_DEBUG("creq usage:%d lut:0x%llx\n", - index, cfg->perf.creq_lut[index]); + for (j = 0; j < (qos_count * SDE_QOS_LUT_USAGE_MAX * SDE_CREQ_LUT_TYPE_MAX); j++) { + lut_hi = PROP_VALUE_ACCESS(prop_value, QOS_CREQ_LUT, (j * 2) + 0); + lut_lo = PROP_VALUE_ACCESS(prop_value, QOS_CREQ_LUT, (j * 2) + 1); + cfg->perf.creq_lut[j] = (lut_hi << 32) | lut_lo; + SDE_DEBUG("creq usage:%d lut:0x%llx\n", j, cfg->perf.creq_lut[j]); } } diff --git a/msm/sde/sde_hw_catalog.h b/msm/sde/sde_hw_catalog.h index 125b3a46..2446060c 100644 --- a/msm/sde/sde_hw_catalog.h +++ b/msm/sde/sde_hw_catalog.h @@ -715,11 +715,22 @@ enum sde_qos_lut_usage { SDE_QOS_LUT_USAGE_MACROTILE, SDE_QOS_LUT_USAGE_NRT, SDE_QOS_LUT_USAGE_CWB, - SDE_QOS_LUT_USAGE_MACROTILE_QSEED, - SDE_QOS_LUT_USAGE_LINEAR_QSEED, + SDE_QOS_LUT_USAGE_CWB_TILE, + SDE_QOS_LUT_USAGE_INLINE, + SDE_QOS_LUT_USAGE_INLINE_RESTRICTED_FMTS, SDE_QOS_LUT_USAGE_MAX, }; +/** + * enum sde_creq_lut_types - define creq LUT types possible for all use cases + * This is second dimension to sde_qos_lut_usage enum. + */ +enum sde_creq_lut_types { + SDE_CREQ_LUT_TYPE_NOQSEED, + SDE_CREQ_LUT_TYPE_QSEED, + SDE_CREQ_LUT_TYPE_MAX, +}; + /** * struct sde_sspp_sub_blks : SSPP sub-blocks * @maxlinewidth: max source pipe line width support diff --git a/msm/sde/sde_hw_catalog_format.h b/msm/sde/sde_hw_catalog_format.h index 69765ea0..7b049f24 100644 --- a/msm/sde/sde_hw_catalog_format.h +++ b/msm/sde/sde_hw_catalog_format.h @@ -56,6 +56,10 @@ #define P010_UBWC_FMTS {DRM_FORMAT_NV12, DRM_FORMAT_MOD_QCOM_DX | \ DRM_FORMAT_MOD_QCOM_COMPRESSED} +#define SDE_IS_IN_ROT_RESTRICTED_FMT(catalog, fmt) (catalog ? \ + (sde_format_validate_fmt(NULL, fmt, \ + catalog->inline_rot_restricted_formats) == 0) : false) + static const struct sde_format_extended plane_formats[] = { RGB_FMTS, RGB_10BIT_FMTS, diff --git a/msm/sde/sde_plane.c b/msm/sde/sde_plane.c index 662e8213..f01aa017 100644 --- a/msm/sde/sde_plane.c +++ b/msm/sde/sde_plane.c @@ -253,9 +253,10 @@ void _sde_plane_set_qos_lut(struct drm_plane *plane, { struct sde_plane *psde; const struct sde_format *fmt = NULL; - u32 frame_rate, qos_count, fps_index = 0, lut_index, index; + u32 frame_rate, qos_count, fps_index = 0, lut_index, creq_lut_index, index; struct sde_perf_cfg *perf; struct sde_plane_state *pstate; + bool inline_rot = false; if (!plane || !fb) { SDE_ERROR("invalid arguments\n"); @@ -282,28 +283,33 @@ void _sde_plane_set_qos_lut(struct drm_plane *plane, fps_index++; } - if (!psde->is_rt_pipe) { - lut_index = SDE_QOS_LUT_USAGE_NRT; - } else { - fmt = sde_get_sde_format_ext( - fb->format->format, - fb->modifier); + if (psde->is_rt_pipe) { + fmt = sde_get_sde_format_ext(fb->format->format, fb->modifier); + inline_rot = (pstate->rotation & DRM_MODE_ROTATE_90); - if (fmt && SDE_FORMAT_IS_LINEAR(fmt) && - pstate->scaler3_cfg.enable) - lut_index = SDE_QOS_LUT_USAGE_LINEAR_QSEED; + if (inline_rot && SDE_IS_IN_ROT_RESTRICTED_FMT(psde->catalog, fmt)) + lut_index = SDE_QOS_LUT_USAGE_INLINE_RESTRICTED_FMTS; + else if (inline_rot) + lut_index = SDE_QOS_LUT_USAGE_INLINE; else if (fmt && SDE_FORMAT_IS_LINEAR(fmt)) lut_index = SDE_QOS_LUT_USAGE_LINEAR; - else if (pstate->scaler3_cfg.enable) - lut_index = SDE_QOS_LUT_USAGE_MACROTILE_QSEED; else lut_index = SDE_QOS_LUT_USAGE_MACROTILE; + + creq_lut_index = lut_index * SDE_CREQ_LUT_TYPE_MAX; + if (pstate->scaler3_cfg.enable) + creq_lut_index += SDE_CREQ_LUT_TYPE_QSEED; + } else { + lut_index = SDE_QOS_LUT_USAGE_NRT; + creq_lut_index = lut_index * SDE_CREQ_LUT_TYPE_MAX; } index = (fps_index * SDE_QOS_LUT_USAGE_MAX) + lut_index; psde->pipe_qos_cfg.danger_lut = perf->danger_lut[index]; psde->pipe_qos_cfg.safe_lut = perf->safe_lut[index]; - psde->pipe_qos_cfg.creq_lut = perf->creq_lut[index]; + + creq_lut_index += (fps_index * SDE_QOS_LUT_USAGE_MAX); + psde->pipe_qos_cfg.creq_lut = perf->creq_lut[creq_lut_index]; trace_sde_perf_set_qos_luts(psde->pipe - SSPP_VIG0, (fmt) ? fmt->base.pixel_format : 0,