diff mbox

[08/19] drm/i915: Don't use encoder->new_crtc in intel_modeset_pipe_config()

Message ID 1426240142-24538-9-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:48 a.m. UTC
Move towards atomic by using the legacy modeset's drm_atomic_state
instead.

v2: Move call to drm_atomic_add_affected_connectors() to
    intel_modeset_compute_config(). (Daniel)

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

Comments

Chandra Konduru March 19, 2015, 12:44 a.m. UTC | #1
> -----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 08/19] drm/i915: Don't use encoder->new_crtc in
> intel_modeset_pipe_config()
> 
> Move towards atomic by using the legacy modeset's drm_atomic_state instead.
> 
> v2: Move call to drm_atomic_add_affected_connectors() to
>     intel_modeset_compute_config(). (Daniel)
> 
> Signed-off-by: Ander Conselvan de Oliveira
> <ander.conselvan.de.oliveira@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index 6465f6d..1609628 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10435,8 +10435,11 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
> {
>  	struct drm_device *dev = crtc->dev;
>  	struct intel_encoder *encoder;
> +	struct intel_connector *connector;
> +	struct drm_connector_state *connector_state;
>  	struct intel_crtc_state *pipe_config;
>  	int plane_bpp, ret = -EINVAL;
> +	int i;
>  	bool retry = true;
> 
>  	if (!check_encoder_cloning(to_intel_crtc(crtc))) { @@ -10510,11
> +10513,17 @@ encoder_retry:
>  	 * adjust it according to limitations or connector properties, and also
>  	 * a chance to reject the mode entirely.
>  	 */
> -	for_each_intel_encoder(dev, encoder) {
> +	for (i = 0; i < state->num_connector; i++) {
> +		connector = to_intel_connector(state->connectors[i]);
> +		if (!connector)
> +			continue;
> 
> -		if (&encoder->new_crtc->base != crtc)
> +		connector_state = state->connector_states[i];
> +		if (connector_state->crtc != crtc)
>  			continue;
> 
> +		encoder = to_intel_encoder(connector_state->best_encoder);
> +
>  		if (!(encoder->compute_config(encoder, pipe_config))) {
>  			DRM_DEBUG_KMS("Encoder config failure\n");
>  			goto fail;
> @@ -11238,6 +11247,10 @@ intel_modeset_compute_config(struct drm_crtc
> *crtc,
>  	struct intel_crtc *intel_crtc;
>  	int ret = 0;
> 
> +	ret = drm_atomic_add_affected_connectors(state, crtc);

If the current transaction is started by DRM core, above operation 
will be added by core, right?
And when we move to full atomic_modeset, then above needs
to be deleted?

> +	if (ret)
> +		return ERR_PTR(ret);
> +
>  	intel_modeset_affected_pipes(crtc, modeset_pipes,
>  				     prepare_pipes, disable_pipes);
> 
> --
> 2.1.0
Ander Conselvan de Oliveira March 19, 2015, 7:52 a.m. UTC | #2
On Thu, 2015-03-19 at 00:44 +0000, Konduru, Chandra wrote:
> > -----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 08/19] drm/i915: Don't use encoder->new_crtc in
> > intel_modeset_pipe_config()
> > 
> > Move towards atomic by using the legacy modeset's drm_atomic_state instead.
> > 
> > v2: Move call to drm_atomic_add_affected_connectors() to
> >     intel_modeset_compute_config(). (Daniel)
> > 
> > Signed-off-by: Ander Conselvan de Oliveira
> > <ander.conselvan.de.oliveira@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++--
> >  1 file changed, 15 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c
> > b/drivers/gpu/drm/i915/intel_display.c
> > index 6465f6d..1609628 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -10435,8 +10435,11 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
> > {
> >  	struct drm_device *dev = crtc->dev;
> >  	struct intel_encoder *encoder;
> > +	struct intel_connector *connector;
> > +	struct drm_connector_state *connector_state;
> >  	struct intel_crtc_state *pipe_config;
> >  	int plane_bpp, ret = -EINVAL;
> > +	int i;
> >  	bool retry = true;
> > 
> >  	if (!check_encoder_cloning(to_intel_crtc(crtc))) { @@ -10510,11
> > +10513,17 @@ encoder_retry:
> >  	 * adjust it according to limitations or connector properties, and also
> >  	 * a chance to reject the mode entirely.
> >  	 */
> > -	for_each_intel_encoder(dev, encoder) {
> > +	for (i = 0; i < state->num_connector; i++) {
> > +		connector = to_intel_connector(state->connectors[i]);
> > +		if (!connector)
> > +			continue;
> > 
> > -		if (&encoder->new_crtc->base != crtc)
> > +		connector_state = state->connector_states[i];
> > +		if (connector_state->crtc != crtc)
> >  			continue;
> > 
> > +		encoder = to_intel_encoder(connector_state->best_encoder);
> > +
> >  		if (!(encoder->compute_config(encoder, pipe_config))) {
> >  			DRM_DEBUG_KMS("Encoder config failure\n");
> >  			goto fail;
> > @@ -11238,6 +11247,10 @@ intel_modeset_compute_config(struct drm_crtc
> > *crtc,
> >  	struct intel_crtc *intel_crtc;
> >  	int ret = 0;
> > 
> > +	ret = drm_atomic_add_affected_connectors(state, crtc);
> 
> If the current transaction is started by DRM core, above operation 
> will be added by core, right?
> And when we move to full atomic_modeset, then above needs
> to be deleted?

That call is done in drm_atomic_helper_check_modeset(), so after the
conversion, we won't need this call there. But calling it twice doesn't
have any ill-effects, so we can leave it there until this is all sorted
out.

Ander


> 
> > +	if (ret)
> > +		return ERR_PTR(ret);
> > +
> >  	intel_modeset_affected_pipes(crtc, modeset_pipes,
> >  				     prepare_pipes, disable_pipes);
> > 
> > --
> > 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 6465f6d..1609628 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10435,8 +10435,11 @@  intel_modeset_pipe_config(struct drm_crtc *crtc,
 {
 	struct drm_device *dev = crtc->dev;
 	struct intel_encoder *encoder;
+	struct intel_connector *connector;
+	struct drm_connector_state *connector_state;
 	struct intel_crtc_state *pipe_config;
 	int plane_bpp, ret = -EINVAL;
+	int i;
 	bool retry = true;
 
 	if (!check_encoder_cloning(to_intel_crtc(crtc))) {
@@ -10510,11 +10513,17 @@  encoder_retry:
 	 * adjust it according to limitations or connector properties, and also
 	 * a chance to reject the mode entirely.
 	 */
-	for_each_intel_encoder(dev, encoder) {
+	for (i = 0; i < state->num_connector; i++) {
+		connector = to_intel_connector(state->connectors[i]);
+		if (!connector)
+			continue;
 
-		if (&encoder->new_crtc->base != crtc)
+		connector_state = state->connector_states[i];
+		if (connector_state->crtc != crtc)
 			continue;
 
+		encoder = to_intel_encoder(connector_state->best_encoder);
+
 		if (!(encoder->compute_config(encoder, pipe_config))) {
 			DRM_DEBUG_KMS("Encoder config failure\n");
 			goto fail;
@@ -11238,6 +11247,10 @@  intel_modeset_compute_config(struct drm_crtc *crtc,
 	struct intel_crtc *intel_crtc;
 	int ret = 0;
 
+	ret = drm_atomic_add_affected_connectors(state, crtc);
+	if (ret)
+		return ERR_PTR(ret);
+
 	intel_modeset_affected_pipes(crtc, modeset_pipes,
 				     prepare_pipes, disable_pipes);