diff mbox

[v2,6/6] drm/atomic: Clean up steal_encoder

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

Commit Message

Maarten Lankhorst Feb. 24, 2016, 8:37 a.m. UTC
Now that only encoders can be stolen that are part of the state
steal_encoder no longer needs to inspect all connectors,
just those that are part of the atomic state.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Comments

Ville Syrjälä March 2, 2016, 5:32 p.m. UTC | #1
On Wed, Feb 24, 2016 at 09:37:33AM +0100, Maarten Lankhorst wrote:
> Now that only encoders can be stolen that are part of the state
> steal_encoder no longer needs to inspect all connectors,
> just those that are part of the atomic state.

steal_encoder() can no longer fail after this, so should clean up the
caller a bit too I think.

> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 32bd5bebef0b..0fc56339001d 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -215,18 +215,11 @@ steal_encoder(struct drm_atomic_state *state,
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_connector *connector;
>  	struct drm_connector_state *connector_state;
> +	int i;
>  
> -	drm_for_each_connector(connector, state->dev) {
> +	for_each_connector_in_state(state, connector, connector_state, i) {
>  		struct drm_crtc *encoder_crtc;
>  
> -		if (connector->state->best_encoder != encoder)
> -			continue;
> -
> -		connector_state = drm_atomic_get_connector_state(state,
> -								 connector);
> -		if (IS_ERR(connector_state))
> -			return PTR_ERR(connector_state);
> -
>  		if (connector_state->best_encoder != encoder ||
>  		    WARN_ON(!connector_state->crtc))
>  			continue;
> -- 
> 2.1.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Ville Syrjälä March 2, 2016, 5:36 p.m. UTC | #2
On Wed, Mar 02, 2016 at 07:32:30PM +0200, Ville Syrjälä wrote:
> On Wed, Feb 24, 2016 at 09:37:33AM +0100, Maarten Lankhorst wrote:
> > Now that only encoders can be stolen that are part of the state
> > steal_encoder no longer needs to inspect all connectors,
> > just those that are part of the atomic state.
> 
> steal_encoder() can no longer fail after this, so should clean up the
> caller a bit too I think.

Oh and maybe it should be called something different? We've sort of done
the stealing part already, so I think the only thing we have left to do
here is clean up the stale best_encoder pointers.

> 
> > 
> > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 11 ++---------
> >  1 file changed, 2 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index 32bd5bebef0b..0fc56339001d 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -215,18 +215,11 @@ steal_encoder(struct drm_atomic_state *state,
> >  	struct drm_crtc_state *crtc_state;
> >  	struct drm_connector *connector;
> >  	struct drm_connector_state *connector_state;
> > +	int i;
> >  
> > -	drm_for_each_connector(connector, state->dev) {
> > +	for_each_connector_in_state(state, connector, connector_state, i) {
> >  		struct drm_crtc *encoder_crtc;
> >  
> > -		if (connector->state->best_encoder != encoder)
> > -			continue;
> > -
> > -		connector_state = drm_atomic_get_connector_state(state,
> > -								 connector);
> > -		if (IS_ERR(connector_state))
> > -			return PTR_ERR(connector_state);
> > -
> >  		if (connector_state->best_encoder != encoder ||
> >  		    WARN_ON(!connector_state->crtc))
> >  			continue;
> > -- 
> > 2.1.0
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 32bd5bebef0b..0fc56339001d 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -215,18 +215,11 @@  steal_encoder(struct drm_atomic_state *state,
 	struct drm_crtc_state *crtc_state;
 	struct drm_connector *connector;
 	struct drm_connector_state *connector_state;
+	int i;
 
-	drm_for_each_connector(connector, state->dev) {
+	for_each_connector_in_state(state, connector, connector_state, i) {
 		struct drm_crtc *encoder_crtc;
 
-		if (connector->state->best_encoder != encoder)
-			continue;
-
-		connector_state = drm_atomic_get_connector_state(state,
-								 connector);
-		if (IS_ERR(connector_state))
-			return PTR_ERR(connector_state);
-
 		if (connector_state->best_encoder != encoder ||
 		    WARN_ON(!connector_state->crtc))
 			continue;