]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/i915: Avoid div-by-zero when computing aux_stride w/o an aux plane
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 7 Mar 2017 19:42:08 +0000 (21:42 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 8 Mar 2017 14:44:03 +0000 (16:44 +0200)
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@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170307194210.13400-4-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/intel_display.c

index e4474efe84f2f4ff4f4e06c27b7c059bade067ea..2f60b929acf56f9cd5db0b3ad79a13f16ee03b98 100644 (file)
@@ -3218,7 +3218,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