disp: msm: update topology based on clock requirement

Update the topology allocation by considering the required
mode clock (vtotal x htotal x fps * fudge factor). Modes with
a clock that exceeds the maximum SDE clock will be denoted as
requiring a topology that uses two layer mixers.

Change-Id: I3c773598b0d79cb6fea9d3a0e04d89ff84d67e13
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
This commit is contained in:
Tatenda Chipeperekwa
2019-09-12 16:43:14 -07:00
부모 b8165c3584
커밋 da892c0b91
6개의 변경된 파일103개의 추가작업 그리고 7개의 파일을 삭제

파일 보기

@@ -19,6 +19,7 @@
#define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
#include <drm/drm_crtc.h>
#include <drm/drm_fixed.h>
#include <linux/debugfs.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
@@ -2468,6 +2469,52 @@ static bool sde_kms_check_for_splash(struct msm_kms *kms)
return sde_kms->splash_data.num_splash_displays;
}
static int sde_kms_get_mixer_count(const struct msm_kms *kms,
const struct drm_display_mode *mode,
const struct msm_resource_caps_info *res, u32 *num_lm)
{
struct sde_kms *sde_kms;
s64 mode_clock_hz = 0;
s64 max_mdp_clock_hz = 0;
s64 mdp_fudge_factor = 0;
s64 temp = 0;
s64 htotal_fp = 0;
s64 vtotal_fp = 0;
s64 vrefresh_fp = 0;
if (!num_lm) {
SDE_ERROR("invalid num_lm pointer\n");
return -EINVAL;
}
*num_lm = 1;
if (!kms || !mode || !res) {
SDE_ERROR("invalid input args\n");
return -EINVAL;
}
sde_kms = to_sde_kms(kms);
max_mdp_clock_hz = drm_fixp_from_fraction(
sde_kms->perf.max_core_clk_rate, 1);
mdp_fudge_factor = drm_fixp_from_fraction(105, 100); /* 1.05 */
htotal_fp = drm_fixp_from_fraction(mode->htotal, 1);
vtotal_fp = drm_fixp_from_fraction(mode->vtotal, 1);
vrefresh_fp = drm_fixp_from_fraction(mode->vrefresh, 1);
temp = drm_fixp_mul(htotal_fp, vtotal_fp);
temp = drm_fixp_mul(temp, vrefresh_fp);
mode_clock_hz = drm_fixp_mul(temp, mdp_fudge_factor);
if (mode_clock_hz > max_mdp_clock_hz ||
mode->hdisplay > res->max_mixer_width)
*num_lm = 2;
SDE_DEBUG("[%s] h=%d, v=%d, fps=%d, max_mdp_clk_hz=%llu, num_lm=%d\n",
mode->name, mode->htotal, mode->vtotal, mode->vrefresh,
sde_kms->perf.max_core_clk_rate, *num_lm);
return 0;
}
static void _sde_kms_null_commit(struct drm_device *dev,
struct drm_encoder *enc)
{
@@ -2778,6 +2825,7 @@ static const struct msm_kms_funcs kms_funcs = {
.get_address_space_device = _sde_kms_get_address_space_device,
.postopen = _sde_kms_post_open,
.check_for_splash = sde_kms_check_for_splash,
.get_mixer_count = sde_kms_get_mixer_count,
};
/* the caller api needs to turn on clock before calling it */