Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Fix sdvo connector get_hw_state function
@ 2013-04-02 16:37 Daniel Vetter
  2013-04-02 16:39 ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2013-04-02 16:37 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

The active output is only the currently selected one, which does not
imply that it's actually enabled. Since we don't use the sdvo encoder
side dpms support, we need to check whether the chip-side sdvo port is
enabled instead.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60138
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62944
Cc: Egbert Eich <eich@pdx.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_sdvo.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 33b46d9..0e55bee 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1219,11 +1219,15 @@ static bool intel_sdvo_connector_get_hw_state(struct intel_connector *connector)
 	struct intel_sdvo_connector *intel_sdvo_connector =
 		to_intel_sdvo_connector(&connector->base);
 	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(&connector->base);
+	struct drm_i915_private *dev_priv = intel_sdvo->base.base.dev->dev_private;
 	u16 active_outputs;
+	u32 tmp;
 
+	tmp = I915_READ(intel_sdvo->sdvo_reg);
 	intel_sdvo_get_active_outputs(intel_sdvo, &active_outputs);
 
-	if (active_outputs & intel_sdvo_connector->output_flag)
+	if ((active_outputs & intel_sdvo_connector->output_flag) &&
+	    (tmp & SDVO_ENABLE))
 		return true;
 	else
 		return false;
-- 
1.7.10.4

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

* [PATCH] drm/i915: Fix sdvo connector get_hw_state function
  2013-04-02 16:37 [PATCH] drm/i915: Fix sdvo connector get_hw_state function Daniel Vetter
@ 2013-04-02 16:39 ` Daniel Vetter
  2013-04-02 17:00   ` Chris Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2013-04-02 16:39 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

The active output is only the currently selected one, which does not
imply that it's actually enabled. Since we don't use the sdvo encoder
side dpms support, we need to check whether the chip-side sdvo port is
enabled instead.

v2: Fix up Bugzilla links.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60138
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63031
Cc: Egbert Eich <eich@pdx.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_sdvo.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 33b46d9..0e55bee 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1219,11 +1219,15 @@ static bool intel_sdvo_connector_get_hw_state(struct intel_connector *connector)
 	struct intel_sdvo_connector *intel_sdvo_connector =
 		to_intel_sdvo_connector(&connector->base);
 	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(&connector->base);
+	struct drm_i915_private *dev_priv = intel_sdvo->base.base.dev->dev_private;
 	u16 active_outputs;
+	u32 tmp;
 
+	tmp = I915_READ(intel_sdvo->sdvo_reg);
 	intel_sdvo_get_active_outputs(intel_sdvo, &active_outputs);
 
-	if (active_outputs & intel_sdvo_connector->output_flag)
+	if ((active_outputs & intel_sdvo_connector->output_flag) &&
+	    (tmp & SDVO_ENABLE))
 		return true;
 	else
 		return false;
-- 
1.7.10.4

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

* Re: [PATCH] drm/i915: Fix sdvo connector get_hw_state function
  2013-04-02 16:39 ` Daniel Vetter
@ 2013-04-02 17:00   ` Chris Wilson
  2013-04-02 19:30     ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2013-04-02 17:00 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Intel Graphics Development

On Tue, Apr 02, 2013 at 06:39:37PM +0200, Daniel Vetter wrote:
> The active output is only the currently selected one, which does not
> imply that it's actually enabled. Since we don't use the sdvo encoder
> side dpms support, we need to check whether the chip-side sdvo port is
> enabled instead.
> 
> v2: Fix up Bugzilla links.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60138
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63031
> Cc: Egbert Eich <eich@pdx.freedesktop.org
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_sdvo.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 33b46d9..0e55bee 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1219,11 +1219,15 @@ static bool intel_sdvo_connector_get_hw_state(struct intel_connector *connector)
>  	struct intel_sdvo_connector *intel_sdvo_connector =
>  		to_intel_sdvo_connector(&connector->base);
>  	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(&connector->base);
> +	struct drm_i915_private *dev_priv = intel_sdvo->base.base.dev->dev_private;
>  	u16 active_outputs;
> +	u32 tmp;
>  
> +	tmp = I915_READ(intel_sdvo->sdvo_reg);
>  	intel_sdvo_get_active_outputs(intel_sdvo, &active_outputs);
>  
> -	if (active_outputs & intel_sdvo_connector->output_flag)
> +	if ((active_outputs & intel_sdvo_connector->output_flag) &&
> +	    (tmp & SDVO_ENABLE))
>  		return true;
>  	else
>  		return false;

