Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752534AbcJKO2Y (ORCPT ); Tue, 11 Oct 2016 10:28:24 -0400 Received: from foss.arm.com ([217.140.101.70]:34616 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752669AbcJKO04 (ORCPT ); Tue, 11 Oct 2016 10:26:56 -0400 From: Brian Starkey To: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, liviu.dudau@arm.com Subject: [PATCH 6/8] drm: mali-dp: Refactor plane initialisation Date: Tue, 11 Oct 2016 15:26:07 +0100 Message-Id: <1476195969-23655-6-git-send-email-brian.starkey@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1476195969-23655-1-git-send-email-brian.starkey@arm.com> References: <1476195969-23655-1-git-send-email-brian.starkey@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1708 Lines: 51 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 Acked-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index f95e02d..a17d24b 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -267,6 +267,15 @@ int malidp_de_planes_init(struct drm_device *drm) if (ret < 0) goto cleanup; + 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; + if (!drm->mode_config.rotation_property) { unsigned long flags = DRM_ROTATE_0 | DRM_ROTATE_90 | @@ -277,16 +286,12 @@ int malidp_de_planes_init(struct drm_device *drm) drm->mode_config.rotation_property = drm_mode_create_rotation_property(drm, flags); } - /* SMART layer can't be rotated */ - if (drm->mode_config.rotation_property && (id != DE_SMART)) + + if (drm->mode_config.rotation_property) drm_object_attach_property(&plane->base.base, drm->mode_config.rotation_property, DRM_ROTATE_0); - drm_plane_helper_add(&plane->base, - &malidp_de_plane_helper_funcs); - plane->hwdev = malidp->dev; - plane->layer = &map->layers[i]; } kfree(formats); -- 1.7.9.5