diff mbox series

[3/5] drm/i915: Treat HDMI as DVI when cloning

Message ID 20221107194604.15227-4-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Fix audio/infroframes on g4x | expand

Commit Message

Ville Syrjälä Nov. 7, 2022, 7:46 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

When doing HDMI+non-HDMI cloing the other sink can't get
the inframes/etc. so stuff like limited range output is
not a good idea.

Similarly when doing HDMI+HDMI cloning on g4x (only platform
where we allow it) only one of the ports can receive infoframes
and so again using any fancy stuff is a bad idea. We also don't
track the inforames/audio state per-port so we'd end up with
some kind of random mismash state when multipled encoders try
to compute the same stuff. And the hardware will in fact
automagically disable audio/infoframe transmission if you try
to enable it for multiple HDMI ports at the same time.

Thus disable all HDMI specific features when cloning.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_hdmi.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Jani Nikula Nov. 8, 2022, 11:51 a.m. UTC | #1
On Mon, 07 Nov 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> When doing HDMI+non-HDMI cloing the other sink can't get

*cloning

> the inframes/etc. so stuff like limited range output is

*infoframes

> not a good idea.
>
> Similarly when doing HDMI+HDMI cloning on g4x (only platform
> where we allow it) only one of the ports can receive infoframes
> and so again using any fancy stuff is a bad idea. We also don't
> track the inforames/audio state per-port so we'd end up with
> some kind of random mismash state when multipled encoders try
> to compute the same stuff. And the hardware will in fact
> automagically disable audio/infoframe transmission if you try
> to enable it for multiple HDMI ports at the same time.
>
> Thus disable all HDMI specific features when cloning.
>
> 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 | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index d3692c9a1d80..31927f8238d1 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -2057,13 +2057,6 @@ static bool hdmi_bpc_possible(const struct intel_crtc_state *crtc_state, int bpc
>  	if (!intel_hdmi_source_bpc_possible(dev_priv, bpc))
>  		return false;
>  
> -	/*
> -	 * HDMI deep color affects the clocks, so it's only possible
> -	 * when not cloning with other encoder types.
> -	 */
> -	if (bpc > 8 && crtc_state->output_types != BIT(INTEL_OUTPUT_HDMI))
> -		return false;
> -
>  	/* Display Wa_1405510057:icl,ehl */
>  	if (intel_hdmi_is_ycbcr420(crtc_state) &&
>  	    bpc == 10 && DISPLAY_VER(dev_priv) == 11 &&
> @@ -2238,6 +2231,12 @@ static int intel_hdmi_compute_output_format(struct intel_encoder *encoder,
>  	return ret;
>  }
>  
> +static bool intel_hdmi_is_cloned(const struct intel_crtc_state *crtc_state)
> +{
> +	return crtc_state->uapi.encoder_mask &&
> +		!is_power_of_2(crtc_state->uapi.encoder_mask);
> +}
> +
>  int intel_hdmi_compute_config(struct intel_encoder *encoder,
>  			      struct intel_crtc_state *pipe_config,
>  			      struct drm_connector_state *conn_state)
> @@ -2253,8 +2252,9 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
>  		return -EINVAL;
>  
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> -	pipe_config->has_hdmi_sink = intel_has_hdmi_sink(intel_hdmi,
> -							 conn_state);
> +	pipe_config->has_hdmi_sink =
> +		intel_has_hdmi_sink(intel_hdmi, conn_state) &&
> +		!intel_hdmi_is_cloned(pipe_config);
>  
>  	if (pipe_config->has_hdmi_sink)
>  		pipe_config->has_infoframe = true;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index d3692c9a1d80..31927f8238d1 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -2057,13 +2057,6 @@  static bool hdmi_bpc_possible(const struct intel_crtc_state *crtc_state, int bpc
 	if (!intel_hdmi_source_bpc_possible(dev_priv, bpc))
 		return false;
 
-	/*
-	 * HDMI deep color affects the clocks, so it's only possible
-	 * when not cloning with other encoder types.
-	 */
-	if (bpc > 8 && crtc_state->output_types != BIT(INTEL_OUTPUT_HDMI))
-		return false;
-
 	/* Display Wa_1405510057:icl,ehl */
 	if (intel_hdmi_is_ycbcr420(crtc_state) &&
 	    bpc == 10 && DISPLAY_VER(dev_priv) == 11 &&
@@ -2238,6 +2231,12 @@  static int intel_hdmi_compute_output_format(struct intel_encoder *encoder,
 	return ret;
 }
 
+static bool intel_hdmi_is_cloned(const struct intel_crtc_state *crtc_state)
+{
+	return crtc_state->uapi.encoder_mask &&
+		!is_power_of_2(crtc_state->uapi.encoder_mask);
+}
+
 int intel_hdmi_compute_config(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config,
 			      struct drm_connector_state *conn_state)
@@ -2253,8 +2252,9 @@  int intel_hdmi_compute_config(struct intel_encoder *encoder,
 		return -EINVAL;
 
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
-	pipe_config->has_hdmi_sink = intel_has_hdmi_sink(intel_hdmi,
-							 conn_state);
+	pipe_config->has_hdmi_sink =
+		intel_has_hdmi_sink(intel_hdmi, conn_state) &&
+		!intel_hdmi_is_cloned(pipe_config);
 
 	if (pipe_config->has_hdmi_sink)
 		pipe_config->has_infoframe = true;