Would this function be tidier as:

/* Check if this SDVO pipe is on and connected to our output */
if (I915_READ(intel_sdvo->sdvo_reg) & SDVO_ENABLE)
   return false;

intel_sdvo_get_active_outputs(intel_sdvo, &active_outputs);
return (active_outputs & intel_sdvo_connector->output_flag) != 0;

At the very least the patch by shrunk by adjusting it to only add the
earlier check.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

* [PATCH] drm/i915: Fix sdvo connector get_hw_state function
  2013-04-02 17:00   ` Chris Wilson
@ 2013-04-02 19:30     ` Daniel Vetter
  2013-04-03  9:09       ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2013-04-02 19:30 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Egbert Eich

The active output is only the currently selected one, which does not
imply that it's actually enabled. Since we don't use the sdvo encoder
side dpms support, we need to check whether the chip-side sdvo port is
enabled instead.

v2: Fix up Bugzilla links.

v3: Simplify logic a bit (Chris).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60138
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63031
Cc: Egbert Eich <eich@pdx.freedesktop.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_sdvo.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 33b46d9..35187d9 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1219,8 +1219,12 @@ static bool intel_sdvo_connector_get_hw_state(struct intel_connector *connector)
 	struct intel_sdvo_connector *intel_sdvo_connector =
 		to_intel_sdvo_connector(&connector->base);
 	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(&connector->base);
+	struct drm_i915_private *dev_priv = intel_sdvo->base.base.dev->dev_private;
 	u16 active_outputs;
 
+	if (!(I915_READ(intel_sdvo->sdvo_reg) & SDVO_ENABLE))
+		return false;
+
 	intel_sdvo_get_active_outputs(intel_sdvo, &active_outputs);
 
 	if (active_outputs & intel_sdvo_connector->output_flag)
-- 
1.7.10.4

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

* Re: [PATCH] drm/i915: Fix sdvo connector get_hw_state function
  2013-04-02 19:30     ` Daniel Vetter
@ 2013-04-03  9:09       ` Daniel Vetter
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2013-04-03  9:09 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Egbert Eich

On Tue, Apr 02, 2013 at 09:30:34PM +0200, Daniel Vetter wrote:
> The active output is only the currently selected one, which does not
> imply that it's actually enabled. Since we don't use the sdvo encoder
> side dpms support, we need to check whether the chip-side sdvo port is
> enabled instead.
> 
> v2: Fix up Bugzilla links.
> 
> v3: Simplify logic a bit (Chris).
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60138
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63031
> Cc: Egbert Eich <eich@pdx.freedesktop.org>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Queued for next with a cc: stable tag. Since it's just mostly harmless
warnings imo not something for -fixes right away.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_sdvo.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 33b46d9..35187d9 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1219,8 +1219,12 @@ static bool intel_sdvo_connector_get_hw_state(struct intel_connector *connector)
>  	struct intel_sdvo_connector *intel_sdvo_connector =
>  		to_intel_sdvo_connector(&connector->base);
>  	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(&connector->base);
> +	struct drm_i915_private *dev_priv = intel_sdvo->base.base.dev->dev_private;
>  	u16 active_outputs;
>  
> +	if (!(I915_READ(intel_sdvo->sdvo_reg) & SDVO_ENABLE))
> +		return false;
> +
>  	intel_sdvo_get_active_outputs(intel_sdvo, &active_outputs);
>  
>  	if (active_outputs & intel_sdvo_connector->output_flag)
> -- 
> 1.7.10.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

end of thread, other threads:[~2013-04-03  9:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02 16:37 [PATCH] drm/i915: Fix sdvo connector get_hw_state function Daniel Vetter
2013-04-02 16:39 ` Daniel Vetter
2013-04-02 17:00   ` Chris Wilson
2013-04-02 19:30     ` Daniel Vetter
2013-04-03  9:09       ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox