diff mbox series

[1/3] drm/i915: Nuke mode.vrefresh usage

Message ID 20200429185457.26235-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/i915: Nuke mode.vrefresh usage | expand

Commit Message

Ville Syrjälä April 29, 2020, 6:54 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

mode.vrefresh is rounded to the nearest integer. You don't want to use
it anywhere that requires precision. Also I want to nuke it.
vtotal*vrefresh == 1000*clock/htotal, so let's use the latter.

Cc: Anshuman Gupta <anshuman.gupta@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_audio.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Chris Wilson April 29, 2020, 7 p.m. UTC | #1
Quoting Ville Syrjala (2020-04-29 19:54:55)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> mode.vrefresh is rounded to the nearest integer. You don't want to use
> it anywhere that requires precision. Also I want to nuke it.
> vtotal*vrefresh == 1000*clock/htotal, so let's use the latter.
> 
> Cc: Anshuman Gupta <anshuman.gupta@intel.com>
> Cc: Uma Shankar <uma.shankar@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_audio.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
> index 36aaee8536f1..f5686e50833f 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.c
> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
> @@ -524,14 +524,12 @@ static unsigned int get_hblank_early_enable_config(struct intel_encoder *encoder
>         unsigned int link_clks_available, link_clks_required;
>         unsigned int tu_data, tu_line, link_clks_active;
>         unsigned int hblank_rise, hblank_early_prog;
> -       unsigned int h_active, h_total, hblank_delta, pixel_clk, v_total;
> -       unsigned int fec_coeff, refresh_rate, cdclk, vdsc_bpp;
> +       unsigned int h_active, h_total, hblank_delta, pixel_clk;
> +       unsigned int fec_coeff, cdclk, vdsc_bpp;
>  
>         h_active = crtc_state->hw.adjusted_mode.crtc_hdisplay;
>         h_total = crtc_state->hw.adjusted_mode.crtc_htotal;
> -       v_total = crtc_state->hw.adjusted_mode.crtc_vtotal;
>         pixel_clk = crtc_state->hw.adjusted_mode.crtc_clock;
> -       refresh_rate = crtc_state->hw.adjusted_mode.vrefresh;
>         vdsc_bpp = crtc_state->dsc.compressed_bpp;
>         cdclk = i915->cdclk.hw.cdclk;
>         /* fec= 0.972261, using rounding multiplier of 1000000 */
> @@ -549,9 +547,7 @@ static unsigned int get_hblank_early_enable_config(struct intel_encoder *encoder
>         link_clks_available = ((((h_total - h_active) *
>                                ((crtc_state->port_clock * ROUNDING_FACTOR) /
>                                 pixel_clk)) / ROUNDING_FACTOR) - 28);
> -
> -       link_clks_required = DIV_ROUND_UP(192000, (refresh_rate *
> -                                         v_total)) * ((48 /
> +       link_clks_required = DIV_ROUND_UP(192000, (1000 * pixel_clk / h_total)) * ((48 /

You don't need to keep the (abuse).

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Shankar, Uma April 30, 2020, 11:41 a.m. UTC | #2
> -----Original Message-----
> From: Ville Syrjala <ville.syrjala@linux.intel.com>
> Sent: Thursday, April 30, 2020 12:25 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: Gupta, Anshuman <anshuman.gupta@intel.com>; Shankar, Uma
> <uma.shankar@intel.com>
> Subject: [PATCH 1/3] drm/i915: Nuke mode.vrefresh usage
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> mode.vrefresh is rounded to the nearest integer. You don't want to use it anywhere
> that requires precision. Also I want to nuke it.
> vtotal*vrefresh == 1000*clock/htotal, so let's use the latter.

Looks Good to me.
Reviewed-by: Uma Shankar <uma.shankar@intel.com>

> Cc: Anshuman Gupta <anshuman.gupta@intel.com>
> Cc: Uma Shankar <uma.shankar@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_audio.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c
> b/drivers/gpu/drm/i915/display/intel_audio.c
> index 36aaee8536f1..f5686e50833f 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.c
> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
> @@ -524,14 +524,12 @@ static unsigned int get_hblank_early_enable_config(struct
> intel_encoder *encoder
>  	unsigned int link_clks_available, link_clks_required;
>  	unsigned int tu_data, tu_line, link_clks_active;
>  	unsigned int hblank_rise, hblank_early_prog;
> -	unsigned int h_active, h_total, hblank_delta, pixel_clk, v_total;
> -	unsigned int fec_coeff, refresh_rate, cdclk, vdsc_bpp;
> +	unsigned int h_active, h_total, hblank_delta, pixel_clk;
> +	unsigned int fec_coeff, cdclk, vdsc_bpp;
> 
>  	h_active = crtc_state->hw.adjusted_mode.crtc_hdisplay;
>  	h_total = crtc_state->hw.adjusted_mode.crtc_htotal;
> -	v_total = crtc_state->hw.adjusted_mode.crtc_vtotal;
>  	pixel_clk = crtc_state->hw.adjusted_mode.crtc_clock;
> -	refresh_rate = crtc_state->hw.adjusted_mode.vrefresh;
>  	vdsc_bpp = crtc_state->dsc.compressed_bpp;
>  	cdclk = i915->cdclk.hw.cdclk;
>  	/* fec= 0.972261, using rounding multiplier of 1000000 */ @@ -549,9
> +547,7 @@ static unsigned int get_hblank_early_enable_config(struct intel_encoder
> *encoder
>  	link_clks_available = ((((h_total - h_active) *
>  			       ((crtc_state->port_clock * ROUNDING_FACTOR) /
>  				pixel_clk)) / ROUNDING_FACTOR) - 28);
> -
> -	link_clks_required = DIV_ROUND_UP(192000, (refresh_rate *
> -					  v_total)) * ((48 /
> +	link_clks_required = DIV_ROUND_UP(192000, (1000 * pixel_clk /
> +h_total)) * ((48 /
>  					  crtc_state->lane_count) + 2);
> 
>  	if (link_clks_available > link_clks_required)
> --
> 2.24.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
index 36aaee8536f1..f5686e50833f 100644
--- a/drivers/gpu/drm/i915/display/intel_audio.c
+++ b/drivers/gpu/drm/i915/display/intel_audio.c
@@ -524,14 +524,12 @@  static unsigned int get_hblank_early_enable_config(struct intel_encoder *encoder
 	unsigned int link_clks_available, link_clks_required;
 	unsigned int tu_data, tu_line, link_clks_active;
 	unsigned int hblank_rise, hblank_early_prog;
-	unsigned int h_active, h_total, hblank_delta, pixel_clk, v_total;
-	unsigned int fec_coeff, refresh_rate, cdclk, vdsc_bpp;
+	unsigned int h_active, h_total, hblank_delta, pixel_clk;
+	unsigned int fec_coeff, cdclk, vdsc_bpp;
 
 	h_active = crtc_state->hw.adjusted_mode.crtc_hdisplay;
 	h_total = crtc_state->hw.adjusted_mode.crtc_htotal;
-	v_total = crtc_state->hw.adjusted_mode.crtc_vtotal;
 	pixel_clk = crtc_state->hw.adjusted_mode.crtc_clock;
-	refresh_rate = crtc_state->hw.adjusted_mode.vrefresh;
 	vdsc_bpp = crtc_state->dsc.compressed_bpp;
 	cdclk = i915->cdclk.hw.cdclk;
 	/* fec= 0.972261, using rounding multiplier of 1000000 */
@@ -549,9 +547,7 @@  static unsigned int get_hblank_early_enable_config(struct intel_encoder *encoder
 	link_clks_available = ((((h_total - h_active) *
 			       ((crtc_state->port_clock * ROUNDING_FACTOR) /
 				pixel_clk)) / ROUNDING_FACTOR) - 28);
-
-	link_clks_required = DIV_ROUND_UP(192000, (refresh_rate *
-					  v_total)) * ((48 /
+	link_clks_required = DIV_ROUND_UP(192000, (1000 * pixel_clk / h_total)) * ((48 /
 					  crtc_state->lane_count) + 2);
 
 	if (link_clks_available > link_clks_required)