[Intel-gfx] [v2 4/6] drm/i915/skl+: Use scaling amount for plane data rate calculation

Daniel Vetter daniel at ffwll.ch
Thu Feb 11 08:43:28 UTC 2016


On Wed, Feb 10, 2016 at 11:39:41AM -0800, Matt Roper wrote:
> On Wed, Jan 27, 2016 at 09:40:01PM +0530, Shobhit Kumar wrote:
> > From: "Kumar, Mahesh" <mahesh1.kumar at intel.com>
> > 
> > if downscaling is enabled plane data rate increases according to scaling
> > amount. take scaling amount under consideration while calculating plane
> > data rate
> > 
> > v2: Address Matt's comments, where data rate was overridden because of
> > missing else.
> > 
> > Cc: matthew.d.roper at intel.com
> > Signed-off-by: Kumar, Mahesh <mahesh1.kumar at intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c | 17 ++++++++++++-----
> >  1 file changed, 12 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 40fff09..a9f9396 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -2912,6 +2912,8 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
> >  {
> >  	struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
> >  	struct drm_framebuffer *fb = pstate->fb;
> > +	struct intel_plane *intel_plane = to_intel_plane(pstate->plane);
> > +	uint32_t down_scale_amount, data_rate;
> >  	uint32_t width = 0, height = 0;
> >  
> >  	width = drm_rect_width(&intel_pstate->src) >> 16;
> > @@ -2923,15 +2925,20 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
> >  	/* for planar format */
> >  	if (fb->pixel_format == DRM_FORMAT_NV12) {
> >  		if (y)  /* y-plane data rate */
> > -			return width * height *
> > +			data_rate = width * height *
> >  				drm_format_plane_cpp(fb->pixel_format, 0);
> >  		else    /* uv-plane data rate */
> > -			return (width / 2) * (height / 2) *
> > +			data_rate = (width / 2) * (height / 2) *
> >  				drm_format_plane_cpp(fb->pixel_format, 1);
> > -	}
> > +	} else
> > +		/* for packed formats */
> > +		data_rate = width * height *
> > +			drm_format_plane_cpp(fb->pixel_format, 0);
> 
> According to the coding style, I believe we're supposed to use braces
> for both branches if either one of them needs braces.

Yes, and definitely when the other branch spans more than 1 line.
-Daniel

> 
> Aside from that,
> 
> Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
> 
> > +
> > +	down_scale_amount = skl_plane_downscale_amount(intel_plane);
> > +
> > +	return DIV_ROUND_UP((data_rate * down_scale_amount), 1000);
> >  
> > -	/* for packed formats */
> > -	return width * height * drm_format_plane_cpp(fb->pixel_format, 0);
> >  }
> >  
> >  /*
> > -- 
> > 2.5.0
> > 
> 
> -- 
> Matt Roper
> Graphics Software Engineer
> IoTG Platform Enabling & Development
> Intel Corporation
> (916) 356-2795

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list