]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm: mali-dp: Refactor plane initialisation
authorBrian Starkey <brian.starkey@arm.com>
Tue, 11 Oct 2016 14:26:07 +0000 (15:26 +0100)
committerLiviu Dudau <Liviu.Dudau@arm.com>
Fri, 4 Nov 2016 17:09:19 +0000 (17:09 +0000)
As we add more features, it makes sense to skip all the features not
supported by the smart layer together, instead of checking each one
individually. Achieve this by refactoring the plane init loop.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
[re-factor code after upstream changed rotation property to be per-plane]
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
drivers/gpu/drm/arm/malidp_planes.c

index eaae81908de2f15d9cfdd3428dd0c9f8df08940a..11578debc1eea7759be7b900ecc8bf1184e9020a 100644 (file)
@@ -235,6 +235,8 @@ int malidp_de_planes_init(struct drm_device *drm)
        struct malidp_plane *plane = NULL;
        enum drm_plane_type plane_type;
        unsigned long crtcs = 1 << drm->mode_config.num_crtc;
+       unsigned long flags = DRM_ROTATE_0 | DRM_ROTATE_90 | DRM_ROTATE_180 |
+                             DRM_ROTATE_270 | DRM_REFLECT_X | DRM_REFLECT_Y;
        u32 *formats;
        int ret, i, j, n;
 
@@ -267,23 +269,16 @@ int malidp_de_planes_init(struct drm_device *drm)
                if (ret < 0)
                        goto cleanup;
 
-               /* SMART layer can't be rotated */
-               if (id != DE_SMART) {
-                       unsigned long flags = DRM_ROTATE_0 |
-                                             DRM_ROTATE_90 |
-                                             DRM_ROTATE_180 |
-                                             DRM_ROTATE_270 |
-                                             DRM_REFLECT_X |
-                                             DRM_REFLECT_Y;
-                       drm_plane_create_rotation_property(&plane->base,
-                                                          DRM_ROTATE_0,
-                                                          flags);
-               }
-
                drm_plane_helper_add(&plane->base,
                                     &malidp_de_plane_helper_funcs);
                plane->hwdev = malidp->dev;
                plane->layer = &map->layers[i];
+
+               /* Skip the features which the SMART layer doesn't have */
+               if (id == DE_SMART)
+                       continue;
+
+               drm_plane_create_rotation_property(&plane->base, DRM_ROTATE_0, flags);
        }
 
        kfree(formats);