diff mbox

[11/23] drm/i915: Copy the staged connector config to the legacy atomic state

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

Commit Message

Ander Conselvan de Oliveira March 3, 2015, 1:22 p.m. UTC
With this in place, we can start converting pieces of the modeset code
to look at the connector atomic state instead of the staged config.

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

Comments

Daniel Vetter March 4, 2015, 3:46 p.m. UTC | #1
On Tue, Mar 03, 2015 at 03:22:05PM +0200, Ander Conselvan de Oliveira wrote:
> With this in place, we can start converting pieces of the modeset code
> to look at the connector atomic state instead of the staged config.
> 
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 108d3d2..4e90cb4 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11607,9 +11607,11 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
>  static int
>  intel_modeset_stage_output_state(struct drm_device *dev,
>  				 struct drm_mode_set *set,
> -				 struct intel_set_config *config)
> +				 struct intel_set_config *config,
> +				 struct drm_atomic_state *state)
>  {
>  	struct intel_connector *connector;
> +	struct drm_connector_state *connector_state;
>  	struct intel_encoder *encoder;
>  	struct intel_crtc *crtc;
>  	int ro;
> @@ -11673,6 +11675,14 @@ intel_modeset_stage_output_state(struct drm_device *dev,
>  		}
>  		connector->new_encoder->new_crtc = to_intel_crtc(new_crtc);
>  
> +		connector_state =
> +			drm_atomic_get_connector_state(state, &connector->base);
> +		if (IS_ERR(connector_state))
> +			return PTR_ERR(connector_state);
> +
> +		connector_state->crtc = new_crtc;
> +		connector_state->best_encoder = &connector->new_encoder->base;
> +
>  		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d]\n",
>  			connector->base.base.id,
>  			connector->base.name,
> @@ -11705,9 +11715,16 @@ intel_modeset_stage_output_state(struct drm_device *dev,
>  	}
>  	/* Now we've also updated encoder->new_crtc for all encoders. */
>  	for_each_intel_connector(dev, connector) {
> -		if (connector->new_encoder)
> +		connector_state =
> +			drm_atomic_get_connector_state(state, &connector->base);
> +
> +		if (connector->new_encoder) {
>  			if (connector->new_encoder != connector->encoder)
>  				connector->encoder = connector->new_encoder;
> +		} else {
> +			connector_state->crtc = NULL;
> +		}
> +

Unecessary line. Of course you've put that in there to check that I
actually read your patches ;-)

Cheers, Daniel

>  	}
>  	for_each_intel_crtc(dev, crtc) {
>  		crtc->new_enabled = false;
> @@ -11816,7 +11833,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
>  
>  	state->acquire_ctx = dev->mode_config.acquire_ctx;
>  
> -	ret = intel_modeset_stage_output_state(dev, set, config);
> +	ret = intel_modeset_stage_output_state(dev, set, config, state);
>  	if (ret)
>  		goto fail;
>  
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ander Conselvan de Oliveira March 4, 2015, 4:58 p.m. UTC | #2
On Wed, 2015-03-04 at 16:46 +0100, Daniel Vetter wrote:
> On Tue, Mar 03, 2015 at 03:22:05PM +0200, Ander Conselvan de Oliveira wrote:

> > With this in place, we can start converting pieces of the modeset code

> > to look at the connector atomic state instead of the staged config.

> > 

> > Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>

> > ---

> >  drivers/gpu/drm/i915/intel_display.c | 23 ++++++++++++++++++++---

> >  1 file changed, 20 insertions(+), 3 deletions(-)

> > 

> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c

> > index 108d3d2..4e90cb4 100644

> > --- a/drivers/gpu/drm/i915/intel_display.c

> > +++ b/drivers/gpu/drm/i915/intel_display.c

> > @@ -11607,9 +11607,11 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,

> >  static int

> >  intel_modeset_stage_output_state(struct drm_device *dev,

> >  				 struct drm_mode_set *set,

> > -				 struct intel_set_config *config)

> > +				 struct intel_set_config *config,

> > +				 struct drm_atomic_state *state)

> >  {

> >  	struct intel_connector *connector;

> > +	struct drm_connector_state *connector_state;

> >  	struct intel_encoder *encoder;

> >  	struct intel_crtc *crtc;

> >  	int ro;

> > @@ -11673,6 +11675,14 @@ intel_modeset_stage_output_state(struct drm_device *dev,

> >  		}

> >  		connector->new_encoder->new_crtc = to_intel_crtc(new_crtc);

> >  

> > +		connector_state =

> > +			drm_atomic_get_connector_state(state, &connector->base);

> > +		if (IS_ERR(connector_state))

> > +			return PTR_ERR(connector_state);

> > +

> > +		connector_state->crtc = new_crtc;

> > +		connector_state->best_encoder = &connector->new_encoder->base;

> > +

> >  		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d]\n",

