[Intel-gfx] [PATCH 09/20] drm/i915: Don't use encoder->new_crtc in compute_baseline_pipe_bpp()

Daniel Vetter daniel at ffwll.ch
Thu Mar 26 09:51:13 PDT 2015


On Thu, Mar 26, 2015 at 05:46:22PM +0100, Daniel Vetter wrote:
> On Fri, Mar 20, 2015 at 04:18:09PM +0200, Ander Conselvan de Oliveira wrote:
> > Move towards atomic by using the legacy modeset's drm_atomic_state
> > instead.
> > 
> > Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 7851d6c..895cf67 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -10215,8 +10215,9 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc,
> >  			  struct intel_crtc_state *pipe_config)
> >  {
> >  	struct drm_device *dev = crtc->base.dev;
> > +	struct drm_atomic_state *state;
> >  	struct intel_connector *connector;
> > -	int bpp;
> > +	int bpp, i;
> >  
> >  	switch (fb->pixel_format) {
> >  	case DRM_FORMAT_C8:
> > @@ -10256,10 +10257,13 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc,
> >  
> >  	pipe_config->pipe_bpp = bpp;
> >  
> > +	state = pipe_config->base.state;
> > +
> >  	/* Clamp display bpp to EDID value */
> > -	for_each_intel_connector(dev, connector) {
> > -		if (!connector->new_encoder ||
> > -		    connector->new_encoder->new_crtc != crtc)
> > +	for (i = 0; i < state->num_connector; i++) {
> > +		connector = to_intel_connector(state->connectors[i]);
> > +		if (!connector ||
> 
> Bikeshed: I think we should have the !connector case as a separate one,
> since someone we should add a for_each_connector_in_state loop which
> integrates the continue. Frobbed while applying.

Even better justification: Checking state->connectors[i] is safer because
of the upcast.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list