From patchwork Fri Aug 10 13:29:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10562713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E3551515 for ; Fri, 10 Aug 2018 13:29:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DD752B67E for ; Fri, 10 Aug 2018 13:29:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 823212B687; Fri, 10 Aug 2018 13:29:25 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2252D2B67E for ; Fri, 10 Aug 2018 13:29:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 793C56E927; Fri, 10 Aug 2018 13:29:21 +0000 (UTC) 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 CA6356E927 for ; Fri, 10 Aug 2018 13:29:18 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180810132917euoutp01f468c95593816864700f06151465d4f0~JiPqJN9kI0614006140euoutp013 for ; Fri, 10 Aug 2018 13:29:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180810132917euoutp01f468c95593816864700f06151465d4f0~JiPqJN9kI0614006140euoutp013 Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180810132917eucas1p1f2c330ff0a401fc9c3f113ed4e593bbc~JiPpfQ1Pc2268722687eucas1p1g; Fri, 10 Aug 2018 13:29:17 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id DA.C2.04294.C239D6B5; Fri, 10 Aug 2018 14:29:16 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20180810132916eucas1p1539d4d2c2d1eb4fc0ae95cd504fad927~JiPosCC_B0188601886eucas1p1T; Fri, 10 Aug 2018 13:29:16 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20180810132916eusmtrp123e3be6116e4fec88047cb5c08be6f85~JiPoq4mpi1157411574eusmtrp10; Fri, 10 Aug 2018 13:29:16 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-7d-5b6d932c6840 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 97.BA.04128.C239D6B5; Fri, 10 Aug 2018 14:29:16 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.116.147.25]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20180810132915eusmtip17ce3cbd7bb222122bb5a3beeca0c8b2a~JiPoSS4u81796317963eusmtip1z; Fri, 10 Aug 2018 13:29:15 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 3/3] drm/exynos: gsc: Add support for tiled formats Date: Fri, 10 Aug 2018 15:29:01 +0200 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810132901.11844-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrEIsWRmVeSWpSXmKPExsWy7djPc7o6k3OjDZqWaFvMetnOYrFxxnpW iytf37NZTLo/gcVixvl9TBZrj9xlt5gx+SWbA7vH/e7jTB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CV8efwMfaCzwoVZx+uYm5gnCvdxcjJISFgIrGo/QdbFyMXh5DACkaJRx23mEESQgJf GCUalmhCJD4zSjxd85wVpqPl6ydmiMRyRomFYAkQ5yujxIUt+8Cq2AQMJbredrGB2CICbhJN h2eCFTELPGaUWLt7MztIQljAWeLQ0bNgNouAqsSluy1QK+QlVm84ALSCg4NTwE7i3rwMkF4J gcdsEgveHGQBqeEVKJN4vHkqI0S9i0TX/T9MELawxKvjW9ghbBmJ05N7WCCamxkl2mfMYodw ehglts7ZwQZRZS1x+PhFVpBtzAKaEut36UOEHSUeHv/GDhKWEOCTuPFWECTMDGRO2jadGSLM K9HRJgRRrSYx6/g6uLUHL1xihrA9JObf/ccCCaCJjBIffi9jm8AoPwth2QJGxlWM4qmlxbnp qcVGeanlesWJucWleel6yfm5mxiBKeH0v+NfdjDu+pN0iFGAg1GJh1egOCdaiDWxrLgy9xCj BAezkghvpmlutBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXFePq20aCGB9MSS1OzU1ILUIpgsEwen VAMj/8lJ02ZmpCXJtByMzw8o6WQ2z4369mbBwUu/zCKPOCkVrz9zu9v81OJNBp8sJResj3yf FJt1LC/+iteZj+sWhIt5xRpqszhkG8uc2v/uBPPNqxu0rnYufjX93iuGEJlat2C1qqqtp5ed OvhwZcaLv7cKbh/adu4Go138MoeCvqu2NzVeTOKbrcRSnJFoqMVcVJwIAG6j6GQFAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsVy+t/xu7o6k3OjDSYsZbeY9bKdxWLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbjFj8ks2B3aP+93HmTz6tqxi9Pi8SS6AOUrPpii/tCRV ISO/uMRWKdrQwkjP0NJCz8jEUs/Q2DzWyshUSd/OJiU1J7MstUjfLkEv48/hY+wFnxUqzj5c xdzAOFe6i5GTQ0LARKLl6yfmLkYuDiGBpYwSex/cZYFIyEicnNbACmELS/y51sUGUfQZqGjC FCaQBJuAoUTXW5AEJ4eIgIdE87fj7CBFzAJPGSW+HvwBNklYwFni0NGz7CA2i4CqxKW7LUBT OTh4BWwlHs/IgFggL7F6wwFmkDCngJ3EvXlgYSGgigl3D7JMYORbwMiwilEktbQ4Nz232Eiv ODG3uDQvXS85P3cTIzA8tx37uWUHY9e74EOMAhyMSjy8DKk50UKsiWXFlbmHGCU4mJVEeDNN c6OFeFMSK6tSi/Lji0pzUosPMZoCnTSRWUo0OR8YO3kl8YamhuYWlobmxubGZhZK4rznDSqj hATSE0tSs1NTC1KLYPqYODilGhiPHHtz+32vv36vs1m9z6M3GU8yI38/LnnJeeK/YFed+KIl hbP5yu6nNEZVq2W+E/feq3I2+360SFXaWwPD+ry+Q7xbDb2uXY51TZk9+7xjXdPS1DVhOTvO eOy/4X/HdhbXXNN/IrVvNl5tW8PlGyHytebn78OML680L3X4Ij9RXDYqeF7d7sNKLMUZiYZa zEXFiQDWRj7gZQIAAA== Message-Id: <20180810132916eucas1p1539d4d2c2d1eb4fc0ae95cd504fad927~JiPosCC_B0188601886eucas1p1T@eucas1p1.samsung.com> X-CMS-MailID: 20180810132916eucas1p1539d4d2c2d1eb4fc0ae95cd504fad927 X-Msg-Generator: CA X-RootMTR: 20180810132916eucas1p1539d4d2c2d1eb4fc0ae95cd504fad927 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180810132916eucas1p1539d4d2c2d1eb4fc0ae95cd504fad927 References: <20180810132901.11844-1-m.szyprowski@samsung.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrzej Pietrasiewicz , Bartlomiej Zolnierkiewicz , Seung-Woo Kim , Marek Szyprowski MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add support for 16x16 tiled NV12 and NV21 formats. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 46 ++++++++++++++++++------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 7ba414b52faa..ce15d46bfce8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c @@ -448,7 +448,7 @@ static void gsc_handle_irq(struct gsc_context *ctx, bool enable, } -static void gsc_src_set_fmt(struct gsc_context *ctx, u32 fmt) +static void gsc_src_set_fmt(struct gsc_context *ctx, u32 fmt, bool tiled) { u32 cfg; @@ -514,6 +514,9 @@ static void gsc_src_set_fmt(struct gsc_context *ctx, u32 fmt) break; } + if (tiled) + cfg |= (GSC_IN_TILE_C_16x8 | GSC_IN_TILE_MODE); + gsc_write(cfg, GSC_IN_CON); } @@ -632,7 +635,7 @@ static void gsc_src_set_addr(struct gsc_context *ctx, u32 buf_id, gsc_src_set_buf_seq(ctx, buf_id, true); } -static void gsc_dst_set_fmt(struct gsc_context *ctx, u32 fmt) +static void gsc_dst_set_fmt(struct gsc_context *ctx, u32 fmt, bool tiled) { u32 cfg; @@ -698,6 +701,9 @@ static void gsc_dst_set_fmt(struct gsc_context *ctx, u32 fmt) break; } + if (tiled) + cfg |= (GSC_IN_TILE_C_16x8 | GSC_OUT_TILE_MODE); + gsc_write(cfg, GSC_OUT_CON); } @@ -1122,11 +1128,11 @@ static int gsc_commit(struct exynos_drm_ipp *ipp, return ret; } - gsc_src_set_fmt(ctx, task->src.buf.fourcc); + gsc_src_set_fmt(ctx, task->src.buf.fourcc, task->src.buf.modifier); gsc_src_set_transf(ctx, task->transform.rotation); gsc_src_set_size(ctx, &task->src); gsc_src_set_addr(ctx, 0, &task->src); - gsc_dst_set_fmt(ctx, task->dst.buf.fourcc); + gsc_dst_set_fmt(ctx, task->dst.buf.fourcc, task->dst.buf.modifier); gsc_dst_set_size(ctx, &task->dst); gsc_dst_set_addr(ctx, 0, &task->dst); gsc_set_prescaler(ctx, &ctx->sc, &task->src.rect, &task->dst.rect); @@ -1200,6 +1206,10 @@ static const unsigned int gsc_formats[] = { DRM_FORMAT_YUV420, DRM_FORMAT_YVU420, DRM_FORMAT_YUV422, }; +static const unsigned int gsc_tiled_formats[] = { + DRM_FORMAT_NV12, DRM_FORMAT_NV21, +}; + static int gsc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1207,23 +1217,24 @@ static int gsc_probe(struct platform_device *pdev) struct exynos_drm_ipp_formats *formats; struct gsc_context *ctx; struct resource *res; - int ret, i; + int num_formats, ret, i, j; ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; - formats = devm_kcalloc(dev, - ARRAY_SIZE(gsc_formats), sizeof(*formats), - GFP_KERNEL); - if (!formats) - return -ENOMEM; - driver_data = (struct gsc_driverdata *)of_device_get_match_data(dev); ctx->dev = dev; ctx->num_clocks = driver_data->num_clocks; ctx->clk_names = driver_data->clk_names; + /* construct formats/limits array */ + num_formats = ARRAY_SIZE(gsc_formats) + ARRAY_SIZE(gsc_tiled_formats); + formats = devm_kcalloc(dev, num_formats, sizeof(*formats), GFP_KERNEL); + if (!formats) + return -ENOMEM; + + /* linear formats */ for (i = 0; i < ARRAY_SIZE(gsc_formats); i++) { formats[i].fourcc = gsc_formats[i]; formats[i].type = DRM_EXYNOS_IPP_FORMAT_SOURCE | @@ -1231,8 +1242,19 @@ static int gsc_probe(struct platform_device *pdev) formats[i].limits = driver_data->limits; formats[i].num_limits = driver_data->num_limits; } + + /* tiled formats */ + for (j = i, i = 0; i < ARRAY_SIZE(gsc_tiled_formats); j++, i++) { + formats[j].fourcc = gsc_tiled_formats[i]; + formats[j].modifier = DRM_FORMAT_MOD_SAMSUNG_16_16_TILE; + formats[j].type = DRM_EXYNOS_IPP_FORMAT_SOURCE | + DRM_EXYNOS_IPP_FORMAT_DESTINATION; + formats[j].limits = driver_data->limits; + formats[j].num_limits = driver_data->num_limits; + } + ctx->formats = formats; - ctx->num_formats = ARRAY_SIZE(gsc_formats); + ctx->num_formats = num_formats; /* clock control */ for (i = 0; i < ctx->num_clocks; i++) {