> >  			connector->base.base.id,

> >  			connector->base.name,

> > @@ -11705,9 +11715,16 @@ intel_modeset_stage_output_state(struct drm_device *dev,

> >  	}

> >  	/* Now we've also updated encoder->new_crtc for all encoders. */

> >  	for_each_intel_connector(dev, connector) {

> > -		if (connector->new_encoder)

> > +		connector_state =

> > +			drm_atomic_get_connector_state(state, &connector->base);

> > +

> > +		if (connector->new_encoder) {

> >  			if (connector->new_encoder != connector->encoder)

> >  				connector->encoder = connector->new_encoder;

> > +		} else {

> > +			connector_state->crtc = NULL;

> > +		}

> > +

> 

> Unecessary line. Of course you've put that in there to check that I

> actually read your patches ;-)


It actually is needed, since the other hunk we only update the
connector's crtc when it has an enabled connector. It makes sense for
the staged config, since the new_crtc field is in the encoder, which
would be NULL in that case. The loop just above this one sets new_crtc
to NULL for these encoders, but for the connectors it was just more
convenient to set it here.

Ander

> 

> Cheers, Daniel

> 

> >  	}

> >  	for_each_intel_crtc(dev, crtc) {

> >  		crtc->new_enabled = false;

> > @@ -11816,7 +11833,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set)

> >  

> >  	state->acquire_ctx = dev->mode_config.acquire_ctx;

> >  

> > -	ret = intel_modeset_stage_output_state(dev, set, config);

> > +	ret = intel_modeset_stage_output_state(dev, set, config, state);

> >  	if (ret)

> >  		goto fail;

> >  

> > -- 

> > 2.1.0

> > 

> > _______________________________________________

> > Intel-gfx mailing list

> > Intel-gfx@lists.freedesktop.org

> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx

> 


---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
Daniel Vetter March 4, 2015, 5:51 p.m. UTC | #3
On Wed, Mar 4, 2015 at 5:58 PM, Conselvan De Oliveira, Ander
<ander.conselvan.de.oliveira@intel.com> wrote:
>> > +

I meant this empty line between 2 closing braces ;-)
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 108d3d2..4e90cb4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11607,9 +11607,11 @@  intel_set_config_compute_mode_changes(struct drm_mode_set *set,
 static int
 intel_modeset_stage_output_state(struct drm_device *dev,
 				 struct drm_mode_set *set,
-				 struct intel_set_config *config)
+				 struct intel_set_config *config,
+				 struct drm_atomic_state *state)
 {
 	struct intel_connector *connector;
+	struct drm_connector_state *connector_state;
 	struct intel_encoder *encoder;
 	struct intel_crtc *crtc;
 	int ro;
@@ -11673,6 +11675,14 @@  intel_modeset_stage_output_state(struct drm_device *dev,
 		}
 		connector->new_encoder->new_crtc = to_intel_crtc(new_crtc);
 
+		connector_state =
+			drm_atomic_get_connector_state(state, &connector->base);
+		if (IS_ERR(connector_state))
+			return PTR_ERR(connector_state);
+
+		connector_state->crtc = new_crtc;
+		connector_state->best_encoder = &connector->new_encoder->base;
+
 		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d]\n",
 			connector->base.base.id,
 			connector->base.name,
@@ -11705,9 +11715,16 @@  intel_modeset_stage_output_state(struct drm_device *dev,
 	}
 	/* Now we've also updated encoder->new_crtc for all encoders. */
 	for_each_intel_connector(dev, connector) {
-		if (connector->new_encoder)
+		connector_state =
+			drm_atomic_get_connector_state(state, &connector->base);
+
+		if (connector->new_encoder) {
 			if (connector->new_encoder != connector->encoder)
 				connector->encoder = connector->new_encoder;
+		} else {
+			connector_state->crtc = NULL;
+		}
+
 	}
 	for_each_intel_crtc(dev, crtc) {
 		crtc->new_enabled = false;
@@ -11816,7 +11833,7 @@  static int intel_crtc_set_config(struct drm_mode_set *set)
 
 	state->acquire_ctx = dev->mode_config.acquire_ctx;
 
-	ret = intel_modeset_stage_output_state(dev, set, config);
+	ret = intel_modeset_stage_output_state(dev, set, config, state);
 	if (ret)
 		goto fail;