drm/amd/display: remove redundant CalculateTWait's
PATCH 1/1 drm/amd/display: remove redundant CalculateTWait's
There are several copies of CalculateTwait.
Reduce to one instance and change local variable name to match common usage.
Signed-off-by Tom Rix <[email protected]>
--- .../dc/dml/dcn20/display_mode_vba_20.c | 16 +++++++------- .../dc/dml/dcn20/display_mode_vba_20v2.c | 21 ++----------------- .../dc/dml/dcn21/display_mode_vba_21.c | 19 +---------------- .../dc/dml/dcn30/display_mode_vba_30.c | 18 +--------------- .../dc/dml/dcn31/display_mode_vba_31.c | 13 +----------- .../dc/dml/dcn314/display_mode_vba_314.c | 13 +----------- 6 files changed, 14 insertions(+), 86 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c +8 -8
@@ -153,10 +153,10 @@ static unsigned int CalculateVMAndRowBytes(bool *PTEBufferSizeNotExceeded, unsigned int *dpte_row_height, unsigned int *meta_row_height); -static double CalculateTWait ( +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency, -double UrgentLatencyPixelDataOnly, +double UrgentLatency,double SREnterPlusExitTime); static double CalculateRemoteSurfaceFlipDelay( struct display_mode_lib *mode_lib,
@@ -2892,20 +2892,20 @@ static void dml20_DisplayPipeConfiguration(struct display_mode_lib *mode_lib) } } -static double CalculateTWait ( +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency, -double UrgentLatencyPixelDataOnly, +double UrgentLatency,double SREnterPlusExitTime) {if (PrefetchMode ==0 ) {return dml_max ( - DRAMClockChangeLatency + UrgentLatencyPixelDataOnly, -dml_max (SREnterPlusExitTime, UrgentLatencyPixelDataOnly)); + DRAMClockChangeLatency + UrgentLatency, +dml_max (SREnterPlusExitTime, UrgentLatency)); }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatencyPixelDataOnly); +return dml_max (SREnterPlusExitTime, UrgentLatency); }else { -return UrgentLatencyPixelDataOnly; +return UrgentLatency; } }
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c +2 -19
@@ -177,10 +177,10 @@ static unsigned int CalculateVMAndRowBytes(bool *PTEBufferSizeNotExceeded, unsigned int *dpte_row_height, unsigned int *meta_row_height); -static double CalculateTWait ( +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency, -double UrgentLatencyPixelDataOnly, +double UrgentLatency,double SREnterPlusExitTime); static double CalculateRemoteSurfaceFlipDelay( struct display_mode_lib *mode_lib,
@@ -2967,23 +2967,6 @@ static void dml20v2_DisplayPipeConfiguration(struct display_mode_lib *mode_lib) } } -static double CalculateTWait ( -unsigned int PrefetchMode, -double DRAMClockChangeLatency, -double UrgentLatencyPixelDataOnly, -double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max ( - DRAMClockChangeLatency + UrgentLatencyPixelDataOnly, -dml_max (SREnterPlusExitTime, UrgentLatencyPixelDataOnly)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatencyPixelDataOnly); - }else { -return UrgentLatencyPixelDataOnly; - } -} - static double CalculateRemoteSurfaceFlipDelay( struct display_mode_lib *mode_lib, double VRatio,
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c +1 -18
@@ -205,7 +205,7 @@ static unsigned int CalculateVMAndRowBytes(unsigned int *DPDE0BytesFrame, unsigned int *MetaPTEBytesFrame); -static double CalculateTWait( +double CalculateTWait( unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency,
@@ -2980,23 +2980,6 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib) } } -static double CalculateTWait ( -unsigned int PrefetchMode, -double DRAMClockChangeLatency, -double UrgentLatency, -double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max ( - DRAMClockChangeLatency + UrgentLatency, -dml_max (SREnterPlusExitTime, UrgentLatency)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatency); - }else { -return UrgentLatency; - } -} - static double CalculateRemoteSurfaceFlipDelay( struct display_mode_lib *mode_lib, double VRatio,
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +1 -17
@@ -216,7 +216,7 @@ static unsigned int CalculateVMAndRowBytes(unsigned int *PTERequestSize, unsigned int *DPDE0BytesFrame, unsigned int *MetaPTEBytesFrame); -static double CalculateTWait( +double CalculateTWait( unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency,
@@ -3191,22 +3191,6 @@ void dml30_CalculateBytePerPixelAnd256BBlockSizes( } } -static double CalculateTWait ( -unsigned int PrefetchMode, -double DRAMClockChangeLatency, -double UrgentLatency, -double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max (DRAMClockChangeLatency + UrgentLatency, -dml_max (SREnterPlusExitTime, UrgentLatency)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatency); - }else { -return UrgentLatency; - } -} - double dml30_CalculateWriteBackDISPCLK( enum source_format_class WritebackPixelFormat, double PixelClock,
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +1 -12
@@ -230,7 +230,7 @@ static unsigned int CalculateVMAndRowBytes(unsigned int *PTERequestSize, int *DPDE0BytesFrame, int *MetaPTEBytesFrame); -static double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime); +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime); static void CalculateRowBandwidth( bool GPUVMEnable, enum source_format_class SourcePixelFormat,
@@ -3323,17 +3323,6 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib) &dummysinglestring); } -static double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max (DRAMClockChangeLatency + UrgentLatency,dml_max (SREnterPlusExitTime, UrgentLatency)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatency); - }else { -return UrgentLatency; - } -} - double dml31_CalculateWriteBackDISPCLK( enum source_format_class WritebackPixelFormat, double PixelClock,
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +1 -12
@@ -244,7 +244,7 @@ static unsigned int CalculateVMAndRowBytes(unsigned int *PTERequestSize, int *DPDE0BytesFrame, int *MetaPTEBytesFrame); -static double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime); +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime); static void CalculateRowBandwidth( bool GPUVMEnable, enum source_format_class SourcePixelFormat,
@@ -3547,17 +3547,6 @@ static bool CalculateBytePerPixelAnd256BBlockSizes(return true; } -static double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max (DRAMClockChangeLatency + UrgentLatency,dml_max (SREnterPlusExitTime, UrgentLatency)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatency); - }else { -return UrgentLatency; - } -} - double dml314_CalculateWriteBackDISPCLK( enum source_format_class WritebackPixelFormat, double PixelClock,
Signature · 1 line
2.27.0
Hi Tom,
Quoted 4 lines · Tom Rix
There are several copies of CalculateTwait.
Reduce to one instance and change local variable name to match common usage.Signed-off-by Tom Rix <[email protected]>
Reviewed-by Maíra Canal <[email protected]>
Although, it would be nice to put this function on the display_mode_vba.h file, as all DCNs use this function.
Best Regards,
- Maíra Canal
Quoted 229 lines
--- .../dc/dml/dcn20/display_mode_vba_20.c | 16 +++++++------- .../dc/dml/dcn20/display_mode_vba_20v2.c | 21 ++----------------- .../dc/dml/dcn21/display_mode_vba_21.c | 19 +---------------- .../dc/dml/dcn30/display_mode_vba_30.c | 18 +--------------- .../dc/dml/dcn31/display_mode_vba_31.c | 13 +----------- .../dc/dml/dcn314/display_mode_vba_314.c | 13 +----------- 6 files changed, 14 insertions(+), 86 deletions(-)drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c +8
-8@@ -153,10 +153,10 @@ static unsigned int CalculateVMAndRowBytes(bool *PTEBufferSizeNotExceeded, unsigned int *dpte_row_height, unsigned int *meta_row_height); -static double CalculateTWait ( +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency, -double UrgentLatencyPixelDataOnly, +double UrgentLatency,double SREnterPlusExitTime); static double CalculateRemoteSurfaceFlipDelay( struct display_mode_lib *mode_lib,@@ -2892,20 +2892,20 @@ static void dml20_DisplayPipeConfiguration(struct display_mode_lib *mode_lib) } } -static double CalculateTWait ( +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency, -double UrgentLatencyPixelDataOnly, +double UrgentLatency,double SREnterPlusExitTime) {if (PrefetchMode ==0 ) {return dml_max ( - DRAMClockChangeLatency + UrgentLatencyPixelDataOnly, -dml_max (SREnterPlusExitTime, UrgentLatencyPixelDataOnly)); + DRAMClockChangeLatency + UrgentLatency, +dml_max (SREnterPlusExitTime, UrgentLatency)); }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatencyPixelDataOnly); +return dml_max (SREnterPlusExitTime, UrgentLatency); }else { -return UrgentLatencyPixelDataOnly; +return UrgentLatency; } }drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c +2
-19@@ -177,10 +177,10 @@ static unsigned int CalculateVMAndRowBytes(bool *PTEBufferSizeNotExceeded, unsigned int *dpte_row_height, unsigned int *meta_row_height); -static double CalculateTWait ( +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency, -double UrgentLatencyPixelDataOnly, +double UrgentLatency,double SREnterPlusExitTime); static double CalculateRemoteSurfaceFlipDelay( struct display_mode_lib *mode_lib,@@ -2967,23 +2967,6 @@ static void dml20v2_DisplayPipeConfiguration(struct display_mode_lib *mode_lib) } } -static double CalculateTWait ( -unsigned int PrefetchMode, -double DRAMClockChangeLatency, -double UrgentLatencyPixelDataOnly, -double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max ( - DRAMClockChangeLatency + UrgentLatencyPixelDataOnly, -dml_max (SREnterPlusExitTime, UrgentLatencyPixelDataOnly)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatencyPixelDataOnly); - }else { -return UrgentLatencyPixelDataOnly; - } -} - static double CalculateRemoteSurfaceFlipDelay( struct display_mode_lib *mode_lib, double VRatio,drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c +1
-18@@ -205,7 +205,7 @@ static unsigned int CalculateVMAndRowBytes(unsigned int *DPDE0BytesFrame, unsigned int *MetaPTEBytesFrame); -static double CalculateTWait( +double CalculateTWait( unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency,@@ -2980,23 +2980,6 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib) } } -static double CalculateTWait ( -unsigned int PrefetchMode, -double DRAMClockChangeLatency, -double UrgentLatency, -double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max ( - DRAMClockChangeLatency + UrgentLatency, -dml_max (SREnterPlusExitTime, UrgentLatency)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatency); - }else { -return UrgentLatency; - } -} - static double CalculateRemoteSurfaceFlipDelay( struct display_mode_lib *mode_lib, double VRatio,drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +1
-17@@ -216,7 +216,7 @@ static unsigned int CalculateVMAndRowBytes(unsigned int *PTERequestSize, unsigned int *DPDE0BytesFrame, unsigned int *MetaPTEBytesFrame); -static double CalculateTWait( +double CalculateTWait( unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency,@@ -3191,22 +3191,6 @@ void dml30_CalculateBytePerPixelAnd256BBlockSizes( } } -static double CalculateTWait ( -unsigned int PrefetchMode, -double DRAMClockChangeLatency, -double UrgentLatency, -double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max (DRAMClockChangeLatency + UrgentLatency, -dml_max (SREnterPlusExitTime, UrgentLatency)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatency); - }else { -return UrgentLatency; - } -} - double dml30_CalculateWriteBackDISPCLK( enum source_format_class WritebackPixelFormat, double PixelClock,drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +1
-12@@ -230,7 +230,7 @@ static unsigned int CalculateVMAndRowBytes(unsigned int *PTERequestSize, int *DPDE0BytesFrame, int *MetaPTEBytesFrame); -static double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime); +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime); static void CalculateRowBandwidth( bool GPUVMEnable, enum source_format_class SourcePixelFormat,@@ -3323,17 +3323,6 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib) &dummysinglestring); } -static double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max (DRAMClockChangeLatency + UrgentLatency,dml_max (SREnterPlusExitTime, UrgentLatency)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatency); - }else { -return UrgentLatency; - } -} - double dml31_CalculateWriteBackDISPCLK( enum source_format_class WritebackPixelFormat, double PixelClock,drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +1
-12@@ -244,7 +244,7 @@ static unsigned int CalculateVMAndRowBytes(unsigned int *PTERequestSize, int *DPDE0BytesFrame, int *MetaPTEBytesFrame); -static double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime); +double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime); static void CalculateRowBandwidth( bool GPUVMEnable, enum source_format_class SourcePixelFormat,@@ -3547,17 +3547,6 @@ static bool CalculateBytePerPixelAnd256BBlockSizes(return true; } -static double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime) -{ -if (PrefetchMode ==0 ) { -return dml_max (DRAMClockChangeLatency + UrgentLatency,dml_max (SREnterPlusExitTime, UrgentLatency)); - }else if (PrefetchMode ==1 ) { -return dml_max (SREnterPlusExitTime, UrgentLatency); - }else { -return UrgentLatency; - } -} - double dml314_CalculateWriteBackDISPCLK( enum source_format_class WritebackPixelFormat, double PixelClock,