[PATCH 4/9] drm/i915: Avoid div-by-zero when computing aux_stride w/o an aux plane

Imre Deak imre.deak at intel.com
Thu Feb 2 13:38:20 UTC 2017


On Wed, Jan 04, 2017 at 08:42:27PM +0200, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> To make life easier let's allow skl_plane_stride() to be called for the
> AUX surface even when there is no AUX surface. Avoids special cases in
> the callers.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

Reviewed-by: Imre Deak <imre.deak at intel.com>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 4d514ca1da88..bc398743e941 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3261,7 +3261,12 @@ static void skl_detach_scalers(struct intel_crtc *intel_crtc)
>  u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
>  		     unsigned int rotation)
>  {
> -	u32 stride = intel_fb_pitch(fb, plane, rotation);
> +	u32 stride;
> +
> +	if (plane >= fb->format->num_planes)
> +		return 0;
> +
> +	stride = intel_fb_pitch(fb, plane, rotation);
>  
>  	/*
>  	 * The stride is either expressed as a multiple of 64 bytes chunks for
> -- 
> 2.10.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list