[20/21] drm/i915: Complain if hsw_get_pipe_config acquires the same power well twice

Submitted by Chris Wilson on Jan. 10, 2019, 10:11 a.m.

Details

Message ID 20190110101152.15651-21-chris@chris-wilson.co.uk
State Under Review
Series "Series without cover letter"
Headers show

Commit Message

Chris Wilson Jan. 10, 2019, 10:11 a.m.
As we only release each power well once, we assume that each transcoder
maps to a different domain. Complain if this is not so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 36c56d1637b8..7c974cf064fd 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9569,6 +9569,8 @@  static bool hsw_get_transcoder_state(struct intel_crtc *crtc,
 	power_domain = POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder);
 	if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
 		return false;
+
+	WARN_ON(*power_domain_mask & BIT_ULL(power_domain));
 	*power_domain_mask |= BIT_ULL(power_domain);
 
 	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
@@ -9596,6 +9598,8 @@  static bool bxt_get_dsi_transcoder_state(struct intel_crtc *crtc,
 		power_domain = POWER_DOMAIN_TRANSCODER(cpu_transcoder);
 		if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
 			continue;
+
+		WARN_ON(*power_domain_mask & BIT_ULL(power_domain));
 		*power_domain_mask |= BIT_ULL(power_domain);
 
 		/*
@@ -9712,7 +9716,9 @@  static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 
 	power_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
 	if (intel_display_power_get_if_enabled(dev_priv, power_domain)) {
+		WARN_ON(power_domain_mask & BIT_ULL(power_domain));
 		power_domain_mask |= BIT_ULL(power_domain);
+
 		if (INTEL_GEN(dev_priv) >= 9)
 			skylake_get_pfit_config(crtc, pipe_config);
 		else

Comments

Mika Kuoppala Jan. 11, 2019, 1:47 p.m.
Chris Wilson <chris@chris-wilson.co.uk> writes:

> As we only release each power well once, we assume that each transcoder
> maps to a different domain. Complain if this is not so.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 36c56d1637b8..7c974cf064fd 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9569,6 +9569,8 @@ static bool hsw_get_transcoder_state(struct intel_crtc *crtc,
>  	power_domain = POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder);
>  	if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
>  		return false;
> +
> +	WARN_ON(*power_domain_mask & BIT_ULL(power_domain));
>  	*power_domain_mask |= BIT_ULL(power_domain);
>  
>  	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
> @@ -9596,6 +9598,8 @@ static bool bxt_get_dsi_transcoder_state(struct intel_crtc *crtc,
>  		power_domain = POWER_DOMAIN_TRANSCODER(cpu_transcoder);
>  		if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
>  			continue;
> +
> +		WARN_ON(*power_domain_mask & BIT_ULL(power_domain));
>  		*power_domain_mask |= BIT_ULL(power_domain);
>  
>  		/*
> @@ -9712,7 +9716,9 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
>  
>  	power_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
>  	if (intel_display_power_get_if_enabled(dev_priv, power_domain)) {
> +		WARN_ON(power_domain_mask & BIT_ULL(power_domain));
>  		power_domain_mask |= BIT_ULL(power_domain);
> +
>  		if (INTEL_GEN(dev_priv) >= 9)
>  			skylake_get_pfit_config(crtc, pipe_config);
>  		else
> -- 
> 2.20.1