Merge tag 'drm-intel-next-2019-05-24' of git://anongit.freedesktop.org/drm/drm-intel...
[linux-2.6-microblaze.git] / drivers / gpu / drm / i915 / intel_sprite.c
index 2913e89..c180815 100644 (file)
@@ -256,6 +256,16 @@ int intel_plane_check_stride(const struct intel_plane_state *plane_state)
        unsigned int rotation = plane_state->base.rotation;
        u32 stride, max_stride;
 
+       /*
+        * We ignore stride for all invisible planes that
+        * can be remapped. Otherwise we could end up
+        * with a false positive when the remapping didn't
+        * kick in due the plane being invisible.
+        */
+       if (intel_plane_can_remap(plane_state) &&
+           !plane_state->base.visible)
+               return 0;
+
        /* FIXME other color planes? */
        stride = plane_state->color_plane[0].stride;
        max_stride = plane->max_stride(plane, fb->format->format,
@@ -325,7 +335,8 @@ skl_plane_max_stride(struct intel_plane *plane,
                     u32 pixel_format, u64 modifier,
                     unsigned int rotation)
 {
-       int cpp = drm_format_plane_cpp(pixel_format, 0);
+       const struct drm_format_info *info = drm_format_info(pixel_format);
+       int cpp = info->cpp[0];
 
        /*
         * "The stride in bytes must not exceed the
@@ -1417,6 +1428,10 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
        if (ret)
                return ret;
 
+       ret = i9xx_check_plane_surface(plane_state);
+       if (ret)
+               return ret;
+
        if (!plane_state->base.visible)
                return 0;
 
@@ -1428,10 +1443,6 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
        if (ret)
                return ret;
 
-       ret = i9xx_check_plane_surface(plane_state);
-       if (ret)
-               return ret;
-
        if (INTEL_GEN(dev_priv) >= 7)
                plane_state->ctl = ivb_sprite_ctl(crtc_state, plane_state);
        else
@@ -1475,6 +1486,10 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state,
        if (ret)
                return ret;
 
+       ret = i9xx_check_plane_surface(plane_state);
+       if (ret)
+               return ret;
+
        if (!plane_state->base.visible)
                return 0;
 
@@ -1482,10 +1497,6 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state,
        if (ret)
                return ret;
 
-       ret = i9xx_check_plane_surface(plane_state);
-       if (ret)
-               return ret;
-
        plane_state->ctl = vlv_sprite_ctl(crtc_state, plane_state);
 
        return 0;
@@ -1639,6 +1650,10 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
        if (ret)
                return ret;
 
+       ret = skl_check_plane_surface(plane_state);
+       if (ret)
+               return ret;
+
        if (!plane_state->base.visible)
                return 0;
 
@@ -1654,10 +1669,6 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
        if (ret)
                return ret;
 
-       ret = skl_check_plane_surface(plane_state);
-       if (ret)
-               return ret;
-
        /* HW only has 8 bits pixel precision, disable plane if invisible */
        if (!(plane_state->base.alpha >> 8))
                plane_state->base.visible = false;