Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753664AbdIHCVL (ORCPT ); Thu, 7 Sep 2017 22:21:11 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:48747 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbdIHCVI (ORCPT ); Thu, 7 Sep 2017 22:21:08 -0400 X-AuditID: b6c32a35-f798c6d000005940-da-59b1fe912590 Subject: Re: [PATCH 3/3] drm/exynos/gsc: Add rotation hardware limits of gscaler To: Marek Szyprowski , Krzysztof Kozlowski , Inki Dae , sw0312.kim@samsung.com, airlied@linux.ie, kgene@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 From: Hoegeun Kwon Message-id: Date: Fri, 08 Sep 2017 11:21:10 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-version: 1.0 In-reply-to: <024ea0a3-abe7-4a87-7723-2e7341237df2@samsung.com> Content-type: text/plain; charset="utf-8"; format="flowed" Content-transfer-encoding: 7bit Content-language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLJsWRmVeSWpSXmKPExsWy7bCmvu7EfxsjDdY26Fr0njvJZPF+WQ+j xfwj51gtrnx9z2bxfnkXm8Wk+xNYLPofv2a2OH9+A7vFpsfXWC0u75rDZjHj/D4mi7VH7rJb LL1+kcmide8RdosZk1+yWbz8eILFQcBjzbw1jB6bVnWyeWz/9oDV4373cSaPzUvqPfq2rGL0 +LxJLoA9KtUmIzUxJbVIITUvOT8lMy/dVsk7ON453tTMwFDX0NLCXEkhLzE31VbJxSdA1y0z B+h4JYWyxJxSoFBAYnGxkr6dTVF+aUmqQkZ+cYmt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8Ni+p9+jbsorR 4/MmuQD2KC6blNSczLLUIn27BK6M9j9fWQsWulVc2rWXtYFxlmEXIyeHhICJxILf/9i6GLk4 hAR2Mko8WLiBESQhJHCfUWL/dk0QW1ggQOLgoYNgRSICk5kkel+tZwZxmAUuM0qs6vnBCNG+ llmi+d0ONpAWNgFdia8915lAbF4BO4llEx+yg9gsAqoSj9/fAIuLCkRI9L29zA5RIyjxY/I9 FhCbU8BeYuvRt2BnMAuYSXx5eZgVwpaX2LzmLTOELS7R3HqTZQKjwCwk7bOQtMxC0jILScsC RpZVjJKpBcW56bnFRgWGeanlesWJucWleel6yfm5mxiBcbftsFbfDsb7S+IPMQpwMCrx8FoE b4wUYk0sK67MPcQowcGsJMK7+ANQiDclsbIqtSg/vqg0J7X4EKM0B4uSOG9m34xIIYH0xJLU 7NTUgtQimCwTB6dUA6NxkUGT16rNEvdWmS5abmG5J5Jbb9GequZNP7aUrlvGduR1R+jn6nW3 bSfz/Vm73uJ93OFXSk/O/lrMqfMsOOvRzrpk3us8c59OEn2989bUMBXNRt9dD+xXTL3jnWYz 9cyBBw4XAh1y2JlX6M87cUm+af638tnCkqHP3t2RsvbZv/agzZJXLbWLlFiKMxINtZiLihMB xTXAJLcCAAA= X-CMS-MailID: 20170908022105epcas1p225bb7fbbe91d6ff5bcb0b1bde22a8db2 X-Msg-Generator: CA X-Sender-IP: 182.195.42.142 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: 101P 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> <1504230476-1878-4-git-send-email-hoegeun.kwon@samsung.com> <10747c31-55fc-6464-eb00-99da6d66fca6@samsung.com> <7e628ff8-82be-a295-90fa-8f547a541cb3@samsung.com> <1e8a7563-046b-82b1-6da9-2e883426edf7@samsung.com> <024ea0a3-abe7-4a87-7723-2e7341237df2@samsung.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8764 Lines: 227 On 09/07/2017 08:25 PM, Marek Szyprowski wrote: > Hi Hoegeun, > > On 2017-09-07 07:16, Hoegeun Kwon wrote: >> On 09/04/2017 03:19 PM, Hoegeun Kwon wrote: >>> On 09/01/2017 04:31 PM, Marek Szyprowski wrote: >>>> Hi Hoegeun, >>>> >>>> On 2017-09-01 03:47, Hoegeun Kwon wrote: >>>>> 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; >>>>> }; >>>>> /** >>>> >>>> IMO maximum supported picture size should be hardcoded into driver, >>>> there >>>> is no need to add device tree properties for that. Please also >>>> check v4l2 >>>> driver for Exynos GSC. >>>> >>>> Currently it uses only one compatible - "exynos5-gsc", but imho You >>>> should >>>> simply replace it with "exynos5250-gsc" and "exynos5420-gsc", and >>>> add those >>>> variants with proper maximum supported size (2047 and 2016 >>>> respectively). >>>> >>>> Best regards >>> >>> Hi Krzysztof and Marek, >>> >>> Thanks Krzysztof and Marek reviews. >>> >>> As Marek says, rot_max size will be hardcoded into driver, >>> then it will not break the ABI. And also, >>> I will check the v4l2 driver for Exynos GSC. >>> >>> Best regards, >>> Hoegeun >>> >> >> Hi Marek, >> >> I have checked v4l2 driver for Exynos GSC. The v4l2 driver supports >> Exynos 5250 and 5433 GSC. Currently, the hardware limits rotation is >> set to 2047 in the v4l2 driver. >> > > V4l2 GSC driver also supports Exynos5420/5422 SoCs, see > # git grep "samsung,exynos5-gsc" arch/arm/boot/dts/ > >> In my opinion don't need to fix it, because the Exynos 5250 has a >> hardware rotation limits of 2048 and the Exynos 5250 has a hardware >> rotation limits of 2047. > > Like you pointed earlier, Exynos 5420/5422/5800 supports rotation only > up to 2016x2016, so additional patch for v4l2 is also needed. Ok, I mistook it as not supporting the Exynos5420. So, I will also upload patches related to v4l2 from patch ver3. Best regards, Hoegeun > >> >> Please tell me if you have any other opinion. >> > > Best regards