Commit 57ac1175 authored by Peterson's avatar Peterson Committed by Alex Deucher
Browse files

drm/amd/display: Use resource_build_scaling_params for dcn20



[WHY]
When using upscaling on certain gpus, some incorrect scaling
calculations would be made causing hangs.

[HOW]
This was fixed by using the resource_build_scaling_params function on these
gpus.

Reviewed-by: default avatarDillon Varone <dillon.varone@amd.com>
Reviewed-by: default avatarAlvin Lee <alvin.lee2@amd.com>
Signed-off-by: default avatarPeterson Guo <peterson.guo@amd.com>
Signed-off-by: default avatarAurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 24909d9e
Loading
Loading
Loading
Loading
+3 −54
Original line number Diff line number Diff line
@@ -1509,60 +1509,9 @@ bool dcn20_split_stream_for_odm(
	next_odm_pipe->prev_odm_pipe = prev_odm_pipe;

	if (prev_odm_pipe->plane_state) {
		struct scaler_data *sd = &prev_odm_pipe->plane_res.scl_data;
		struct output_pixel_processor *opp = next_odm_pipe->stream_res.opp;
		int new_width;

		/* HACTIVE halved for odm combine */
		sd->h_active /= 2;
		/* Calculate new vp and recout for left pipe */
		/* Need at least 16 pixels width per side */
		if (sd->recout.x + 16 >= sd->h_active)
		if (!resource_build_scaling_params(prev_odm_pipe) ||
			!resource_build_scaling_params(next_odm_pipe)) {
				return false;
		new_width = sd->h_active - sd->recout.x;
		sd->viewport.width -= dc_fixpt_floor(dc_fixpt_mul_int(
				sd->ratios.horz, sd->recout.width - new_width));
		sd->viewport_c.width -= dc_fixpt_floor(dc_fixpt_mul_int(
				sd->ratios.horz_c, sd->recout.width - new_width));
		sd->recout.width = new_width;

		/* Calculate new vp and recout for right pipe */
		sd = &next_odm_pipe->plane_res.scl_data;
		/* HACTIVE halved for odm combine */
		sd->h_active /= 2;
		/* Need at least 16 pixels width per side */
		if (new_width <= 16)
			return false;
		new_width = sd->recout.width + sd->recout.x - sd->h_active;
		sd->viewport.width -= dc_fixpt_floor(dc_fixpt_mul_int(
				sd->ratios.horz, sd->recout.width - new_width));
		sd->viewport_c.width -= dc_fixpt_floor(dc_fixpt_mul_int(
				sd->ratios.horz_c, sd->recout.width - new_width));
		sd->recout.width = new_width;
		sd->viewport.x += dc_fixpt_floor(dc_fixpt_mul_int(
				sd->ratios.horz, sd->h_active - sd->recout.x));
		sd->viewport_c.x += dc_fixpt_floor(dc_fixpt_mul_int(
				sd->ratios.horz_c, sd->h_active - sd->recout.x));
		sd->recout.x = 0;

		/*
		 * When odm is used in YcbCr422 or 420 colour space, a split screen
		 * will be seen with the previous calculations since the extra left
		 *  edge pixel is accounted for in fmt but not in viewport.
		 *
		 * Below are calculations which fix the split by fixing the calculations
		 * if there is an extra left edge pixel.
		 */
		if (opp && opp->funcs->opp_get_left_edge_extra_pixel_count
				&& opp->funcs->opp_get_left_edge_extra_pixel_count(
					opp, next_odm_pipe->stream->timing.pixel_encoding,
					resource_is_pipe_type(next_odm_pipe, OTG_MASTER)) == 1) {
			sd->h_active += 1;
			sd->recout.width += 1;
			sd->viewport.x -= dc_fixpt_ceil(dc_fixpt_mul_int(sd->ratios.horz, 1));
			sd->viewport_c.x -= dc_fixpt_ceil(dc_fixpt_mul_int(sd->ratios.horz, 1));
			sd->viewport_c.width += dc_fixpt_ceil(dc_fixpt_mul_int(sd->ratios.horz, 1));
			sd->viewport.width += dc_fixpt_ceil(dc_fixpt_mul_int(sd->ratios.horz, 1));
		}
	}