From patchwork Tue Jan 12 13:39:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 8017331 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2E904BEEED for ; Tue, 12 Jan 2016 13:40:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 34825200DC for ; Tue, 12 Jan 2016 13:40:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65E5920383 for ; Tue, 12 Jan 2016 13:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762282AbcALNj7 (ORCPT ); Tue, 12 Jan 2016 08:39:59 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:41052 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752330AbcALNj6 (ORCPT ); Tue, 12 Jan 2016 08:39:58 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O0U00316DYITM10@mailout4.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 12 Jan 2016 13:39:54 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-9a-5695022a55b0 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 4F.47.21385.A2205965; Tue, 12 Jan 2016 13:39:54 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O0U0029FDY0O620@eusync3.samsung.com>; Tue, 12 Jan 2016 13:39:54 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Daniel Vetter , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Joonyoung Shim , Seung-Woo Kim , Andrzej Hajda , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Tobias Jakobi , Gustavo Padovan , Benjamin Gaignard , vincent.abriou@st.com, fabien.dessenne@st.com Subject: [PATCH v3 3/3] drm: simplify initialization of rotation property Date: Tue, 12 Jan 2016 14:39:20 +0100 Message-id: <1452605960-21194-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1452605960-21194-1-git-send-email-m.szyprowski@samsung.com> References: <1452605960-21194-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsVy+t/xq7paTFPDDOb/lba4te4cq8XGGetZ LZoOnWKz+L9tIrPFla/v2SyOrdvOaLHzwS52i0n3J7BYvLh3kcXi9QtDixnn9zFZrD1yl91i xuSXbBZtqz+wWnz/t5DJ4szVAywOAh57vy1g8bhzbQ+bx7yTgR73u48zefw7xu6xc9JeJo++ LasYPZ7+2Mvs8XmTXABnFJdNSmpOZllqkb5dAlfGoc+HmAp+GFX0rZ3J2sB4Q6uLkZNDQsBE YunE/UwQtpjEhXvr2boYuTiEBJYyShw68Z0Fwmlikmg+dp0ZpIpNwFCi620XG4gtIuAm0XR4 JitIEbPAfRaJq58PsHcxcnAIC3hK7JmTD1LDIqAqsfRXKyOIzSvgIfFnyREWiG1yEv9frgDb zAlU3t66C2y+EFDNosaVzBMYeRcwMqxiFE0tTS4oTkrPNdIrTswtLs1L10vOz93ECAnprzsY lx6zOsQowMGoxMObwT4lTIg1say4MvcQowQHs5II7+XfQCHelMTKqtSi/Pii0pzU4kOM0hws SuK8M3e9DxESSE8sSc1OTS1ILYLJMnFwSjUwcqqtXnnGWVB6lsibZOmD/tvXRO7L3X592bOQ mnOmq4zijjysOXjaj9Ur9uzsK3+f9hyu0Xz/IHNZ9tYDyhtNTL0Yz18RCymJDmq8ZX6B8etb vvYkzkMCqYcPfQoJEzHlv5JyYEO46EL3jPth92Z9iUzhF8ktCGFJMZqh9svG8mfVxsiVVTt5 lFiKMxINtZiLihMBKEGm6WUCAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch simplifies initialization of generic rotation property and aligns the code to match recently introduced function for intializing generic zpos property. It also adds missing documentation. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 10 ++++----- drivers/gpu/drm/drm_crtc.c | 29 ++++++++++++++++++++----- drivers/gpu/drm/i915/intel_display.c | 6 ++--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 3 +-- drivers/gpu/drm/omapdrm/omap_drv.c | 3 +-- include/drm/drm_crtc.h | 4 ++-- 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index 1ffe9c329c46..4f9606cdf0f2 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c @@ -967,12 +967,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev) if (!props->alpha) return ERR_PTR(-ENOMEM); - dev->mode_config.rotation_property = - drm_mode_create_rotation_property(dev, - BIT(DRM_ROTATE_0) | - BIT(DRM_ROTATE_90) | - BIT(DRM_ROTATE_180) | - BIT(DRM_ROTATE_270)); + drm_mode_create_rotation_property(dev, BIT(DRM_ROTATE_0) | + BIT(DRM_ROTATE_90) | + BIT(DRM_ROTATE_180) | + BIT(DRM_ROTATE_270)); if (!dev->mode_config.rotation_property) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 54a21e7c1ca5..99faccb63ce3 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -5861,10 +5861,23 @@ void drm_mode_config_cleanup(struct drm_device *dev) } EXPORT_SYMBOL(drm_mode_config_cleanup); -struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev, - unsigned int supported_rotations) +/** + * drm_mode_create_rotation_property - create generic rotation property + * @dev: DRM device + * @supported_rotations: bitmask of supported rotation modes + * + * This function initializes generic rotation property and enables support + * for it in drm core. Drivers can then attach this property to planes to enable + * support for different rotation modes. + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_mode_create_rotation_property(struct drm_device *dev, + unsigned int supported_rotations) { - static const struct drm_prop_enum_list props[] = { + struct drm_property *prop; + static const struct drm_prop_enum_list values[] = { { DRM_ROTATE_0, "rotate-0" }, { DRM_ROTATE_90, "rotate-90" }, { DRM_ROTATE_180, "rotate-180" }, @@ -5873,9 +5886,13 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev, { DRM_REFLECT_Y, "reflect-y" }, }; - return drm_property_create_bitmask(dev, 0, "rotation", - props, ARRAY_SIZE(props), - supported_rotations); + prop = drm_property_create_bitmask(dev, 0, "rotation", values, + ARRAY_SIZE(values), supported_rotations); + if (!prop) + return -ENOMEM; + + dev->mode_config.rotation_property = prop; + return 0; } EXPORT_SYMBOL(drm_mode_create_rotation_property); diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 02f6ccb848a9..5b7ba46491a0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -14042,8 +14042,7 @@ void intel_create_rotation_property(struct drm_device *dev, struct intel_plane * if (INTEL_INFO(dev)->gen >= 9) flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270); - dev->mode_config.rotation_property = - drm_mode_create_rotation_property(dev, flags); + drm_mode_create_rotation_property(dev, flags); } if (dev->mode_config.rotation_property) drm_object_attach_property(&plane->base.base, @@ -14179,8 +14178,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, if (INTEL_INFO(dev)->gen >= 4) { if (!dev->mode_config.rotation_property) - dev->mode_config.rotation_property = - drm_mode_create_rotation_property(dev, + drm_mode_create_rotation_property(dev, BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_180)); if (dev->mode_config.rotation_property) diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 432c09836b0e..8defeec0d453 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c @@ -76,8 +76,7 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev, return; if (!dev->mode_config.rotation_property) - dev->mode_config.rotation_property = - drm_mode_create_rotation_property(dev, + drm_mode_create_rotation_property(dev, BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y)); if (dev->mode_config.rotation_property) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index dfafdb602ad2..c6ce2b31f1c5 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -304,8 +304,7 @@ static int omap_modeset_init_properties(struct drm_device *dev) struct omap_drm_private *priv = dev->dev_private; if (priv->has_dmm) { - dev->mode_config.rotation_property = - drm_mode_create_rotation_property(dev, + drm_mode_create_rotation_property(dev, BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y)); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 0607ad2ce918..9cb6a57af51b 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -2490,8 +2490,8 @@ extern int drm_format_plane_cpp(uint32_t format, int plane); extern int drm_format_horz_chroma_subsampling(uint32_t format); extern int drm_format_vert_chroma_subsampling(uint32_t format); extern const char *drm_get_format_name(uint32_t format); -extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev, - unsigned int supported_rotations); +extern int drm_mode_create_rotation_property(struct drm_device *dev, + unsigned int supported_rotations); extern unsigned int drm_rotation_simplify(unsigned int rotation, unsigned int supported_rotations);