From patchwork Wed Jan 27 14:44:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 60631 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2623767lbb; Wed, 27 Jan 2016 06:45:10 -0800 (PST) X-Received: by 10.66.100.161 with SMTP id ez1mr11213435pab.153.1453905903694; Wed, 27 Jan 2016 06:45:03 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id z10si8188171pfi.50.2016.01.27.06.45.03; Wed, 27 Jan 2016 06:45:03 -0800 (PST) Received-SPF: pass (google.com: domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 145A96E705; Wed, 27 Jan 2016 06:45:02 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 485DC6E700 for ; Wed, 27 Jan 2016 06:45:00 -0800 (PST) Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O1M00I9F8YWEM10@mailout1.w1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 27 Jan 2016 14:44:56 +0000 (GMT) X-AuditID: cbfec7f4-f79026d00000418a-46-56a8d7e819c3 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 85.98.16778.8E7D8A65; Wed, 27 Jan 2016 14:44:56 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O1M00IVT8YO6E70@eusync1.samsung.com>; Wed, 27 Jan 2016 14:44:56 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v5 3/5] drm: simplify initialization of rotation property Date: Wed, 27 Jan 2016 15:44:41 +0100 Message-id: <1453905883-6807-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1453905883-6807-1-git-send-email-m.szyprowski@samsung.com> References: <1453905883-6807-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMLMWRmVeSWpSXmKPExsVy+t/xy7ovrq8IM3jZwmVxa905VouNM9az WjQdOsVm8X/bRGaLK1/fs1kcW7ed0WLng13sFpPuT2CxeHHvIovF6xeGFjPO72OyWHvkLrvF jMkv2SzaVn9gtfj+byGTxZmrB1gcBDz2flvA4nHn2h42j3knAz3udx9n8vh3jN1j56S9TB59 W1Yxejz9sZfZ4/MmuQDOKC6blNSczLLUIn27BK6MdbN6mAp+GFU8nXebrYHxhlYXIyeHhICJ xKefT1khbDGJC/fWs3UxcnEICSxllDhy4QGU08Qk0T51OxtIFZuAoUTX2y4wW0TATaLp8ExW kCJmgfssElc/H2AHSQgLeEpcO/cbzGYRUJV43fKRGcTmFXCXuNXbxgSxTk7i/8sVYDangIfE zZnrGUFsIaCaexensE5g5F3AyLCKUTS1NLmgOCk911CvODG3uDQvXS85P3cTIySov+xgXHzM 6hCjAAejEg/vjf3Lw4RYE8uKK3MPMUpwMCuJ8LJeWhEmxJuSWFmVWpQfX1Sak1p8iFGag0VJ nHfurvchQgLpiSWp2ampBalFMFkmDk6pBkbWKIZl0a9zzdYJMTRL/+E9ahemWnZ/zv9pp2bc WbDBNe2m+OWkLTs6V5/gqO19HneaY14u08fb5fsz1Kvmn4msMV/GN92ireNW8BlpQ7Ytu5QX c+kFdcwr2M1gcLaA7/T2kHMOs9iv77rnmSqQZz1vxwIdbkFnnYLdjldTTvyNc3t1+eRS6QYl luKMREMt5qLiRACu51vvZgIAAA== Cc: Krzysztof Kozlowski , Benjamin Gaignard , Bartlomiej Zolnierkiewicz , Seung-Woo Kim , fabien.dessenne@st.com, Andrzej Hajda , Tobias Jakobi , vincent.abriou@st.com, Marek Szyprowski X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 d40bab29747e..822ad6928144 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -5875,10 +5875,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" }, @@ -5887,9 +5900,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 2f00828ccc6e..1bce8750c308 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -14046,8 +14046,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, @@ -14183,8 +14182,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 4f32a358d631..702f4f28f580 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -2494,8 +2494,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);