[v2,08/12] drm/i915: Remove connectors_active from sanitization.
diff mbox

Message ID 1438000541-3219-9-git-send-email-maarten.lankhorst@linux.intel.com
State New
Headers show

Commit Message

Maarten Lankhorst July 27, 2015, 12:35 p.m. UTC
connectors_active will be removed, so just calculate this right here.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Ander Conselvan de Oliveira July 29, 2015, 1:09 p.m. UTC | #1
On Mon, 2015-07-27 at 14:35 +0200, Maarten Lankhorst wrote:
> connectors_active will be removed, so just calculate this right here.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index ed9eba2666e2..341fadb40c81 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14935,8 +14935,10 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
>  	/* Adjust the state of the output pipe according to whether we
>  	 * have active connectors/encoders. */
>  	enable = false;
> -	for_each_encoder_on_crtc(dev, &crtc->base, encoder)
> -		enable |= encoder->connectors_active;
> +	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
> +		enable = true;
> +		break;
> +	}
>  
>  	if (!enable)
>  		intel_crtc_disable_noatomic(&crtc->base);
> @@ -14992,6 +14994,7 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>  {
>  	struct intel_connector *connector;
>  	struct drm_device *dev = encoder->base.dev;
> +	bool active = false;
>  
>  	/* We need to check both for a crtc link (meaning that the
>  	 * encoder is active and trying to read from a pipe) and the
> @@ -14999,7 +15002,15 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>  	bool has_active_crtc = encoder->base.crtc &&
>  		to_intel_crtc(encoder->base.crtc)->active;
>  
> -	if (encoder->connectors_active && !has_active_crtc) {
> +	for_each_intel_connector(dev, connector) {
> +		if (connector->encoder != encoder)

Shouldn't this be connector->base.encoder?

Ander
Maarten Lankhorst July 30, 2015, 7:11 a.m. UTC | #2
Op 29-07-15 om 15:09 schreef Ander Conselvan De Oliveira:
> On Mon, 2015-07-27 at 14:35 +0200, Maarten Lankhorst wrote:
>> connectors_active will be removed, so just calculate this right here.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_display.c | 17 ++++++++++++++---
>>  1 file changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>> index ed9eba2666e2..341fadb40c81 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -14935,8 +14935,10 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
>>  	/* Adjust the state of the output pipe according to whether we
>>  	 * have active connectors/encoders. */
>>  	enable = false;
>> -	for_each_encoder_on_crtc(dev, &crtc->base, encoder)
>> -		enable |= encoder->connectors_active;
>> +	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
>> +		enable = true;
>> +		break;
>> +	}
>>  
>>  	if (!enable)
>>  		intel_crtc_disable_noatomic(&crtc->base);
>> @@ -14992,6 +14994,7 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>>  {
>>  	struct intel_connector *connector;
>>  	struct drm_device *dev = encoder->base.dev;
>> +	bool active = false;
>>  
>>  	/* We need to check both for a crtc link (meaning that the
>>  	 * encoder is active and trying to read from a pipe) and the
>> @@ -14999,7 +15002,15 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>>  	bool has_active_crtc = encoder->base.crtc &&
>>  		to_intel_crtc(encoder->base.crtc)->active;
>>  
>> -	if (encoder->connectors_active && !has_active_crtc) {
>> +	for_each_intel_connector(dev, connector) {
>> +		if (connector->encoder != encoder)
> Shouldn't this be connector->base.encoder?
>
> Ander
Well ideally connector->state->best_encoder, but yeah looks like we haven't set that up here yet, so connector->base.encoder is probably the right member to check..

~Maarten

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ed9eba2666e2..341fadb40c81 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14935,8 +14935,10 @@  static void intel_sanitize_crtc(struct intel_crtc *crtc)
 	/* Adjust the state of the output pipe according to whether we
 	 * have active connectors/encoders. */
 	enable = false;
-	for_each_encoder_on_crtc(dev, &crtc->base, encoder)
-		enable |= encoder->connectors_active;
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		enable = true;
+		break;
+	}
 
 	if (!enable)
 		intel_crtc_disable_noatomic(&crtc->base);
@@ -14992,6 +14994,7 @@  static void intel_sanitize_encoder(struct intel_encoder *encoder)
 {
 	struct intel_connector *connector;
 	struct drm_device *dev = encoder->base.dev;
+	bool active = false;
 
 	/* We need to check both for a crtc link (meaning that the
 	 * encoder is active and trying to read from a pipe) and the
@@ -14999,7 +15002,15 @@  static void intel_sanitize_encoder(struct intel_encoder *encoder)
 	bool has_active_crtc = encoder->base.crtc &&
 		to_intel_crtc(encoder->base.crtc)->active;
 
-	if (encoder->connectors_active && !has_active_crtc) {
+	for_each_intel_connector(dev, connector) {
+		if (connector->encoder != encoder)
+			continue;
+
+		active = true;
+		break;
+	}
+
+	if (active && !has_active_crtc) {
 		DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no active pipe!\n",
 			      encoder->base.base.id,
 			      encoder->base.name);