diff mbox

[19/19] drm/i915: Remove usage of encoder->new_crtc from clock computations

Message ID 1426240142-24538-20-git-send-email-ander.conselvan.de.oliveira@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ander Conselvan de Oliveira March 13, 2015, 9:49 a.m. UTC
Some of the crtc_compute_clock() still depended on encoder->new_crtc
since they didn't use intel_pipe_will_have_type() and used an open
coded version of that function instead. This patch replaces those with
the appropriate code that checks the atomic state intead.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 45 +++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 13 deletions(-)

Comments

Shuang He March 14, 2015, 12:29 a.m. UTC | #1
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 5946
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                                  276/276              276/276
ILK                 -6              303/303              297/303
SNB                                  279/279              279/279
IVB                                  343/343              343/343
BYT                                  287/287              287/287
HSW                 -1              363/363              362/363
BDW                                  308/308              308/308
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*ILK  igt_drv_suspend_debugfs-reader      PASS(2)      DMESG_WARN(2)
*ILK  igt_drv_suspend_fence-restore-tiled2untiled      PASS(2)      DMESG_WARN(1)
*ILK  igt_drv_suspend_fence-restore-untiled      PASS(2)      DMESG_WARN(2)
*ILK  igt_drv_suspend_forcewake      PASS(2)      DMESG_WARN(2)
*ILK  igt_gem_workarounds_suspend-resume      PASS(2)      DMESG_WARN(2)
*ILK  igt_kms_flip_blocking-absolute-wf_vblank-interruptible      PASS(2)      DMESG_FAIL(2)
*HSW  igt_gem_pwrite_pread_snooped-copy-performance      PASS(2)      DMESG_WARN(1)PASS(1)
Note: You need to pay more attention to line start with '*'
Chandra Konduru March 19, 2015, 8:39 p.m. UTC | #2
> -----Original Message-----
> From: Conselvan De Oliveira, Ander
> Sent: Friday, March 13, 2015 2:49 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: Konduru, Chandra; Conselvan De Oliveira, Ander
> Subject: [PATCH 19/19] drm/i915: Remove usage of encoder->new_crtc from
> clock computations
> 
> Some of the crtc_compute_clock() still depended on encoder->new_crtc since
> they didn't use intel_pipe_will_have_type() and used an open coded version of
> that function instead. This patch replaces those with the appropriate code that
> checks the atomic state intead.
> 
> Signed-off-by: Ander Conselvan de Oliveira
> <ander.conselvan.de.oliveira@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 45 +++++++++++++++++++++++++--------
> ---
>  1 file changed, 32 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index be1979e..35ed651 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6696,11 +6696,18 @@ static int i9xx_crtc_compute_clock(struct intel_crtc
> *crtc,
>  	bool is_lvds = false, is_dsi = false;
>  	struct intel_encoder *encoder;
>  	const intel_limit_t *limit;
> +	struct drm_atomic_state *state = crtc_state->base.state;
> +	struct drm_connector_state *connector_state;
> +	int i;
> 
> -	for_each_intel_encoder(dev, encoder) {
> -		if (encoder->new_crtc != crtc)
> +	for (i = 0; i < state->num_connector; i++) {
> +		connector_state = state->connector_states[i];
> +		if (!state->connectors[i] ||
> +		    connector_state->crtc != &crtc->base)
>  			continue;
> 
> +		encoder = to_intel_encoder(connector_state->best_encoder);
> +
>  		switch (encoder->type) {
>  		case INTEL_OUTPUT_LVDS:
>  			is_lvds = true;
> @@ -7374,18 +7381,24 @@ void intel_init_pch_refclk(struct drm_device *dev)
>  		lpt_init_pch_refclk(dev);
>  }
> 
> -static int ironlake_get_refclk(struct drm_crtc *crtc)
> +static int ironlake_get_refclk(struct intel_crtc_state *crtc_state)
>  {
> -	struct drm_device *dev = crtc->dev;
> +	struct drm_device *dev = crtc_state->base.crtc->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct drm_atomic_state *state = crtc_state->base.state;
> +	struct drm_connector_state *connector_state;
>  	struct intel_encoder *encoder;
> -	int num_connectors = 0;
> +	int num_connectors = 0, i;
>  	bool is_lvds = false;
> 
> -	for_each_intel_encoder(dev, encoder) {
> -		if (encoder->new_crtc != to_intel_crtc(crtc))
> +	for (i = 0; i < state->num_connector; i++) {
> +		connector_state = state->connector_states[i];
> +		if (!state->connectors[i] ||
> +		    connector_state->crtc != crtc_state->base.crtc)
>  			continue;
> 
> +		encoder = to_intel_encoder(connector_state->best_encoder);
> +

Couple more occurrences looping through state->connectors[], 
can be replaced with a helper function returning connector_state.

>  		switch (encoder->type) {
>  		case INTEL_OUTPUT_LVDS:
>  			is_lvds = true;
> @@ -7578,7 +7591,7 @@ static bool ironlake_compute_clocks(struct drm_crtc
> *crtc,
> 
>  	is_lvds = intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS);
> 
> -	refclk = ironlake_get_refclk(crtc);
> +	refclk = ironlake_get_refclk(crtc_state);
> 
>  	/*
>  	 * Returns a set of divisors for the desired target clock with the given
> @@ -7633,16 +7646,22 @@ static uint32_t ironlake_compute_dpll(struct
> intel_crtc *intel_crtc,
>  	struct drm_crtc *crtc = &intel_crtc->base;
>  	struct drm_device *dev = crtc->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct intel_encoder *intel_encoder;
> +	struct drm_atomic_state *state = crtc_state->base.state;
> +	struct drm_connector_state *connector_state;
> +	struct intel_encoder *encoder;
>  	uint32_t dpll;
> -	int factor, num_connectors = 0;
> +	int factor, num_connectors = 0, i;
>  	bool is_lvds = false, is_sdvo = false;
> 
> -	for_each_intel_encoder(dev, intel_encoder) {
> -		if (intel_encoder->new_crtc != to_intel_crtc(crtc))
> +	for (i = 0; i < state->num_connector; i++) {
> +		connector_state = state->connector_states[i];
> +		if (!state->connectors[i] ||
> +		    connector_state->crtc != crtc_state->base.crtc)
>  			continue;
> 
> -		switch (intel_encoder->type) {
> +		encoder = to_intel_encoder(connector_state->best_encoder);
> +
> +		switch (encoder->type) {
>  		case INTEL_OUTPUT_LVDS:
>  			is_lvds = true;
>  			break;
> --
> 2.1.0
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index be1979e..35ed651 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6696,11 +6696,18 @@  static int i9xx_crtc_compute_clock(struct intel_crtc *crtc,
 	bool is_lvds = false, is_dsi = false;
 	struct intel_encoder *encoder;
 	const intel_limit_t *limit;
+	struct drm_atomic_state *state = crtc_state->base.state;
+	struct drm_connector_state *connector_state;
+	int i;
 
-	for_each_intel_encoder(dev, encoder) {
-		if (encoder->new_crtc != crtc)
+	for (i = 0; i < state->num_connector; i++) {
+		connector_state = state->connector_states[i];
+		if (!state->connectors[i] ||
+		    connector_state->crtc != &crtc->base)
 			continue;
 
+		encoder = to_intel_encoder(connector_state->best_encoder);
+
 		switch (encoder->type) {
 		case INTEL_OUTPUT_LVDS:
 			is_lvds = true;
@@ -7374,18 +7381,24 @@  void intel_init_pch_refclk(struct drm_device *dev)
 		lpt_init_pch_refclk(dev);
 }
 
-static int ironlake_get_refclk(struct drm_crtc *crtc)
+static int ironlake_get_refclk(struct intel_crtc_state *crtc_state)
 {
-	struct drm_device *dev = crtc->dev;
+	struct drm_device *dev = crtc_state->base.crtc->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_atomic_state *state = crtc_state->base.state;
+	struct drm_connector_state *connector_state;
 	struct intel_encoder *encoder;
-	int num_connectors = 0;
+	int num_connectors = 0, i;
 	bool is_lvds = false;
 
-	for_each_intel_encoder(dev, encoder) {
-		if (encoder->new_crtc != to_intel_crtc(crtc))
+	for (i = 0; i < state->num_connector; i++) {
+		connector_state = state->connector_states[i];
+		if (!state->connectors[i] ||
+		    connector_state->crtc != crtc_state->base.crtc)
 			continue;
 
+		encoder = to_intel_encoder(connector_state->best_encoder);
+
 		switch (encoder->type) {
 		case INTEL_OUTPUT_LVDS:
 			is_lvds = true;
@@ -7578,7 +7591,7 @@  static bool ironlake_compute_clocks(struct drm_crtc *crtc,
 
 	is_lvds = intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS);
 
-	refclk = ironlake_get_refclk(crtc);
+	refclk = ironlake_get_refclk(crtc_state);
 
 	/*
 	 * Returns a set of divisors for the desired target clock with the given
@@ -7633,16 +7646,22 @@  static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,
 	struct drm_crtc *crtc = &intel_crtc->base;
 	struct drm_device *dev = crtc->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_encoder *intel_encoder;
+	struct drm_atomic_state *state = crtc_state->base.state;
+	struct drm_connector_state *connector_state;
+	struct intel_encoder *encoder;
 	uint32_t dpll;
-	int factor, num_connectors = 0;
+	int factor, num_connectors = 0, i;
 	bool is_lvds = false, is_sdvo = false;
 
-	for_each_intel_encoder(dev, intel_encoder) {
-		if (intel_encoder->new_crtc != to_intel_crtc(crtc))
+	for (i = 0; i < state->num_connector; i++) {
+		connector_state = state->connector_states[i];
+		if (!state->connectors[i] ||
+		    connector_state->crtc != crtc_state->base.crtc)
 			continue;
 
-		switch (intel_encoder->type) {
+		encoder = to_intel_encoder(connector_state->best_encoder);
+
+		switch (encoder->type) {
 		case INTEL_OUTPUT_LVDS:
 			is_lvds = true;
 			break;