Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fae8468 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ARM: dts: msm: adjust LUT safe levels for sdm845"

parents b3e87219 af41bba4
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -331,9 +331,22 @@ Optional properties:
- qcom,sde-danger-lut:		A 4 cell property, with a format of <linear,
				tile, nrt, cwb>,
				indicating the danger luts on sspp.
- qcom,sde-safe-lut:		A 4 cell property, with a format of <linear,
				tile, nrt, cwb>,
				indicating the safe luts on sspp.
- qcom,sde-safe-lut-linear:	Array of 2 cell property, with a format of
				<fill level, lut> in ascending fill level
				indicating the safe luts for linear format on sspp.
				Zero fill level on the last entry identifies the default lut.
- qcom,sde-safe-lut-macrotile:	Array of 2 cell property, with a format of
				<fill level, lut> in ascending fill level
				indicating the safe luts for macrotile format on sspp.
				Zero fill level on the last entry identifies the default lut.
- qcom,sde-safe-lut-nrt:	Array of 2 cell property, with a format of
				<fill level, lut> in ascending fill level
				indicating the safe luts for nrt (e.g wfd) on sspp.
				Zero fill level on the last entry identifies the default lut.
- qcom,sde-safe-lut-cwb:	Array of 2 cell property, with a format of
				<fill level, lut> in ascending fill level
				indicating the safe luts for cwb on sspp.
				Zero fill level on the last entry identifies the default lut.
- qcom,sde-qos-lut-linear:	Array of 3 cell property, with a format of
				<fill level, lut hi, lut lo> in ascending fill level
				indicating the qos luts for linear format on sspp.
+12 −1
Original line number Diff line number Diff line
@@ -163,7 +163,18 @@

		qcom,sde-danger-lut = <0x0000000f 0x0000ffff 0x00000000
			0x00000000>;
		qcom,sde-safe-lut = <0xfffc 0xff00 0xffff 0xffff>;
		qcom,sde-safe-lut-linear =
			<4 0xfff8>,
			<0 0xfff0>;
		qcom,sde-safe-lut-macrotile =
			<10 0xfe00>,
			<11 0xfc00>,
			<12 0xf800>,
			<0 0xf000>;
		qcom,sde-safe-lut-nrt =
			<0 0xffff>;
		qcom,sde-safe-lut-cwb =
			<0 0xffff>;
		qcom,sde-qos-lut-linear =
			<4 0x00000000 0x00000357>,
			<5 0x00000000 0x00003357>,
