diff mbox

[6/9] drm/i915: Update connector_mask during readout.

Message ID 1448357676-27837-7-git-send-email-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maarten Lankhorst Nov. 24, 2015, 9:34 a.m. UTC
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Daniel Vetter Nov. 24, 2015, 10:38 a.m. UTC | #1
On Tue, Nov 24, 2015 at 10:34:33AM +0100, Maarten Lankhorst wrote:
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index dcc7ec7665c2..21b1984e828b 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -15309,6 +15309,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
>  		WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, NULL) < 0);
>  		crtc->base.state->active = crtc->active;
>  		crtc->base.enabled = crtc->active;
> +		crtc->base.state->connector_mask = 0;
>  
>  		/* Because we only establish the connector -> encoder ->
>  		 * crtc links if something is active, this means the
> @@ -15344,20 +15345,24 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>  {
>  	struct intel_connector *connector;
>  	struct drm_device *dev = encoder->base.dev;
> +	struct drm_crtc *crtc = encoder->base.crtc;
>  	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
>  	 * pipe itself being active. */
> -	bool has_active_crtc = encoder->base.crtc &&
> -		to_intel_crtc(encoder->base.crtc)->active;
> +	bool has_active_crtc = crtc && crtc->state->active;
>  
>  	for_each_intel_connector(dev, connector) {
>  		if (connector->base.encoder != &encoder->base)
>  			continue;
>  
>  		active = true;
> -		break;
> +		if (!has_active_crtc)
> +			break;
> +
> +		crtc->state->connector_mask |=
> +			1 << drm_connector_index(&connector->base);

We might want to use the official set_crtc_for_connector/plane in all our
hw state readout code. Is that possible? Would be perfect as a prep patch.
-Daniel

>  	}
>  
>  	if (active && !has_active_crtc) {
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst Nov. 24, 2015, 11:30 a.m. UTC | #2
Op 24-11-15 om 11:38 schreef Daniel Vetter:
> On Tue, Nov 24, 2015 at 10:34:33AM +0100, Maarten Lankhorst wrote:
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_display.c | 11 ++++++++---
>>  1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>> index dcc7ec7665c2..21b1984e828b 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -15309,6 +15309,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
>>  		WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, NULL) < 0);
>>  		crtc->base.state->active = crtc->active;
>>  		crtc->base.enabled = crtc->active;
>> +		crtc->base.state->connector_mask = 0;
>>  
>>  		/* Because we only establish the connector -> encoder ->
>>  		 * crtc links if something is active, this means the
>> @@ -15344,20 +15345,24 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>>  {
>>  	struct intel_connector *connector;
>>  	struct drm_device *dev = encoder->base.dev;
>> +	struct drm_crtc *crtc = encoder->base.crtc;
>>  	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
>>  	 * pipe itself being active. */
>> -	bool has_active_crtc = encoder->base.crtc &&
>> -		to_intel_crtc(encoder->base.crtc)->active;
>> +	bool has_active_crtc = crtc && crtc->state->active;
>>  
>>  	for_each_intel_connector(dev, connector) {
>>  		if (connector->base.encoder != &encoder->base)
>>  			continue;
>>  
>>  		active = true;
>> -		break;
>> +		if (!has_active_crtc)
>> +			break;
>> +
>> +		crtc->state->connector_mask |=
>> +			1 << drm_connector_index(&connector->base);
> We might want to use the official set_crtc_for_connector/plane in all our
> hw state readout code. Is that possible? Would be perfect as a prep patch.
>
No, unfortunately that needs the full atomic state because it calls drm_atomic_get_crtc_state.

~Maarten
Thierry Reding Dec. 7, 2015, 10:36 a.m. UTC | #3
On Tue, Nov 24, 2015 at 10:34:33AM +0100, Maarten Lankhorst wrote:
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index dcc7ec7665c2..21b1984e828b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15309,6 +15309,7 @@  static void intel_sanitize_crtc(struct intel_crtc *crtc)
 		WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, NULL) < 0);
 		crtc->base.state->active = crtc->active;
 		crtc->base.enabled = crtc->active;
+		crtc->base.state->connector_mask = 0;
 
 		/* Because we only establish the connector -> encoder ->
 		 * crtc links if something is active, this means the
@@ -15344,20 +15345,24 @@  static void intel_sanitize_encoder(struct intel_encoder *encoder)
 {
 	struct intel_connector *connector;
 	struct drm_device *dev = encoder->base.dev;
+	struct drm_crtc *crtc = encoder->base.crtc;
 	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
 	 * pipe itself being active. */
-	bool has_active_crtc = encoder->base.crtc &&
-		to_intel_crtc(encoder->base.crtc)->active;
+	bool has_active_crtc = crtc && crtc->state->active;
 
 	for_each_intel_connector(dev, connector) {
 		if (connector->base.encoder != &encoder->base)
 			continue;
 
 		active = true;
-		break;
+		if (!has_active_crtc)
+			break;
+
+		crtc->state->connector_mask |=
+			1 << drm_connector_index(&connector->base);
 	}
 
 	if (active && !has_active_crtc) {