diff mbox series

[v2,3/4] drm/i915/dp: Validate the downclock mode for eDP if it exists

Message ID 20180912225719.17574-3-manasi.d.navare@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/4] drm/i915/dp: Link train Fallback on eDP only if fallback link BW can fit panel's native mode | expand

Commit Message

Navare, Manasi Sept. 12, 2018, 10:57 p.m. UTC
With downclock mode and DRRS now operating independently user can
request a modeset on downclock mode. In that case intel_dp_mode_valid()
should validate the downclock mode as well if that is requested.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä Oct. 1, 2018, 4:21 p.m. UTC | #1
On Wed, Sep 12, 2018 at 03:57:18PM -0700, Manasi Navare wrote:
> With downclock mode and DRRS now operating independently user can
> request a modeset on downclock mode. In that case intel_dp_mode_valid()
> should validate the downclock mode as well if that is requested.
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 30526c02b343..0e400629e85c 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -615,6 +615,8 @@ intel_dp_mode_valid(struct drm_connector *connector,
>  	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>  	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
> +	struct drm_display_mode *downclock_mode =
> +		intel_connector->panel.downclock_mode;
>  	int target_clock = mode->clock;
>  	int max_rate, mode_rate, max_lanes, max_link_clock;
>  	int max_dotclk;
> @@ -631,7 +633,10 @@ intel_dp_mode_valid(struct drm_connector *connector,
>  		if (mode->vdisplay > fixed_mode->vdisplay)
>  			return MODE_PANEL;
>  
> -		target_clock = fixed_mode->clock;
> +		if (target_clock < fixed_mode->clock && downclock_mode)
> +			target_clock = downclock_mode->clock;
> +		else
> +			target_clock = fixed_mode->clock;

The whole mode_valid() thing is a bit of mess for internal displays.
I tried to start fixing it here https://patchwork.freedesktop.org/series/45610/
but it got stuck in a bit of a bikeshed.

So without going all in and fixing the vrefresh stuff, and probably
also digging through the whole rat's nest of drm_mode_equal() clock
comparison accuracy (if we want to deal with the whole 59.97 v. 60
hz stuff fully) I think this can be simplified into:

intel_edp_min_dotclock()
{
	return downclock_mode ? downclock_mode->clock : fixed_mode->clock;
}

Anyways, none of that is helpful unless you actually start to use the
downlock mode instead of the fixed mode. Which I didn't spot anywhere
in this series.

>  	}
>  
>  	max_link_clock = intel_dp_max_link_rate(intel_dp);
> -- 
> 2.18.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 30526c02b343..0e400629e85c 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -615,6 +615,8 @@  intel_dp_mode_valid(struct drm_connector *connector,
 	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
+	struct drm_display_mode *downclock_mode =
+		intel_connector->panel.downclock_mode;
 	int target_clock = mode->clock;
 	int max_rate, mode_rate, max_lanes, max_link_clock;
 	int max_dotclk;
@@ -631,7 +633,10 @@  intel_dp_mode_valid(struct drm_connector *connector,
 		if (mode->vdisplay > fixed_mode->vdisplay)
 			return MODE_PANEL;
 
-		target_clock = fixed_mode->clock;
+		if (target_clock < fixed_mode->clock && downclock_mode)
+			target_clock = downclock_mode->clock;
+		else
+			target_clock = fixed_mode->clock;
 	}
 
 	max_link_clock = intel_dp_max_link_rate(intel_dp);