All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/sdvo: Only enable HDMI encodings only if the commandset is supported
       [not found] <id:0d30dc$k89l8c@orsmga001.jf.intel.com>
@ 2010-11-22 11:30 ` Chris Wilson
  2010-11-22 13:16   ` Simon Farnsworth
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2010-11-22 11:30 UTC (permalink / raw)
  To: Simon Farnsworth; +Cc: intel-gfx

As we conflated intel_sdvo->is_hdmi with both having HDMI support on the
ADD along with having HDMI support on the monitor, we would attempt to
use HDMI encodings even if the interface did not support those commands.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_sdvo.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index de158b7..8431825 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -107,7 +107,8 @@ struct intel_sdvo {
 	 * This is set if we treat the device as HDMI, instead of DVI.
 	 */
 	bool is_hdmi;
-	bool has_audio;
+	bool has_hdmi_monitor;
+	bool has_hdmi_audio;
 
 	/**
 	 * This is set if we detect output of sdvo device as LVDS and
@@ -1023,7 +1024,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 	if (!intel_sdvo_set_target_input(intel_sdvo))
 		return;
 
-	if (intel_sdvo->is_hdmi &&
+	if (intel_sdvo->has_hdmi_monitor &&
 	    !intel_sdvo_set_avi_infoframe(intel_sdvo))
 		return;
 
@@ -1063,7 +1064,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 	}
 	if (intel_crtc->pipe == 1)
 		sdvox |= SDVO_PIPE_B_SELECT;
-	if (intel_sdvo->has_audio)
+	if (intel_sdvo->has_hdmi_audio)
 		sdvox |= SDVO_AUDIO_ENABLE;
 
 	if (INTEL_INFO(dev)->gen >= 4) {
@@ -1388,8 +1389,10 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector)
 		/* DDC bus is shared, match EDID to connector type */
 		if (edid->input & DRM_EDID_INPUT_DIGITAL) {
 			status = connector_status_connected;
-			intel_sdvo->is_hdmi = drm_detect_hdmi_monitor(edid);
-			intel_sdvo->has_audio = drm_detect_monitor_audio(edid);
+			if (intel_sdvo->is_hdmi) {
+				intel_sdvo->has_hdmi_monitor = drm_detect_hdmi_monitor(edid);
+				intel_sdvo->has_hdmi_audio = drm_detect_monitor_audio(edid);
+			}
 		}
 		connector->display_info.raw_edid = NULL;
 		kfree(edid);
@@ -1398,7 +1401,7 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector)
 	if (status == connector_status_connected) {
 		struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
 		if (intel_sdvo_connector->force_audio)
-			intel_sdvo->has_audio = intel_sdvo_connector->force_audio > 0;
+			intel_sdvo->has_hdmi_audio = intel_sdvo_connector->force_audio > 0;
 	}
 
 	return status;
@@ -1713,12 +1716,12 @@ intel_sdvo_set_property(struct drm_connector *connector,
 
 		intel_sdvo_connector->force_audio = val;
 
-		if (val > 0 && intel_sdvo->has_audio)
+		if (val > 0 && intel_sdvo->has_hdmi_audio)
 			return 0;
-		if (val < 0 && !intel_sdvo->has_audio)
+		if (val < 0 && !intel_sdvo->has_hdmi_audio)
 			return 0;
 
-		intel_sdvo->has_audio = val > 0;
+		intel_sdvo->has_hdmi_audio = val > 0;
 		goto done;
 	}
 
@@ -2070,6 +2073,8 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
 		intel_sdvo_set_colorimetry(intel_sdvo,
 					   SDVO_COLORIMETRY_RGB256);
 		connector->connector_type = DRM_MODE_CONNECTOR_HDMIA;
+
+		intel_sdvo_add_hdmi_properties(intel_sdvo_connector);
 		intel_sdvo->is_hdmi = true;
 	}
 	intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
@@ -2077,8 +2082,6 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
 
 	intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo);
 
