diff --git a/msm/sde/sde_encoder_phys_wb.c b/msm/sde/sde_encoder_phys_wb.c index 9e67c206e0..ea7b9b8dec 100644 --- a/msm/sde/sde_encoder_phys_wb.c +++ b/msm/sde/sde_encoder_phys_wb.c @@ -155,7 +155,7 @@ static void sde_encoder_phys_wb_set_qos(struct sde_encoder_phys *phys_enc) struct sde_hw_wb *hw_wb; struct sde_hw_wb_qos_cfg qos_cfg = {0}; struct sde_perf_cfg *perf; - u32 fps_index = 0, lut_index, index, frame_rate, qos_count; + u32 fps_index = 0, lut_index, creq_index, ds_index, frame_rate, qos_count; if (!phys_enc || !phys_enc->sde_kms || !phys_enc->sde_kms->catalog) { SDE_ERROR("invalid parameter(s)\n"); @@ -190,10 +190,14 @@ static void sde_encoder_phys_wb_set_qos(struct sde_encoder_phys *phys_enc) else lut_index = SDE_QOS_LUT_USAGE_NRT; - 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 * SDE_CREQ_LUT_TYPE_MAX]; + creq_index = lut_index * SDE_CREQ_LUT_TYPE_MAX; + creq_index += (fps_index * SDE_QOS_LUT_USAGE_MAX * SDE_CREQ_LUT_TYPE_MAX); + qos_cfg.creq_lut = perf->creq_lut[creq_index]; + + ds_index = lut_index * SDE_DANGER_SAFE_LUT_TYPE_MAX; + ds_index += (fps_index * SDE_QOS_LUT_USAGE_MAX * SDE_DANGER_SAFE_LUT_TYPE_MAX); + qos_cfg.danger_lut = perf->danger_lut[ds_index]; + qos_cfg.safe_lut = (u32) perf->safe_lut[ds_index]; SDE_DEBUG("[enc:%d wb:%d] fps:%d mode:%d luts[0x%x,0x%x 0x%llx]\n", DRMID(phys_enc->parent), WBID(wb_enc), frame_rate, phys_enc->in_clone_mode, @@ -341,14 +345,15 @@ static void _sde_encoder_phys_wb_setup_cdp(struct sde_encoder_phys *phys_enc, struct sde_encoder_phys_wb *wb_enc = to_sde_encoder_phys_wb(phys_enc); struct sde_hw_wb *hw_wb = wb_enc->hw_wb; struct sde_hw_wb_cdp_cfg *cdp_cfg = &wb_enc->cdp_cfg; + u32 cdp_index; if (!hw_wb->ops.setup_cdp) return; memset(cdp_cfg, 0, sizeof(struct sde_hw_wb_cdp_cfg)); - cdp_cfg->enable = phys_enc->sde_kms->catalog->perf.cdp_cfg - [SDE_PERF_CDP_USAGE_NRT].wr_enable; + cdp_index = phys_enc->in_clone_mode ? SDE_PERF_CDP_USAGE_RT : SDE_PERF_CDP_USAGE_NRT; + cdp_cfg->enable = phys_enc->sde_kms->catalog->perf.cdp_cfg[cdp_index].wr_enable; cdp_cfg->ubwc_meta_enable = SDE_FORMAT_IS_UBWC(wb_cfg->dest.format); cdp_cfg->tile_amortize_enable = SDE_FORMAT_IS_UBWC(wb_cfg->dest.format) || SDE_FORMAT_IS_TILE(wb_cfg->dest.format); diff --git a/msm/sde/sde_hw_catalog.c b/msm/sde/sde_hw_catalog.c index 5833524bb0..5afc09c149 100644 --- a/msm/sde/sde_hw_catalog.c +++ b/msm/sde/sde_hw_catalog.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. */ @@ -4349,33 +4349,29 @@ static int _sde_qos_parse_dt_cfg(struct sde_mdss_cfg *cfg, int *prop_count, cfg->perf.qos_refresh_count = qos_count; cfg->perf.danger_lut = kcalloc(qos_count, - sizeof(u64) * SDE_QOS_LUT_USAGE_MAX, GFP_KERNEL); + sizeof(u64) * SDE_QOS_LUT_USAGE_MAX * SDE_DANGER_SAFE_LUT_TYPE_MAX, GFP_KERNEL); cfg->perf.safe_lut = kcalloc(qos_count, - sizeof(u64) * SDE_QOS_LUT_USAGE_MAX, GFP_KERNEL); + sizeof(u64) * SDE_QOS_LUT_USAGE_MAX * SDE_DANGER_SAFE_LUT_TYPE_MAX, GFP_KERNEL); cfg->perf.creq_lut = kcalloc(qos_count, 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; if (prop_exists[QOS_DANGER_LUT] && - prop_count[QOS_DANGER_LUT] >= (SDE_QOS_LUT_USAGE_MAX * qos_count)) { + (prop_count[QOS_DANGER_LUT] >= + (SDE_QOS_LUT_USAGE_MAX * qos_count * SDE_DANGER_SAFE_LUT_TYPE_MAX))) { for (i = 0; i < prop_count[QOS_DANGER_LUT]; i++) { - cfg->perf.danger_lut[i] = - PROP_VALUE_ACCESS(prop_value, - QOS_DANGER_LUT, i); - SDE_DEBUG("danger usage:%i lut:0x%llx\n", - i, cfg->perf.danger_lut[i]); + cfg->perf.danger_lut[i] = PROP_VALUE_ACCESS(prop_value, QOS_DANGER_LUT, i); + SDE_DEBUG("danger usage:%i lut:0x%llx\n", i, cfg->perf.danger_lut[i]); } } if (prop_exists[QOS_SAFE_LUT] && - prop_count[QOS_SAFE_LUT] >= (SDE_QOS_LUT_USAGE_MAX * qos_count)) { + (prop_count[QOS_SAFE_LUT] >= + (SDE_QOS_LUT_USAGE_MAX * qos_count * SDE_DANGER_SAFE_LUT_TYPE_MAX))) { for (i = 0; i < prop_count[QOS_SAFE_LUT]; i++) { - cfg->perf.safe_lut[i] = - PROP_VALUE_ACCESS(prop_value, - QOS_SAFE_LUT, i); - SDE_DEBUG("safe usage:%d lut:0x%llx\n", - i, cfg->perf.safe_lut[i]); + cfg->perf.safe_lut[i] = PROP_VALUE_ACCESS(prop_value, QOS_SAFE_LUT, i); + SDE_DEBUG("safe usage:%d lut:0x%llx\n", i, cfg->perf.safe_lut[i]); } } diff --git a/msm/sde/sde_hw_catalog.h b/msm/sde/sde_hw_catalog.h index 229dc307ad..34b646265f 100644 --- a/msm/sde/sde_hw_catalog.h +++ b/msm/sde/sde_hw_catalog.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. */ @@ -863,6 +863,16 @@ enum sde_creq_lut_types { SDE_CREQ_LUT_TYPE_MAX, }; +/** + * enum sde_danger_safe_lut_types - define danger/safe LUT types possible for all use cases + * This is second dimension to sde_qos_lut_usage enum. + */ +enum sde_danger_safe_lut_types { + SDE_DANGER_SAFE_LUT_TYPE_PORTRAIT, + SDE_DANGER_SAFE_LUT_TYPE_LANDSCAPE, + SDE_DANGER_SAFE_LUT_TYPE_MAX, +}; + /** * struct sde_sspp_sub_blks : SSPP sub-blocks * @maxlinewidth: max source pipe line width support diff --git a/msm/sde/sde_plane.c b/msm/sde/sde_plane.c index d66ef655bd..a233f43ccb 100644 --- a/msm/sde/sde_plane.c +++ b/msm/sde/sde_plane.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (C) 2014-2021 The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark @@ -257,10 +258,11 @@ static 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, creq_lut_index, index; + u32 frame_rate, qos_count, fps_index = 0, lut_index, creq_lut_index, ds_lut_index; struct sde_perf_cfg *perf; struct sde_plane_state *pstate; - bool inline_rot = false; + bool inline_rot = false, landscape = false; + struct drm_display_mode *mode; if (!plane || !fb) { SDE_ERROR("invalid arguments\n"); @@ -277,6 +279,9 @@ static void _sde_plane_set_qos_lut(struct drm_plane *plane, return; } + mode = &crtc->state->adjusted_mode; + landscape = mode->hdisplay > mode->vdisplay ? true : false; + frame_rate = drm_mode_vrefresh(&crtc->mode); perf = &psde->catalog->perf; qos_count = perf->qos_refresh_count; @@ -299,38 +304,32 @@ static void _sde_plane_set_qos_lut(struct drm_plane *plane, lut_index = SDE_QOS_LUT_USAGE_LINEAR; else lut_index = SDE_QOS_LUT_USAGE_MACROTILE; - - creq_lut_index = lut_index * SDE_CREQ_LUT_TYPE_MAX; - if (psde->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]; - + creq_lut_index = lut_index * SDE_CREQ_LUT_TYPE_MAX; + if (psde->scaler3_cfg.enable) + creq_lut_index += SDE_CREQ_LUT_TYPE_QSEED; creq_lut_index += (fps_index * SDE_QOS_LUT_USAGE_MAX * SDE_CREQ_LUT_TYPE_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, - (fmt) ? fmt->fetch_mode : 0, - psde->pipe_qos_cfg.danger_lut, - psde->pipe_qos_cfg.safe_lut, - psde->pipe_qos_cfg.creq_lut); + ds_lut_index = lut_index * SDE_DANGER_SAFE_LUT_TYPE_MAX; + if (landscape) + ds_lut_index += SDE_DANGER_SAFE_LUT_TYPE_LANDSCAPE; + ds_lut_index += (fps_index * SDE_QOS_LUT_USAGE_MAX * SDE_DANGER_SAFE_LUT_TYPE_MAX); + psde->pipe_qos_cfg.danger_lut = perf->danger_lut[ds_lut_index]; + psde->pipe_qos_cfg.safe_lut = perf->safe_lut[ds_lut_index]; - SDE_DEBUG( - "plane%u: pnum:%d fmt:%4.4s fps:%d mode:%d luts[0x%x,0x%x 0x%llx]\n", - plane->base.id, - psde->pipe - SSPP_VIG0, + trace_sde_perf_set_qos_luts(psde->pipe - SSPP_VIG0, (fmt) ? fmt->base.pixel_format : 0, + (fmt) ? fmt->fetch_mode : 0, psde->pipe_qos_cfg.danger_lut, + psde->pipe_qos_cfg.safe_lut, psde->pipe_qos_cfg.creq_lut); + + SDE_DEBUG("plane%u: pnum:%d fmt:%4.4s fps:%d mode:%d luts[0x%x,0x%x 0x%llx]\n", + plane->base.id, psde->pipe - SSPP_VIG0, fmt ? (char *)&fmt->base.pixel_format : NULL, frame_rate, - fmt ? fmt->fetch_mode : -1, - psde->pipe_qos_cfg.danger_lut, - psde->pipe_qos_cfg.safe_lut, - psde->pipe_qos_cfg.creq_lut); + fmt ? fmt->fetch_mode : -1, psde->pipe_qos_cfg.danger_lut, + psde->pipe_qos_cfg.safe_lut, psde->pipe_qos_cfg.creq_lut); psde->pipe_hw->ops.setup_qos_lut(psde->pipe_hw, &psde->pipe_qos_cfg); } @@ -371,6 +370,7 @@ static void _sde_plane_set_qos_ctrl(struct drm_plane *plane, /* this feature overrules previous VBLANK_CTRL */ psde->pipe_qos_cfg.vblank_en = false; psde->pipe_qos_cfg.creq_vblank = 0; /* clear vblank bits */ + psde->pipe_qos_cfg.danger_vblank = 0; } if (flags & SDE_PLANE_QOS_PANIC_CTRL)