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: 143925 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3360544ljj; Fri, 10 Aug 2018 06:29:20 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzJccP7cGmHu8+8dB67P+tlY/CBSBNBI42teSqoX0DOWfhDCM55Cr6uFYovvbTwAxqcbCwq X-Received: by 2002:a17:902:342:: with SMTP id 60-v6mr6155937pld.15.1533907760134; Fri, 10 Aug 2018 06:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533907760; cv=none; d=google.com; s=arc-20160816; b=JrZmVoXaT6+b7EJ9MoCiqgY5IHJK31OoAeGgZYS/5TE9jDnet62Sef2AyOWJz6SntD c/5fAG6m3oibQBJ+OxdcK6neATgKwZRMfOSCIrn/447ryhyqTu8KfZyRlJIRZwHvIyvg xQizyDk6+r0zbxA2WXnFN14CDVCoWsE5rJcTBVBi21pYhjd+XCDmD3GdL7UF9QgnLfYg Zw7B0XbDpPjIEnR1P/iPixftuqIn9oBW5GB2gzMVWYiPiq+QhBHl53CQoJoOV95fmJhH Hml372WxxhNvLeAEpI0g7C70QWgNl6n68Ytm8FQP3oV7xvChPI1Bb1dEtmAAdaA4P2Rl HuHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id :in-reply-to:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=AYvc+NdNL6Ia3GjEn6O/qml54FDnLBp/Fuku8xBtmu8=; b=DkvLpgXCa9ydeD39htFkGJmGNqjOAqPGrXUR54ijZEAh1/WU17oLpjfqqmbEvz0rDL PQaQ+WZmqVT5MYkf0h4NnRBD25SjEOAVbPOwk6wcWgHrToOrlKFIwUhXqRHJTGuVeIcw Vo7PMKOTG5xzpFcbDriWYBuT3uo3qp6bz8ekVUyy5JjmXx8xQqmVikDZYAK49e3pwE0B lPTNpJzPhjgRMvGN5tjI5wvXrhLv4MwrJ3Y55h7da7PXoDwgagt9Bt9Pv0r0tLciDzj8 lEsugff7aGyZE+r1Y9gtk6mITMB2Cl4hv3c9nrX1Lmn/RiZ2Jn6AssPCBhBnva+Rdpxq WoVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ijnQgcDW; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e186-v6si10172744pfc.176.2018.08.10.06.29.19; Fri, 10 Aug 2018 06:29:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ijnQgcDW; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727563AbeHJP7O (ORCPT + 3 others); Fri, 10 Aug 2018 11:59:14 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:56348 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727864AbeHJP7N (ORCPT ); Fri, 10 Aug 2018 11:59:13 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180810132917euoutp0215a156ab913cade046461f214b2db06e~JiPqJQaqe1078710787euoutp02z for ; Fri, 10 Aug 2018 13:29:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180810132917euoutp0215a156ab913cade046461f214b2db06e~JiPqJQaqe1078710787euoutp02z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1533907757; bh=AYvc+NdNL6Ia3GjEn6O/qml54FDnLBp/Fuku8xBtmu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ijnQgcDWUCN2LVxxra/bkptJ9l3rrcg1zqx0ijdBJOptoAVVL8TmhkE+50faIqnWQ 1y0zRp+PUAGZEq7WPm6b/OiC/67D1TR3FkpHC0kLOPcX83WCoRJIwIlS+S+ABMVzuL CnAiLg5+ZeCTe/idhYJBH+vDLjq94T0bwHz4P1UE= 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 Cc: Marek Szyprowski , Inki Dae , Seung-Woo Kim , Bartlomiej Zolnierkiewicz , Andrzej Pietrasiewicz 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/ccCCaCJj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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> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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(-) -- 2.17.1 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++) {