-	intel_sdvo_add_hdmi_properties(intel_sdvo_connector);
-
 	return true;
 }
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915/sdvo: Only enable HDMI encodings only if the commandset is supported
  2010-11-22 11:30 ` [PATCH] drm/i915/sdvo: Only enable HDMI encodings only if the commandset is supported Chris Wilson
@ 2010-11-22 13:16   ` Simon Farnsworth
  2010-11-22 13:31     ` Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Farnsworth @ 2010-11-22 13:16 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Monday 22 November 2010, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> As we conflated intel_sdvo->is_hdmi with both having HDMI support on the
> ADD along with having HDMI support on the monitor, we would attempt to
> use HDMI encodings even if the interface did not support those commands.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

This fixes my problems with the image being in the middle third or so of the 
screen. I've also read the patch and resulting state of code, and it looks 
like the right thing to do, so take your pick of:

Tested-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Reviewed-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>

> ---
>  drivers/gpu/drm/i915/intel_sdvo.c |   25 ++++++++++++++-----------
>  1 files changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c
> b/drivers/gpu/drm/i915/intel_sdvo.c index de158b7..8431825 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -107,7 +107,8 @@ struct intel_sdvo {
>  	 * This is set if we treat the device as HDMI, instead of DVI.
>  	 */
>  	bool is_hdmi;
> -	bool has_audio;
> +	bool has_hdmi_monitor;
> +	bool has_hdmi_audio;
> 
>  	/**
>  	 * This is set if we detect output of sdvo device as LVDS and
> @@ -1023,7 +1024,7 @@ static void intel_sdvo_mode_set(struct drm_encoder
> *encoder, if (!intel_sdvo_set_target_input(intel_sdvo))
>  		return;
> 
> -	if (intel_sdvo->is_hdmi &&
> +	if (intel_sdvo->has_hdmi_monitor &&
>  	    !intel_sdvo_set_avi_infoframe(intel_sdvo))
>  		return;
> 
> @@ -1063,7 +1064,7 @@ static void intel_sdvo_mode_set(struct drm_encoder
> *encoder, }
>  	if (intel_crtc->pipe == 1)
>  		sdvox |= SDVO_PIPE_B_SELECT;
> -	if (intel_sdvo->has_audio)
> +	if (intel_sdvo->has_hdmi_audio)
>  		sdvox |= SDVO_AUDIO_ENABLE;
> 
>  	if (INTEL_INFO(dev)->gen >= 4) {
> @@ -1388,8 +1389,10 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector
> *connector) /* DDC bus is shared, match EDID to connector type */
>  		if (edid->input & DRM_EDID_INPUT_DIGITAL) {
>  			status = connector_status_connected;
> -			intel_sdvo->is_hdmi = drm_detect_hdmi_monitor(edid);
> -			intel_sdvo->has_audio = drm_detect_monitor_audio(edid);
> +			if (intel_sdvo->is_hdmi) {
> +				intel_sdvo->has_hdmi_monitor = 
drm_detect_hdmi_monitor(edid);
> +				intel_sdvo->has_hdmi_audio = 
drm_detect_monitor_audio(edid);
> +			}
>  		}
>  		connector->display_info.raw_edid = NULL;
>  		kfree(edid);
> @@ -1398,7 +1401,7 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector
> *connector) if (status == connector_status_connected) {
>  		struct intel_sdvo_connector *intel_sdvo_connector =
> to_intel_sdvo_connector(connector); if (intel_sdvo_connector->force_audio)
> -			intel_sdvo->has_audio = intel_sdvo_connector->force_audio > 0;
> +			intel_sdvo->has_hdmi_audio = intel_sdvo_connector->force_audio > 
0;
>  	}
> 
>  	return status;
> @@ -1713,12 +1716,12 @@ intel_sdvo_set_property(struct drm_connector
> *connector,
> 
>  		intel_sdvo_connector->force_audio = val;
> 
> -		if (val > 0 && intel_sdvo->has_audio)
> +		if (val > 0 && intel_sdvo->has_hdmi_audio)
>  			return 0;
> -		if (val < 0 && !intel_sdvo->has_audio)
> +		if (val < 0 && !intel_sdvo->has_hdmi_audio)
>  			return 0;
> 
> -		intel_sdvo->has_audio = val > 0;
> +		intel_sdvo->has_hdmi_audio = val > 0;
>  		goto done;
>  	}
> 
> @@ -2070,6 +2073,8 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo,
> int device) intel_sdvo_set_colorimetry(intel_sdvo,
>  					   SDVO_COLORIMETRY_RGB256);
>  		connector->connector_type = DRM_MODE_CONNECTOR_HDMIA;
> +
> +		intel_sdvo_add_hdmi_properties(intel_sdvo_connector);
>  		intel_sdvo->is_hdmi = true;
>  	}
>  	intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
> @@ -2077,8 +2082,6 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo,
> int device)
> 
>  	intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo);
> 
> -	intel_sdvo_add_hdmi_properties(intel_sdvo_connector);
> -
>  	return true;
>  }
-- 
Simon Farnsworth
Software Engineer
ONELAN Limited
http://www.onelan.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915/sdvo: Only enable HDMI encodings only if the commandset is supported
  2010-11-22 13:16   ` Simon Farnsworth
@ 2010-11-22 13:31     ` Chris Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Wilson @ 2010-11-22 13:31 UTC (permalink / raw)
  To: Simon Farnsworth; +Cc: intel-gfx

On Mon, 22 Nov 2010 13:16:43 +0000, Simon Farnsworth <simon.farnsworth@onelan.co.uk> wrote:
> On Monday 22 November 2010, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > As we conflated intel_sdvo->is_hdmi with both having HDMI support on the
> > ADD along with having HDMI support on the monitor, we would attempt to
> > use HDMI encodings even if the interface did not support those commands.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> This fixes my problems with the image being in the middle third or so of the 
> screen. I've also read the patch and resulting state of code, and it looks 
> like the right thing to do, so take your pick of:
> 
> Tested-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
> Reviewed-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>

Excellent! Pushed to -fixes.

Thanks,
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-22 13:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <id:0d30dc$k89l8c@orsmga001.jf.intel.com>
2010-11-22 11:30 ` [PATCH] drm/i915/sdvo: Only enable HDMI encodings only if the commandset is supported Chris Wilson
2010-11-22 13:16   ` Simon Farnsworth
2010-11-22 13:31     ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.