Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 2/9] drm/i915: Consolidate HDMI force_dvi handling
Date: Tue, 14 Jan 2020 16:51:44 +0200	[thread overview]
Message-ID: <877e1uks5b.fsf@intel.com> (raw)
In-Reply-To: <20200108181242.13650-2-ville.syrjala@linux.intel.com>

On Wed, 08 Jan 2020, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Move the force_dvi check to a single function that can be called from
> both mode validation and compute_config().
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_hdmi.c | 49 ++++++++++++-----------
>  1 file changed, 26 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 685589064d10..1659cff91426 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -2108,9 +2108,16 @@ static int intel_hdmi_source_max_tmds_clock(struct intel_encoder *encoder)
>  	return max_tmds_clock;
>  }
>  
> +static bool intel_has_hdmi_sink(struct intel_hdmi *hdmi,
> +				const struct drm_connector_state *conn_state)
> +{
> +	return hdmi->has_hdmi_sink &&
> +		READ_ONCE(to_intel_digital_connector_state(conn_state)->force_audio) != HDMI_AUDIO_OFF_DVI;
> +}
> +
>  static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
>  				 bool respect_downstream_limits,
> -				 bool force_dvi)
> +				 bool has_hdmi_sink)
>  {
>  	struct intel_encoder *encoder = &hdmi_to_dig_port(hdmi)->base;
>  	int max_tmds_clock = intel_hdmi_source_max_tmds_clock(encoder);
> @@ -2126,7 +2133,7 @@ static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
>  		if (info->max_tmds_clock)
>  			max_tmds_clock = min(max_tmds_clock,
>  					     info->max_tmds_clock);
> -		else if (!hdmi->has_hdmi_sink || force_dvi)
> +		else if (!has_hdmi_sink)
>  			max_tmds_clock = min(max_tmds_clock, 165000);
>  	}
>  
> @@ -2136,13 +2143,14 @@ static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
>  static enum drm_mode_status
>  hdmi_port_clock_valid(struct intel_hdmi *hdmi,
>  		      int clock, bool respect_downstream_limits,
> -		      bool force_dvi)
> +		      bool has_hdmi_sink)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(intel_hdmi_to_dev(hdmi));
>  
>  	if (clock < 25000)
>  		return MODE_CLOCK_LOW;
> -	if (clock > hdmi_port_clock_limit(hdmi, respect_downstream_limits, force_dvi))
> +	if (clock > hdmi_port_clock_limit(hdmi, respect_downstream_limits,
> +					  has_hdmi_sink))
>  		return MODE_CLOCK_HIGH;
>  
>  	/* BXT DPLL can't generate 223-240 MHz */
> @@ -2164,16 +2172,13 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
>  	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	enum drm_mode_status status;
> -	int clock;
> +	int clock = mode->clock;
>  	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
> -	bool force_dvi =
> -		READ_ONCE(to_intel_digital_connector_state(connector->state)->force_audio) == HDMI_AUDIO_OFF_DVI;
> +	bool has_hdmi_sink = intel_has_hdmi_sink(hdmi, connector->state);
>  
>  	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
>  		return MODE_NO_DBLESCAN;
>  
> -	clock = mode->clock;
> -
>  	if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
>  		clock *= 2;
>  
> @@ -2187,18 +2192,18 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
>  		clock /= 2;
>  
>  	/* check if we can do 8bpc */
> -	status = hdmi_port_clock_valid(hdmi, clock, true, force_dvi);
> +	status = hdmi_port_clock_valid(hdmi, clock, true, has_hdmi_sink);
>  
> -	if (hdmi->has_hdmi_sink && !force_dvi) {
> +	if (has_hdmi_sink) {
>  		/* if we can't do 8bpc we may still be able to do 12bpc */
>  		if (status != MODE_OK && !HAS_GMCH(dev_priv))
>  			status = hdmi_port_clock_valid(hdmi, clock * 3 / 2,
> -						       true, force_dvi);
> +						       true, has_hdmi_sink);
>  
>  		/* if we can't do 8,12bpc we may still be able to do 10bpc */
>  		if (status != MODE_OK && INTEL_GEN(dev_priv) >= 11)
>  			status = hdmi_port_clock_valid(hdmi, clock * 5 / 4,
> -						       true, force_dvi);
> +						       true, has_hdmi_sink);
>  	}
>  	if (status != MODE_OK)
>  		return status;
> @@ -2314,7 +2319,7 @@ static int intel_hdmi_port_clock(int clock, int bpc)
>  
>  static int intel_hdmi_compute_bpc(struct intel_encoder *encoder,
>  				  struct intel_crtc_state *crtc_state,
> -				  int clock, bool force_dvi)
> +				  int clock)
>  {
>  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
>  	int bpc;
> @@ -2323,7 +2328,7 @@ static int intel_hdmi_compute_bpc(struct intel_encoder *encoder,
>  		if (hdmi_deep_color_possible(crtc_state, bpc) &&
>  		    hdmi_port_clock_valid(intel_hdmi,
>  					  intel_hdmi_port_clock(clock, bpc),
> -					  true, force_dvi) == MODE_OK)
> +					  true, crtc_state->has_hdmi_sink) == MODE_OK)
>  			return bpc;
>  	}
>  
> @@ -2331,8 +2336,7 @@ static int intel_hdmi_compute_bpc(struct intel_encoder *encoder,
>  }
>  
>  static int intel_hdmi_compute_clock(struct intel_encoder *encoder,
> -				    struct intel_crtc_state *crtc_state,
> -				    bool force_dvi)
> +				    struct intel_crtc_state *crtc_state)
>  {
>  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
>  	const struct drm_display_mode *adjusted_mode =
> @@ -2346,8 +2350,7 @@ static int intel_hdmi_compute_clock(struct intel_encoder *encoder,
>  	if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420)
>  		clock /= 2;
>  
> -	bpc = intel_hdmi_compute_bpc(encoder, crtc_state,
> -				     clock, force_dvi);
> +	bpc = intel_hdmi_compute_bpc(encoder, crtc_state, clock);
>  
>  	crtc_state->port_clock = intel_hdmi_port_clock(clock, bpc);
>  
> @@ -2363,7 +2366,7 @@ static int intel_hdmi_compute_clock(struct intel_encoder *encoder,
>  		      bpc, crtc_state->pipe_bpp);
>  
>  	if (hdmi_port_clock_valid(intel_hdmi, crtc_state->port_clock,
> -				  false, force_dvi) != MODE_OK) {
> +				  false, crtc_state->has_hdmi_sink) != MODE_OK) {
>  		DRM_DEBUG_KMS("unsupported HDMI clock (%d kHz), rejecting mode\n",
>  			      crtc_state->port_clock);
>  		return -EINVAL;
> @@ -2411,14 +2414,14 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	struct drm_scdc *scdc = &connector->display_info.hdmi.scdc;
>  	struct intel_digital_connector_state *intel_conn_state =
>  		to_intel_digital_connector_state(conn_state);
> -	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
>  	int ret;
>  
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
>  		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	pipe_config->has_hdmi_sink = !force_dvi && intel_hdmi->has_hdmi_sink;
> +	pipe_config->has_hdmi_sink = intel_has_hdmi_sink(intel_hdmi,
> +							 conn_state);
>  
>  	if (pipe_config->has_hdmi_sink)
>  		pipe_config->has_infoframe = true;
> @@ -2447,7 +2450,7 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
>  				intel_conn_state->force_audio == HDMI_AUDIO_ON;
>  	}
>  
> -	ret = intel_hdmi_compute_clock(encoder, pipe_config, force_dvi);
> +	ret = intel_hdmi_compute_clock(encoder, pipe_config);
>  	if (ret)
>  		return ret;

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-01-14 14:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 18:12 [Intel-gfx] [PATCH 1/9] drm/i915/sdvo: Reduce the size of the on stack buffers Ville Syrjala
2020-01-08 18:12 ` [Intel-gfx] [PATCH 2/9] drm/i915: Consolidate HDMI force_dvi handling Ville Syrjala
2020-01-14 14:51   ` Jani Nikula [this message]
2020-01-08 18:12 ` [Intel-gfx] [PATCH 3/9] drm/i915/sdvo: Consolidate SDVO " Ville Syrjala
2020-01-14 14:52   ` Jani Nikula
2020-01-08 18:12 ` [Intel-gfx] [PATCH 4/9] drm/i915/sdvo: Fix SDVO colorimetry bit defines Ville Syrjala
2020-07-09  9:57   ` Imre Deak
2020-01-08 18:12 ` [Intel-gfx] [PATCH 5/9] drm/i915/sdvo: Implement limited color range for SDVO HDMI properly Ville Syrjala
2020-07-09 10:51   ` Imre Deak
2020-01-08 18:12 ` [Intel-gfx] [PATCH 6/9] drm/i915: Reject DRM_MODE_FLAG_DBLCLK with DVI sinks Ville Syrjala
2020-07-09 11:01   ` Imre Deak
2020-07-09 12:04     ` Ville Syrjälä
2020-01-08 18:12 ` [Intel-gfx] [PATCH 7/9] drm/i915/sdvo: Make SDVO deal with HDMI pixel repeat Ville Syrjala
2020-07-09 11:47   ` Imre Deak
2020-07-09 12:20     ` Ville Syrjälä
2020-01-08 18:12 ` [Intel-gfx] [PATCH 8/9] drm/i915/sdvo: Make .get_modes() return the number of modes Ville Syrjala
2020-07-09 11:51   ` Imre Deak
2020-01-08 18:12 ` [Intel-gfx] [PATCH 9/9] drm/i915/dvo: " Ville Syrjala
2020-07-09 11:52   ` Imre Deak
2020-01-09 11:27 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/9] drm/i915/sdvo: Reduce the size of the on stack buffers Patchwork
2020-01-09 12:00 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-01-14 14:52 ` [Intel-gfx] [PATCH 1/9] " Jani Nikula
2020-01-16 11:26 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/9] drm/i915/sdvo: Reduce the size of the on stack buffers (rev2) Patchwork
2020-01-16 11:56 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-01-16 11:56 ` [Intel-gfx] ✗ Fi.CI.BUILD: warning " Patchwork
2020-01-18 23:44 ` [Intel-gfx] ✓ Fi.CI.IGT: success " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877e1uks5b.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox