From patchwork Fri Sep 1 01:47:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hoegeun Kwon X-Patchwork-Id: 9933275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 351C1602F0 for ; Fri, 1 Sep 2017 01:48:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 276A527E71 for ; Fri, 1 Sep 2017 01:48:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C22527F54; Fri, 1 Sep 2017 01:48:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7224A27E71 for ; Fri, 1 Sep 2017 01:48:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751317AbdIABsH (ORCPT ); Thu, 31 Aug 2017 21:48:07 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:22413 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751009AbdIABsB (ORCPT ); Thu, 31 Aug 2017 21:48:01 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20170901014758epoutp04973a6fb2218b0632907b509ed4de881e~gGaaQDjvF2189521895epoutp04i; Fri, 1 Sep 2017 01:47:58 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.40.65]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20170901014758epcas1p164d8b20a256b32a2eff0044d1a4c02ec~gGaZ_khoY3090330903epcas1p1i; Fri, 1 Sep 2017 01:47:58 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 5E.58.10950.E4CB8A95; Fri, 1 Sep 2017 10:47:58 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20170901014758epcas2p13ae73e7dcac72a1a28c9324164efbd6d~gGaZuMGkx2592025920epcas2p1l; Fri, 1 Sep 2017 01:47:58 +0000 (GMT) X-AuditID: b6c32a45-f79466d000002ac6-f6-59a8bc4e4014 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id C4.76.10338.D4CB8A95; Fri, 1 Sep 2017 10:47:58 +0900 (KST) Received: from localhost.localdomain ([10.113.63.38]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OVK008NSVNVSY10@mmp1.samsung.com>; Fri, 01 Sep 2017 10:47:57 +0900 (KST) From: Hoegeun Kwon To: inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, airlied@linux.ie, kgene@kernel.org, krzk@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, catalin.marinas@arm.com, will.deacon@arm.com Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Hoegeun Kwon Subject: [PATCH 3/3] drm/exynos/gsc: Add rotation hardware limits of gscaler Date: Fri, 01 Sep 2017 10:47:56 +0900 Message-id: <1504230476-1878-4-git-send-email-hoegeun.kwon@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1504230476-1878-1-git-send-email-hoegeun.kwon@samsung.com> X-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M/El959ywkmBfCGjat A48pKZ/J6iIwC8/+BbOJlumAAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsVy+t9jAV2/PSsiDSa/ZLboPXeSyeL9sh5G i/lHzrFaXPn6ns3i/fIuNotJ9yewWLy4d5HFov/xa2aL8+c3sFtsenyN1eLyrjlsFjPO72Oy WHr9IpNF694j7BYzJr9ks3j58QSLg4DHmnlrGD02repk89j+7QGrx/3u40wem5fUe/RtWcXo 8XmTXAB7FJdNSmpOZllqkb5dAlfG5ulaBXfUK9Z+2MLawPhDrouRk0NCwERi+ZO/jF2MXBxC AjsZJR58v8kG4XxnlJjxbScbSBWbgK7E157rTCAJEYFbjBJnpp8Bq2IWuMwosarnByNIlbCA j0TjyhlgNouAqsTmZfPBunkF3CVm3rnEDLFPTuLkscmsIDangIfEvq4fYDVCQDUHNrximsDI s4CRYRWjZGpBcW56brFRgVFearlecWJucWleul5yfu4mRmDQbjus1b+D8fGS+EOMAhyMSjy8 K7hWRAqxJpYVV+YeYpTgYFYS4fVcARTiTUmsrEotyo8vKs1JLT7EKM3BoiTOm9k3I1JIID2x JDU7NbUgtQgmy8TBKdXAaO3Qepw3KWjFamc3RUOdexKzJPx85R7KzwwWeZ5SWfXYrcNSbka+ G/8XXpmOn2uPJjD0W6+Kcs000bnV2/b1IJPxpl7WPu4alrs+Z5nMlKwrzTNuPDgVyuXv9MPh +m1rrsrn5z1iCto6oyapFbz90F4RzT5Ft2xj/m7FZRfmVy0/wKNu8UuJpTgj0VCLuag4EQBj cobkVgIAAA== X-CMS-MailID: 20170901014758epcas2p13ae73e7dcac72a1a28c9324164efbd6d X-Msg-Generator: CA X-Sender-IP: 182.195.42.143 X-Local-Sender: =?UTF-8?B?6raM7ZqM6re8G1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?SG9lZ2V1biBLd29uG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG1RFTEUbQzEwVjgxMTE=?= CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170901014758epcas2p13ae73e7dcac72a1a28c9324164efbd6d X-RootMTR: 20170901014758epcas2p13ae73e7dcac72a1a28c9324164efbd6d References: <1504230476-1878-1-git-send-email-hoegeun.kwon@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The gscaler has hardware rotation limits that need to be imported from dts. Parse them and add them to the property list. The rotation hardware limits are related to the cropped source size. When swap occurs, use rot_max size instead of crop_max size. Also the scaling limits are related to post size, use pos size to check the limits. Signed-off-by: Hoegeun Kwon --- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 63 +++++++++++++++++++++------------ include/uapi/drm/exynos_drm.h | 2 ++ 2 files changed, 42 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 0506b2b..dd9b057 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c @@ -1401,6 +1401,23 @@ static int gsc_ippdrv_check_property(struct device *dev, bool swap; int i; + config = &property->config[EXYNOS_DRM_OPS_DST]; + + /* check for degree */ + switch (config->degree) { + case EXYNOS_DRM_DEGREE_90: + case EXYNOS_DRM_DEGREE_270: + swap = true; + break; + case EXYNOS_DRM_DEGREE_0: + case EXYNOS_DRM_DEGREE_180: + swap = false; + break; + default: + DRM_ERROR("invalid degree.\n"); + goto err_property; + } + for_each_ipp_ops(i) { if ((i == EXYNOS_DRM_OPS_SRC) && (property->cmd == IPP_CMD_WB)) @@ -1416,21 +1433,6 @@ static int gsc_ippdrv_check_property(struct device *dev, goto err_property; } - /* check for degree */ - switch (config->degree) { - case EXYNOS_DRM_DEGREE_90: - case EXYNOS_DRM_DEGREE_270: - swap = true; - break; - case EXYNOS_DRM_DEGREE_0: - case EXYNOS_DRM_DEGREE_180: - swap = false; - break; - default: - DRM_ERROR("invalid degree.\n"); - goto err_property; - } - /* check for buffer bound */ if ((pos->x + pos->w > sz->hsize) || (pos->y + pos->h > sz->vsize)) { @@ -1438,21 +1440,27 @@ static int gsc_ippdrv_check_property(struct device *dev, goto err_property; } + /* + * The rotation hardware limits are related to the cropped + * source size. So use rot_max size to check the limits when + * swap happens. And also the scaling limits are related to pos + * size, use pos size to check the limits. + */ /* check for crop */ if ((i == EXYNOS_DRM_OPS_SRC) && (pp->crop)) { if (swap) { if ((pos->h < pp->crop_min.hsize) || - (sz->vsize > pp->crop_max.hsize) || + (pos->h > pp->rot_max.hsize) || (pos->w < pp->crop_min.vsize) || - (sz->hsize > pp->crop_max.vsize)) { + (pos->w > pp->rot_max.vsize)) { DRM_ERROR("out of crop size.\n"); goto err_property; } } else { if ((pos->w < pp->crop_min.hsize) || - (sz->hsize > pp->crop_max.hsize) || + (pos->w > pp->crop_max.hsize) || (pos->h < pp->crop_min.vsize) || - (sz->vsize > pp->crop_max.vsize)) { + (pos->h > pp->crop_max.vsize)) { DRM_ERROR("out of crop size.\n"); goto err_property; } @@ -1463,17 +1471,17 @@ static int gsc_ippdrv_check_property(struct device *dev, if ((i == EXYNOS_DRM_OPS_DST) && (pp->scale)) { if (swap) { if ((pos->h < pp->scale_min.hsize) || - (sz->vsize > pp->scale_max.hsize) || + (pos->h > pp->scale_max.hsize) || (pos->w < pp->scale_min.vsize) || - (sz->hsize > pp->scale_max.vsize)) { + (pos->w > pp->scale_max.vsize)) { DRM_ERROR("out of scale size.\n"); goto err_property; } } else { if ((pos->w < pp->scale_min.hsize) || - (sz->hsize > pp->scale_max.hsize) || + (pos->w > pp->scale_max.hsize) || (pos->h < pp->scale_min.vsize) || - (sz->vsize > pp->scale_max.vsize)) { + (pos->h > pp->scale_max.vsize)) { DRM_ERROR("out of scale size.\n"); goto err_property; } @@ -1676,6 +1684,15 @@ static int gsc_probe(struct platform_device *pdev) dev_warn(dev, "failed to get system register.\n"); ctx->sysreg = NULL; } + + ret = of_property_read_u32(dev->of_node, "rot-max-hsize", + &ctx->ippdrv.prop_list.rot_max.hsize); + ret |= of_property_read_u32(dev->of_node, "rot-max-vsize", + &ctx->ippdrv.prop_list.rot_max.vsize); + if (ret) { + dev_err(dev, "rot-max property should be provided by device tree.\n"); + return -EINVAL; + } } /* clock control */ diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h index cb3e9f9..d5d5518 100644 --- a/include/uapi/drm/exynos_drm.h +++ b/include/uapi/drm/exynos_drm.h @@ -192,6 +192,7 @@ enum drm_exynos_planer { * @crop_max: crop max resolution. * @scale_min: scale min resolution. * @scale_max: scale max resolution. + * @rot_max: rotation max resolution. */ struct drm_exynos_ipp_prop_list { __u32 version; @@ -210,6 +211,7 @@ struct drm_exynos_ipp_prop_list { struct drm_exynos_sz crop_max; struct drm_exynos_sz scale_min; struct drm_exynos_sz scale_max; + struct drm_exynos_sz rot_max; }; /**