+69 −12
Original line number Diff line number Diff line
@@ -167,7 +167,10 @@ enum {
	PERF_XTRA_PREFILL_LINES,
	PERF_AMORTIZABLE_THRESHOLD,
	PERF_DANGER_LUT,
	PERF_SAFE_LUT,
	PERF_SAFE_LUT_LINEAR,
	PERF_SAFE_LUT_MACROTILE,
	PERF_SAFE_LUT_NRT,
	PERF_SAFE_LUT_CWB,
	PERF_QOS_LUT_LINEAR,
	PERF_QOS_LUT_MACROTILE,
	PERF_QOS_LUT_NRT,
@@ -426,7 +429,14 @@ static struct sde_prop_type sde_perf_prop[] = {
	{PERF_AMORTIZABLE_THRESHOLD, "qcom,sde-amortizable-threshold",
			false, PROP_TYPE_U32},
	{PERF_DANGER_LUT, "qcom,sde-danger-lut", false, PROP_TYPE_U32_ARRAY},
	{PERF_SAFE_LUT, "qcom,sde-safe-lut", false, PROP_TYPE_U32_ARRAY},
	{PERF_SAFE_LUT_LINEAR, "qcom,sde-safe-lut-linear", false,
			PROP_TYPE_U32_ARRAY},
	{PERF_SAFE_LUT_MACROTILE, "qcom,sde-safe-lut-macrotile", false,
			PROP_TYPE_U32_ARRAY},
	{PERF_SAFE_LUT_NRT, "qcom,sde-safe-lut-nrt", false,
			PROP_TYPE_U32_ARRAY},
	{PERF_SAFE_LUT_CWB, "qcom,sde-safe-lut-cwb", false,
			PROP_TYPE_U32_ARRAY},
	{PERF_QOS_LUT_LINEAR, "qcom,sde-qos-lut-linear", false,
			PROP_TYPE_U32_ARRAY},
	{PERF_QOS_LUT_MACROTILE, "qcom,sde-qos-lut-macrotile", false,
@@ -435,6 +445,7 @@ static struct sde_prop_type sde_perf_prop[] = {
			PROP_TYPE_U32_ARRAY},
	{PERF_QOS_LUT_CWB, "qcom,sde-qos-lut-cwb", false,
			PROP_TYPE_U32_ARRAY},

	{PERF_CDP_SETTING, "qcom,sde-cdp-setting", false,
			PROP_TYPE_U32_ARRAY},
};
@@ -2824,8 +2835,23 @@ static int sde_perf_parse_dt(struct device_node *np, struct sde_mdss_cfg *cfg)
	if (rc)
		goto freeprop;

	rc = _validate_dt_entry(np, &sde_perf_prop[PERF_SAFE_LUT], 1,
			&prop_count[PERF_SAFE_LUT], NULL);
	rc = _validate_dt_entry(np, &sde_perf_prop[PERF_SAFE_LUT_LINEAR], 1,
			&prop_count[PERF_SAFE_LUT_LINEAR], NULL);
	if (rc)
		goto freeprop;

	rc = _validate_dt_entry(np, &sde_perf_prop[PERF_SAFE_LUT_MACROTILE], 1,
			&prop_count[PERF_SAFE_LUT_MACROTILE], NULL);
	if (rc)
		goto freeprop;

	rc = _validate_dt_entry(np, &sde_perf_prop[PERF_SAFE_LUT_NRT], 1,
			&prop_count[PERF_SAFE_LUT_NRT], NULL);
	if (rc)
		goto freeprop;

	rc = _validate_dt_entry(np, &sde_perf_prop[PERF_SAFE_LUT_CWB], 1,
			&prop_count[PERF_SAFE_LUT_CWB], NULL);
	if (rc)
		goto freeprop;

@@ -2950,15 +2976,46 @@ static int sde_perf_parse_dt(struct device_node *np, struct sde_mdss_cfg *cfg)
		}
	}

	if (prop_exists[PERF_SAFE_LUT] && prop_count[PERF_SAFE_LUT] <=
			SDE_QOS_LUT_USAGE_MAX) {
		for (j = 0; j < prop_count[PERF_SAFE_LUT]; j++) {
			cfg->perf.safe_lut_tbl[j] =
					PROP_VALUE_ACCESS(prop_value,
						PERF_SAFE_LUT, j);
			SDE_DEBUG("safe usage:%d lut:0x%x\n",
					j, cfg->perf.safe_lut_tbl[j]);
	for (j = 0; j < SDE_QOS_LUT_USAGE_MAX; j++) {
		static const u32 safe_key[SDE_QOS_LUT_USAGE_MAX] = {
			[SDE_QOS_LUT_USAGE_LINEAR] =
					PERF_SAFE_LUT_LINEAR,
			[SDE_QOS_LUT_USAGE_MACROTILE] =
					PERF_SAFE_LUT_MACROTILE,
			[SDE_QOS_LUT_USAGE_NRT] =
					PERF_SAFE_LUT_NRT,
			[SDE_QOS_LUT_USAGE_CWB] =
					PERF_SAFE_LUT_CWB,
		};
		const u32 entry_size = 2;
		int m, count;
		int key = safe_key[j];

		if (!prop_exists[key])
			continue;

		count = prop_count[key] / entry_size;

		cfg->perf.sfe_lut_tbl[j].entries = kcalloc(count,
			sizeof(struct sde_qos_lut_entry), GFP_KERNEL);
		if (!cfg->perf.sfe_lut_tbl[j].entries) {
			rc = -ENOMEM;
			goto freeprop;
		}

		for (k = 0, m = 0; k < count; k++, m += entry_size) {
			u64 lut_lo;

			cfg->perf.sfe_lut_tbl[j].entries[k].fl =
					PROP_VALUE_ACCESS(prop_value, key, m);
			lut_lo = PROP_VALUE_ACCESS(prop_value, key, m + 1);
			cfg->perf.sfe_lut_tbl[j].entries[k].lut = lut_lo;
			SDE_DEBUG("safe usage:%d.%d fl:%d lut:0x%llx\n",
				j, k,
				cfg->perf.sfe_lut_tbl[j].entries[k].fl,
				cfg->perf.sfe_lut_tbl[j].entries[k].lut);
		}
		cfg->perf.sfe_lut_tbl[j].nentry = count;
	}

	for (j = 0; j < SDE_QOS_LUT_USAGE_MAX; j++) {
+2 −2
Original line number Diff line number Diff line
@@ -862,8 +862,8 @@ struct sde_perf_cdp_cfg {
 * @downscaling_prefill_lines  downscaling latency in lines
 * @amortizable_theshold minimum y position for traffic shaping prefill
 * @min_prefill_lines  minimum pipeline latency in lines
 * @safe_lut_tbl: LUT tables for safe signals
 * @danger_lut_tbl: LUT tables for danger signals
 * @sfe_lut_tbl: LUT tables for safe signals
 * @qos_lut_tbl: LUT tables for QoS signals
 * @cdp_cfg            cdp use case configurations
 */
@@ -886,8 +886,8 @@ struct sde_perf_cfg {
	u32 downscaling_prefill_lines;
	u32 amortizable_threshold;
	u32 min_prefill_lines;
	u32 safe_lut_tbl[SDE_QOS_LUT_USAGE_MAX];
	u32 danger_lut_tbl[SDE_QOS_LUT_USAGE_MAX];
	struct sde_qos_lut_tbl sfe_lut_tbl[SDE_QOS_LUT_USAGE_MAX];
	struct sde_qos_lut_tbl qos_lut_tbl[SDE_QOS_LUT_USAGE_MAX];
	struct sde_perf_cdp_cfg cdp_cfg[SDE_PERF_CDP_USAGE_MAX];
};
+29 −18
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ static inline int _sde_plane_calc_fill_level(struct drm_plane *plane,
	u32 fixed_buff_size;
	u32 total_fl;
	u32 hflip_bytes;
	u32 unused_space;

	if (!plane || !fmt || !plane->state || !src_width || !fmt->bpp) {
		SDE_ERROR("invalid arguments\n");
@@ -250,29 +251,36 @@ static inline int _sde_plane_calc_fill_level(struct drm_plane *plane,
		hflip_bytes = 0;

	if (fmt->fetch_planes == SDE_PLANE_PSEUDO_PLANAR) {

		unused_space = 23 * 128;
		if (fmt->chroma_sample == SDE_CHROMA_420) {
			/* NV12 */
			total_fl = (fixed_buff_size / 2 - hflip_bytes) /
				((src_width + 32) * fmt->bpp);
			total_fl = (fixed_buff_size / 2 - hflip_bytes -
				unused_space) / ((src_width + 32) * fmt->bpp);
		} else {
			/* non NV12 */
			total_fl = (fixed_buff_size / 2 - hflip_bytes) * 2 /
				((src_width + 32) * fmt->bpp);
			total_fl = (fixed_buff_size / 2 - hflip_bytes -
				unused_space) * 2 / ((src_width + 32) *
				fmt->bpp);
		}
	} else {

		unused_space = 6 * 128;
		if (pstate->multirect_mode == SDE_SSPP_MULTIRECT_PARALLEL) {
			total_fl = (fixed_buff_size / 2 - hflip_bytes) * 2 /
				((src_width + 32) * fmt->bpp);
			total_fl = (fixed_buff_size / 2 - hflip_bytes -
				unused_space) * 2 / ((src_width + 32) *
				fmt->bpp);
		} else {
			total_fl = (fixed_buff_size - hflip_bytes) * 2 /
				((src_width + 32) * fmt->bpp);
			total_fl = (fixed_buff_size - hflip_bytes -
				unused_space) * 2 / ((src_width + 32) *
				fmt->bpp);
		}
	}

	SDE_DEBUG("plane%u: pnum:%d fmt: %4.4s w:%u hf:%d fl:%u\n",
	SDE_DEBUG("plane%u: pnum:%d fmt: %4.4s w:%u hf:%d us:%d fl:%u\n",
			plane->base.id, psde->pipe - SSPP_VIG0,
			(char *)&fmt->base.pixel_format,
			src_width, hflip_bytes, total_fl);
			src_width, hflip_bytes, unused_space, total_fl);

	return total_fl;
}
@@ -375,6 +383,7 @@ static void _sde_plane_set_danger_lut(struct drm_plane *plane,
	struct sde_plane *psde;
	const struct sde_format *fmt = NULL;
	u32 danger_lut, safe_lut;
	u32 total_fl = 0, lut_usage;

	if (!plane || !fb) {
		SDE_ERROR("invalid arguments\n");
@@ -393,27 +402,29 @@ static void _sde_plane_set_danger_lut(struct drm_plane *plane,
	if (!psde->is_rt_pipe) {
		danger_lut = psde->catalog->perf.danger_lut_tbl
				[SDE_QOS_LUT_USAGE_NRT];
		safe_lut = psde->catalog->perf.safe_lut_tbl
				[SDE_QOS_LUT_USAGE_NRT];
		lut_usage = SDE_QOS_LUT_USAGE_NRT;
	} else {
		fmt = sde_get_sde_format_ext(
				fb->pixel_format,
				fb->modifier,
				drm_format_num_planes(fb->pixel_format));
		total_fl = _sde_plane_calc_fill_level(plane, fmt,
				psde->pipe_cfg.src_rect.w);

		if (fmt && SDE_FORMAT_IS_LINEAR(fmt)) {
			danger_lut = psde->catalog->perf.danger_lut_tbl
					[SDE_QOS_LUT_USAGE_LINEAR];
			safe_lut = psde->catalog->perf.safe_lut_tbl
					[SDE_QOS_LUT_USAGE_LINEAR];
			lut_usage = SDE_QOS_LUT_USAGE_LINEAR;
		} else {
			danger_lut = psde->catalog->perf.danger_lut_tbl
					[SDE_QOS_LUT_USAGE_MACROTILE];
			safe_lut = psde->catalog->perf.safe_lut_tbl
					[SDE_QOS_LUT_USAGE_MACROTILE];
			lut_usage = SDE_QOS_LUT_USAGE_MACROTILE;
		}
	}

	safe_lut = (u32) _sde_plane_get_qos_lut(
			&psde->catalog->perf.sfe_lut_tbl[lut_usage], total_fl);

	psde->pipe_qos_cfg.danger_lut = danger_lut;
	psde->pipe_qos_cfg.safe_lut = safe_lut;

@@ -423,11 +434,11 @@ static void _sde_plane_set_danger_lut(struct drm_plane *plane,
			psde->pipe_qos_cfg.danger_lut,
			psde->pipe_qos_cfg.safe_lut);

	SDE_DEBUG("plane%u: pnum:%d fmt: %4.4s mode:%d luts[0x%x, 0x%x]\n",
	SDE_DEBUG("plane%u: pnum:%d fmt:%4.4s mode:%d fl:%d luts[0x%x,0x%x]\n",
		plane->base.id,
		psde->pipe - SSPP_VIG0,
		fmt ? (char *)&fmt->base.pixel_format : NULL,
		fmt ? fmt->fetch_mode : -1,
		fmt ? fmt->fetch_mode : -1, total_fl,
		psde->pipe_qos_cfg.danger_lut,
		psde->pipe_qos_cfg.safe_lut);