[PATCH] drm/amd/display: remove redundant CalculateRemoteSurfaceFlipDelay's

Maíra Canal mairacanal at riseup.net
Mon Sep 19 23:12:12 UTC 2022


Hi Tom

On 9/19/22 14:27, Tom Rix wrote:
> There are several copies of CalculateRemoteSurfaceFlipDelay.
> Reduce to one instance.
> 
> Signed-off-by: Tom Rix <trix at redhat.com>

Reviewed-by: Maíra Canal <mairacanal at riseup.net>

Just a minor comment below.

> ---
>  .../dc/dml/dcn20/display_mode_vba_20.c        |  4 +-
>  .../dc/dml/dcn20/display_mode_vba_20v2.c      | 40 +------------------
>  .../dc/dml/dcn21/display_mode_vba_21.c        | 40 +------------------
>  3 files changed, 4 insertions(+), 80 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
> index 4ca080950924..8e5d58336bc5 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
> @@ -158,7 +158,7 @@ double CalculateTWait(
>  		double DRAMClockChangeLatency,
>  		double UrgentLatency,
>  		double SREnterPlusExitTime);
> -static double CalculateRemoteSurfaceFlipDelay(
> +double CalculateRemoteSurfaceFlipDelay(
>  		struct display_mode_lib *mode_lib,
>  		double VRatio,
>  		double SwathWidth,
> @@ -2909,7 +2909,7 @@ double CalculateTWait(
>  	}
>  }
>  
> -static double CalculateRemoteSurfaceFlipDelay(
> +double CalculateRemoteSurfaceFlipDelay(

I guess it would be more clear if this function was placed on the
display_mode_vba20.h and named dml20_CalculateRemoteSurfaceFlipDelay.
Then, it would be clearer that this function is shared over the DCN20s.

Best Regards,
- Maíra Canal

>  		struct display_mode_lib *mode_lib,
>  		double VRatio,
>  		double SwathWidth,
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
> index 2b4dcae4e432..e9ebc81adc71 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
> @@ -182,7 +182,7 @@ double CalculateTWait(
>  		double DRAMClockChangeLatency,
>  		double UrgentLatency,
>  		double SREnterPlusExitTime);
> -static double CalculateRemoteSurfaceFlipDelay(
> +double CalculateRemoteSurfaceFlipDelay(
>  		struct display_mode_lib *mode_lib,
>  		double VRatio,
>  		double SwathWidth,
> @@ -2967,44 +2967,6 @@ static void dml20v2_DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
>  	}
>  }
>  
> -static double CalculateRemoteSurfaceFlipDelay(
> -		struct display_mode_lib *mode_lib,
> -		double VRatio,
> -		double SwathWidth,
> -		double Bpp,
> -		double LineTime,
> -		double XFCTSlvVupdateOffset,
> -		double XFCTSlvVupdateWidth,
> -		double XFCTSlvVreadyOffset,
> -		double XFCXBUFLatencyTolerance,
> -		double XFCFillBWOverhead,
> -		double XFCSlvChunkSize,
> -		double XFCBusTransportTime,
> -		double TCalc,
> -		double TWait,
> -		double *SrcActiveDrainRate,
> -		double *TInitXFill,
> -		double *TslvChk)
> -{
> -	double TSlvSetup, AvgfillRate, result;
> -
> -	*SrcActiveDrainRate = VRatio * SwathWidth * Bpp / LineTime;
> -	TSlvSetup = XFCTSlvVupdateOffset + XFCTSlvVupdateWidth + XFCTSlvVreadyOffset;
> -	*TInitXFill = XFCXBUFLatencyTolerance / (1 + XFCFillBWOverhead / 100);
> -	AvgfillRate = *SrcActiveDrainRate * (1 + XFCFillBWOverhead / 100);
> -	*TslvChk = XFCSlvChunkSize / AvgfillRate;
> -	dml_print(
> -			"DML::CalculateRemoteSurfaceFlipDelay: SrcActiveDrainRate: %f\n",
> -			*SrcActiveDrainRate);
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TSlvSetup: %f\n", TSlvSetup);
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TInitXFill: %f\n", *TInitXFill);
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: AvgfillRate: %f\n", AvgfillRate);
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TslvChk: %f\n", *TslvChk);
> -	result = 2 * XFCBusTransportTime + TSlvSetup + TCalc + TWait + *TslvChk + *TInitXFill; // TODO: This doesn't seem to match programming guide
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: RemoteSurfaceFlipDelay: %f\n", result);
> -	return result;
> -}
> -
>  static void CalculateActiveRowBandwidth(
>  		bool GPUVMEnable,
>  		enum source_format_class SourcePixelFormat,
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
> index a3ef3638d979..d94aaf899f9b 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
> @@ -210,7 +210,7 @@ double CalculateTWait(
>  		double DRAMClockChangeLatency,
>  		double UrgentLatency,
>  		double SREnterPlusExitTime);
> -static double CalculateRemoteSurfaceFlipDelay(
> +double CalculateRemoteSurfaceFlipDelay(
>  		struct display_mode_lib *mode_lib,
>  		double VRatio,
>  		double SwathWidth,
> @@ -2980,44 +2980,6 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
>  	}
>  }
>  
> -static double CalculateRemoteSurfaceFlipDelay(
> -		struct display_mode_lib *mode_lib,
> -		double VRatio,
> -		double SwathWidth,
> -		double Bpp,
> -		double LineTime,
> -		double XFCTSlvVupdateOffset,
> -		double XFCTSlvVupdateWidth,
> -		double XFCTSlvVreadyOffset,
> -		double XFCXBUFLatencyTolerance,
> -		double XFCFillBWOverhead,
> -		double XFCSlvChunkSize,
> -		double XFCBusTransportTime,
> -		double TCalc,
> -		double TWait,
> -		double *SrcActiveDrainRate,
> -		double *TInitXFill,
> -		double *TslvChk)
> -{
> -	double TSlvSetup, AvgfillRate, result;
> -
> -	*SrcActiveDrainRate = VRatio * SwathWidth * Bpp / LineTime;
> -	TSlvSetup = XFCTSlvVupdateOffset + XFCTSlvVupdateWidth + XFCTSlvVreadyOffset;
> -	*TInitXFill = XFCXBUFLatencyTolerance / (1 + XFCFillBWOverhead / 100);
> -	AvgfillRate = *SrcActiveDrainRate * (1 + XFCFillBWOverhead / 100);
> -	*TslvChk = XFCSlvChunkSize / AvgfillRate;
> -	dml_print(
> -			"DML::CalculateRemoteSurfaceFlipDelay: SrcActiveDrainRate: %f\n",
> -			*SrcActiveDrainRate);
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TSlvSetup: %f\n", TSlvSetup);
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TInitXFill: %f\n", *TInitXFill);
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: AvgfillRate: %f\n", AvgfillRate);
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: TslvChk: %f\n", *TslvChk);
> -	result = 2 * XFCBusTransportTime + TSlvSetup + TCalc + TWait + *TslvChk + *TInitXFill; // TODO: This doesn't seem to match programming guide
> -	dml_print("DML::CalculateRemoteSurfaceFlipDelay: RemoteSurfaceFlipDelay: %f\n", result);
> -	return result;
> -}
> -
>  static void CalculateActiveRowBandwidth(
>  		bool GPUVMEnable,
>  		enum source_format_class SourcePixelFormat,


More information about the amd-gfx mailing list