[PATCH] drm/amd/display: Fix GPU scaling regression by FS video support

Aurabindo Pillai aurabindo.pillai at amd.com
Wed May 19 20:48:03 UTC 2021


Reviewed-by: Aurabindo Pillai <aurabindo.pillai at amd.com>

On 2021-05-19 4:12 p.m., Nicholas Kazlauskas wrote:
> [Why]
> FS video support regressed GPU scaling and the scaled buffer ends up
> stuck in the top left of the screen at native size - full, aspect,
> center scaling modes do not function.
> 
> This is because decide_crtc_timing_for_drm_display_mode() does not
> get called when scaling is enabled.
> 
> [How]
> Split recalculate timing and scaling into two different flags.
> 
> We don't want to call drm_mode_set_crtcinfo() for scaling, but we
> do want to call it for FS video.
> 
> Optimize and move preferred_refresh calculation next to
> decide_crtc_timing_for_drm_display_mode() like it used to be since
> that's not used for FS video.
> 
> We don't need to copy over the VIC or polarity in the case of FS video
> modes because those don't change.
> 
> Fixes: a372f4abec ("drm/amd/display: Skip modeset for front porch change")
> 
> Cc: Aurabindo Pillai <aurabindo.pillai at amd.com>
> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 8cd270f129..759621b0e8 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -5672,7 +5672,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
>   	struct drm_display_mode saved_mode;
>   	struct drm_display_mode *freesync_mode = NULL;
>   	bool native_mode_found = false;
> -	bool recalculate_timing = dm_state ? (dm_state->scaling != RMX_OFF) : false;
> +	bool recalculate_timing = false;
> +	bool scale = dm_state ? (dm_state->scaling != RMX_OFF) : false;
>   	int mode_refresh;
>   	int preferred_refresh = 0;
>   #if defined(CONFIG_DRM_AMD_DC_DCN)
> @@ -5735,7 +5736,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
>   		 */
>   		DRM_DEBUG_DRIVER("No preferred mode found\n");
>   	} else {
> -		recalculate_timing |= amdgpu_freesync_vid_mode &&
> +		recalculate_timing = amdgpu_freesync_vid_mode &&
>   				 is_freesync_video_mode(&mode, aconnector);
>   		if (recalculate_timing) {
>   			freesync_mode = get_highest_refresh_rate_mode(aconnector, false);
> @@ -5743,11 +5744,10 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
>   			mode = *freesync_mode;
>   		} else {
>   			decide_crtc_timing_for_drm_display_mode(
> -				&mode, preferred_mode,
> -				dm_state ? (dm_state->scaling != RMX_OFF) : false);
> -		}
> +				&mode, preferred_mode, scale);
>   
> -		preferred_refresh = drm_mode_vrefresh(preferred_mode);
> +			preferred_refresh = drm_mode_vrefresh(preferred_mode);
> +		}
>   	}
>   
>   	if (recalculate_timing)
> @@ -5759,7 +5759,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
>   	* If scaling is enabled and refresh rate didn't change
>   	* we copy the vic and polarities of the old timings
>   	*/
> -	if (!recalculate_timing || mode_refresh != preferred_refresh)
> +	if (!scale || mode_refresh != preferred_refresh)
>   		fill_stream_properties_from_drm_display_mode(
>   			stream, &mode, &aconnector->base, con_state, NULL,
>   			requested_bpc);
> 

-- 
Regards,
Aurabindo Pillai


More information about the amd-gfx mailing list