public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915/skl: Assume no scaling is available when things are not as expected
@ 2015-10-20 15:01 Tvrtko Ursulin
  2015-10-20 15:25 ` Ville Syrjälä
  0 siblings, 1 reply; 4+ messages in thread
From: Tvrtko Ursulin @ 2015-10-20 15:01 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Cdclk < crtc_clock is not allowed and suggests a different problem
elsewhere in the code.

It is more robust and safe to assume no scaling is possible in
this case with no other downsides since it will also WARN_ON_ONCE
so that this definitely gets noticed.

Call it an assert to help new platform bring-up in simulation.

v2: Better commit msg and use WARN_ON_ONCE to signify the unexpectedness.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9cb29086971a..f315ed45358f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13439,7 +13439,7 @@ skl_max_scale(struct intel_crtc *intel_crtc, struct intel_crtc_state *crtc_state
 	crtc_clock = crtc_state->base.adjusted_mode.crtc_clock;
 	cdclk = to_intel_atomic_state(crtc_state->base.state)->cdclk;
 
-	if (!crtc_clock || !cdclk)
+	if (!crtc_clock || !cdclk || WARN_ON_ONCE(cdclk < crtc_clock))
 		return DRM_PLANE_HELPER_NO_SCALING;
 
 	/*
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2] drm/i915/skl: Assume no scaling is available when things are not as expected
  2015-10-20 15:01 [PATCH v2] drm/i915/skl: Assume no scaling is available when things are not as expected Tvrtko Ursulin
@ 2015-10-20 15:25 ` Ville Syrjälä
  2015-10-20 16:17   ` [PATCH v3] " Tvrtko Ursulin
  0 siblings, 1 reply; 4+ messages in thread
From: Ville Syrjälä @ 2015-10-20 15:25 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: Intel-gfx

On Tue, Oct 20, 2015 at 04:01:20PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Cdclk < crtc_clock is not allowed and suggests a different problem
> elsewhere in the code.
> 
> It is more robust and safe to assume no scaling is possible in
> this case with no other downsides since it will also WARN_ON_ONCE
> so that this definitely gets noticed.
> 
> Call it an assert to help new platform bring-up in simulation.
> 
> v2: Better commit msg and use WARN_ON_ONCE to signify the unexpectedness.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 9cb29086971a..f315ed45358f 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13439,7 +13439,7 @@ skl_max_scale(struct intel_crtc *intel_crtc, struct intel_crtc_state *crtc_state
>  	crtc_clock = crtc_state->base.adjusted_mode.crtc_clock;
>  	cdclk = to_intel_atomic_state(crtc_state->base.state)->cdclk;
>  
> -	if (!crtc_clock || !cdclk)
> +	if (!crtc_clock || !cdclk || WARN_ON_ONCE(cdclk < crtc_clock))

I'm thinking the zero crtc_clock check should also be inside the WARN.
And you could drop the !cdclk part since the < already covers it.

With those:
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  		return DRM_PLANE_HELPER_NO_SCALING;
>  
>  	/*
> -- 
> 1.9.1

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v3] drm/i915/skl: Assume no scaling is available when things are not as expected
  2015-10-20 15:25 ` Ville Syrjälä
@ 2015-10-20 16:17   ` Tvrtko Ursulin
  2015-10-21  6:45     ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Tvrtko Ursulin @ 2015-10-20 16:17 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Cdclk < crtc_clock is not allowed and suggests a different problem
elsewhere in the code.

It is more robust and safe to assume no scaling is possible in
this case with no other downsides since it will also WARN_ON_ONCE
so that this definitely gets noticed.

Call it an assert to help new platform bring-up in simulation.

v2: Better commit msg and use WARN_ON_ONCE to signify the unexpectedness.

v3: Move zero crtc_clock check under the warn. (Ville)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2981d09d5e4e..607a720c19ba 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13436,7 +13436,7 @@ skl_max_scale(struct intel_crtc *intel_crtc, struct intel_crtc_state *crtc_state
 	crtc_clock = crtc_state->base.adjusted_mode.crtc_clock;
 	cdclk = to_intel_atomic_state(crtc_state->base.state)->cdclk;
 
-	if (!crtc_clock || !cdclk)
+	if (WARN_ON_ONCE(!crtc_clock || cdclk < crtc_clock))
 		return DRM_PLANE_HELPER_NO_SCALING;
 
 	/*
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v3] drm/i915/skl: Assume no scaling is available when things are not as expected
  2015-10-20 16:17   ` [PATCH v3] " Tvrtko Ursulin
@ 2015-10-21  6:45     ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2015-10-21  6:45 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: Intel-gfx

On Tue, Oct 20, 2015 at 05:17:07PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Cdclk < crtc_clock is not allowed and suggests a different problem
> elsewhere in the code.
> 
> It is more robust and safe to assume no scaling is possible in
> this case with no other downsides since it will also WARN_ON_ONCE
> so that this definitely gets noticed.
> 
> Call it an assert to help new platform bring-up in simulation.
> 
> v2: Better commit msg and use WARN_ON_ONCE to signify the unexpectedness.
> 
> v3: Move zero crtc_clock check under the warn. (Ville)
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 2981d09d5e4e..607a720c19ba 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13436,7 +13436,7 @@ skl_max_scale(struct intel_crtc *intel_crtc, struct intel_crtc_state *crtc_state
>  	crtc_clock = crtc_state->base.adjusted_mode.crtc_clock;
>  	cdclk = to_intel_atomic_state(crtc_state->base.state)->cdclk;
>  
> -	if (!crtc_clock || !cdclk)
> +	if (WARN_ON_ONCE(!crtc_clock || cdclk < crtc_clock))
>  		return DRM_PLANE_HELPER_NO_SCALING;
>  
>  	/*
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2015-10-21  6:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20 15:01 [PATCH v2] drm/i915/skl: Assume no scaling is available when things are not as expected Tvrtko Ursulin
2015-10-20 15:25 ` Ville Syrjälä
2015-10-20 16:17   ` [PATCH v3] " Tvrtko Ursulin
2015-10-21  6:45     ` Daniel Vetter

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