disp: msm: sde: update danger/safe QoS LUTs for landscape panels

Update the DT parsing logic to get danger/safe LUT values for
both portrait & landscape for all the usage types.
As part of the change, fix the correct CDP write setting for
CWB usecase.

Change-Id: I4fb6d17537de5df31c9b7f52983c0c3890265174
Signed-off-by: Veera Sundaram Sankaran <quic_veeras@quicinc.com>
This commit is contained in:
Veera Sundaram Sankaran
2021-12-17 15:52:49 -08:00
parent 5c8caa4c60
commit 689d2cd473
4 changed files with 59 additions and 48 deletions

View File

@@ -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 *hw_wb;
struct sde_hw_wb_qos_cfg qos_cfg = {0}; struct sde_hw_wb_qos_cfg qos_cfg = {0};
struct sde_perf_cfg *perf; 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) { if (!phys_enc || !phys_enc->sde_kms || !phys_enc->sde_kms->catalog) {
SDE_ERROR("invalid parameter(s)\n"); 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 else
lut_index = SDE_QOS_LUT_USAGE_NRT; lut_index = SDE_QOS_LUT_USAGE_NRT;
index = (fps_index * SDE_QOS_LUT_USAGE_MAX) + lut_index; creq_index = lut_index * SDE_CREQ_LUT_TYPE_MAX;
qos_cfg.danger_lut = perf->danger_lut[index]; creq_index += (fps_index * SDE_QOS_LUT_USAGE_MAX * SDE_CREQ_LUT_TYPE_MAX);
qos_cfg.safe_lut = (u32) perf->safe_lut[index]; qos_cfg.creq_lut = perf->creq_lut[creq_index];
qos_cfg.creq_lut = perf->creq_lut[index * SDE_CREQ_LUT_TYPE_MAX];
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", 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, 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_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 *hw_wb = wb_enc->hw_wb;
struct sde_hw_wb_cdp_cfg *cdp_cfg = &wb_enc->cdp_cfg; struct sde_hw_wb_cdp_cfg *cdp_cfg = &wb_enc->cdp_cfg;
u32 cdp_index;
if (!hw_wb->ops.setup_cdp) if (!hw_wb->ops.setup_cdp)
return; return;
memset(cdp_cfg, 0, sizeof(struct sde_hw_wb_cdp_cfg)); memset(cdp_cfg, 0, sizeof(struct sde_hw_wb_cdp_cfg));
cdp_cfg->enable = phys_enc->sde_kms->catalog->perf.cdp_cfg cdp_index = phys_enc->in_clone_mode ? SDE_PERF_CDP_USAGE_RT : SDE_PERF_CDP_USAGE_NRT;
[SDE_PERF_CDP_USAGE_NRT].wr_enable; 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->ubwc_meta_enable = SDE_FORMAT_IS_UBWC(wb_cfg->dest.format);
cdp_cfg->tile_amortize_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); SDE_FORMAT_IS_TILE(wb_cfg->dest.format);

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only // 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. * 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.qos_refresh_count = qos_count;
cfg->perf.danger_lut = kcalloc(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, 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, cfg->perf.creq_lut = kcalloc(qos_count,
sizeof(u64) * SDE_QOS_LUT_USAGE_MAX * SDE_CREQ_LUT_TYPE_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) if (!cfg->perf.creq_lut || !cfg->perf.safe_lut || !cfg->perf.danger_lut)
goto end; goto end;
if (prop_exists[QOS_DANGER_LUT] && 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++) { for (i = 0; i < prop_count[QOS_DANGER_LUT]; i++) {
cfg->perf.danger_lut[i] = cfg->perf.danger_lut[i] = PROP_VALUE_ACCESS(prop_value, QOS_DANGER_LUT, i);
PROP_VALUE_ACCESS(prop_value, SDE_DEBUG("danger usage:%i lut:0x%llx\n", i, cfg->perf.danger_lut[i]);
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] && 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++) { for (i = 0; i < prop_count[QOS_SAFE_LUT]; i++) {
cfg->perf.safe_lut[i] = cfg->perf.safe_lut[i] = PROP_VALUE_ACCESS(prop_value, QOS_SAFE_LUT, i);
PROP_VALUE_ACCESS(prop_value, SDE_DEBUG("safe usage:%d lut:0x%llx\n", i, cfg->perf.safe_lut[i]);
QOS_SAFE_LUT, i);
SDE_DEBUG("safe usage:%d lut:0x%llx\n",
i, cfg->perf.safe_lut[i]);
} }
} }

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* 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. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/ */
@@ -863,6 +863,16 @@ enum sde_creq_lut_types {
SDE_CREQ_LUT_TYPE_MAX, 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 * struct sde_sspp_sub_blks : SSPP sub-blocks
* @maxlinewidth: max source pipe line width support * @maxlinewidth: max source pipe line width support

View File

@@ -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) 2014-2021 The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat * Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com> * Author: Rob Clark <robdclark@gmail.com>
@@ -257,10 +258,11 @@ static void _sde_plane_set_qos_lut(struct drm_plane *plane,
{ {
struct sde_plane *psde; struct sde_plane *psde;
const struct sde_format *fmt = NULL; 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_perf_cfg *perf;
struct sde_plane_state *pstate; struct sde_plane_state *pstate;
bool inline_rot = false; bool inline_rot = false, landscape = false;
struct drm_display_mode *mode;
if (!plane || !fb) { if (!plane || !fb) {
SDE_ERROR("invalid arguments\n"); SDE_ERROR("invalid arguments\n");
@@ -277,6 +279,9 @@ static void _sde_plane_set_qos_lut(struct drm_plane *plane,
return; return;
} }
mode = &crtc->state->adjusted_mode;
landscape = mode->hdisplay > mode->vdisplay ? true : false;
frame_rate = drm_mode_vrefresh(&crtc->mode); frame_rate = drm_mode_vrefresh(&crtc->mode);
perf = &psde->catalog->perf; perf = &psde->catalog->perf;
qos_count = perf->qos_refresh_count; 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; lut_index = SDE_QOS_LUT_USAGE_LINEAR;
else else
lut_index = SDE_QOS_LUT_USAGE_MACROTILE; lut_index = SDE_QOS_LUT_USAGE_MACROTILE;
} else {
lut_index = SDE_QOS_LUT_USAGE_NRT;
}
creq_lut_index = lut_index * SDE_CREQ_LUT_TYPE_MAX; creq_lut_index = lut_index * SDE_CREQ_LUT_TYPE_MAX;
if (psde->scaler3_cfg.enable) if (psde->scaler3_cfg.enable)
creq_lut_index += SDE_CREQ_LUT_TYPE_QSEED; 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 += (fps_index * SDE_QOS_LUT_USAGE_MAX * SDE_CREQ_LUT_TYPE_MAX); 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]; psde->pipe_qos_cfg.creq_lut = perf->creq_lut[creq_lut_index];
trace_sde_perf_set_qos_luts(psde->pipe - SSPP_VIG0, ds_lut_index = lut_index * SDE_DANGER_SAFE_LUT_TYPE_MAX;
(fmt) ? fmt->base.pixel_format : 0, if (landscape)
(fmt) ? fmt->fetch_mode : 0, ds_lut_index += SDE_DANGER_SAFE_LUT_TYPE_LANDSCAPE;
psde->pipe_qos_cfg.danger_lut, ds_lut_index += (fps_index * SDE_QOS_LUT_USAGE_MAX * SDE_DANGER_SAFE_LUT_TYPE_MAX);
psde->pipe_qos_cfg.safe_lut, psde->pipe_qos_cfg.danger_lut = perf->danger_lut[ds_lut_index];
psde->pipe_qos_cfg.creq_lut); psde->pipe_qos_cfg.safe_lut = perf->safe_lut[ds_lut_index];
SDE_DEBUG( trace_sde_perf_set_qos_luts(psde->pipe - SSPP_VIG0, (fmt) ? fmt->base.pixel_format : 0,
"plane%u: pnum:%d fmt:%4.4s fps:%d mode:%d luts[0x%x,0x%x 0x%llx]\n", (fmt) ? fmt->fetch_mode : 0, psde->pipe_qos_cfg.danger_lut,
plane->base.id, psde->pipe_qos_cfg.safe_lut, psde->pipe_qos_cfg.creq_lut);
psde->pipe - SSPP_VIG0,
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 ? (char *)&fmt->base.pixel_format : NULL, frame_rate,
fmt ? fmt->fetch_mode : -1, fmt ? fmt->fetch_mode : -1, psde->pipe_qos_cfg.danger_lut,
psde->pipe_qos_cfg.danger_lut, psde->pipe_qos_cfg.safe_lut, psde->pipe_qos_cfg.creq_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); 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 */ /* this feature overrules previous VBLANK_CTRL */
psde->pipe_qos_cfg.vblank_en = false; psde->pipe_qos_cfg.vblank_en = false;
psde->pipe_qos_cfg.creq_vblank = 0; /* clear vblank bits */ psde->pipe_qos_cfg.creq_vblank = 0; /* clear vblank bits */
psde->pipe_qos_cfg.danger_vblank = 0;
} }
if (flags & SDE_PLANE_QOS_PANIC_CTRL) if (flags & SDE_PLANE_QOS_PANIC_CTRL)