]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/mali-dp: Rotated planes need a larger pitch size.
authorLiviu Dudau <Liviu.Dudau@arm.com>
Tue, 5 Dec 2017 16:51:03 +0000 (16:51 +0000)
committerLiviu Dudau <Liviu.Dudau@arm.com>
Wed, 14 Mar 2018 11:38:02 +0000 (11:38 +0000)
Rotated planes need a pitch size that is aligned to 8 bytes
for older DP500 and DP550 and at least 64 bytes for DP650. Replace
the malidp_hw_pitch_valid() function with one that calculates
the correct pitch alignment to take into account rotation.

Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
drivers/gpu/drm/arm/malidp_hw.h
drivers/gpu/drm/arm/malidp_planes.c

index b0690ebb356523781bfaf5a6fbbb4a38d39cb5e2..42d3e7b9ba9869098aa4dec32b6b51343ae3c06a 100644 (file)
@@ -285,10 +285,16 @@ void malidp_se_irq_fini(struct drm_device *drm);
 u8 malidp_hw_get_format_id(const struct malidp_hw_regmap *map,
                           u8 layer_id, u32 format);
 
-static inline bool malidp_hw_pitch_valid(struct malidp_hw_device *hwdev,
-                                        unsigned int pitch)
+static inline u8 malidp_hw_get_pitch_align(struct malidp_hw_device *hwdev, bool rotated)
 {
-       return !(pitch & (hwdev->hw->map.bus_align_bytes - 1));
+       /*
+        * only hardware that cannot do 8 bytes bus alignments have further
+        * constraints on rotated planes
+        */
+       if (hwdev->hw->map.bus_align_bytes == 8)
+               return 8;
+       else
+               return hwdev->hw->map.bus_align_bytes << (rotated ? 2 : 0);
 }
 
 /* U16.16 */
index ee32361c87ac27f9faa13aac1f95378b72da40a9..a307fc2f2abc20a8e70aa44670fc8fe285c9216b 100644 (file)
@@ -175,6 +175,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
 {
        struct malidp_plane *mp = to_malidp_plane(plane);
        struct malidp_plane_state *ms = to_malidp_plane_state(state);
+       bool rotated = state->rotation & MALIDP_ROTATED_MASK;
        struct drm_framebuffer *fb;
        int i, ret;
 
@@ -191,7 +192,8 @@ static int malidp_de_plane_check(struct drm_plane *plane,
 
        ms->n_planes = fb->format->num_planes;
        for (i = 0; i < ms->n_planes; i++) {
-               if (!malidp_hw_pitch_valid(mp->hwdev, fb->pitches[i])) {
+               u8 alignment = malidp_hw_get_pitch_align(mp->hwdev, rotated);
+               if (fb->pitches[i] & (alignment - 1)) {
                        DRM_DEBUG_KMS("Invalid pitch %u for plane %d\n",
                                      fb->pitches[i], i);
                        return -EINVAL;