From patchwork Fri Aug 10 13:28:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10562711 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 B9D0D96FA for ; Fri, 10 Aug 2018 13:29:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8F5B2B67D for ; Fri, 10 Aug 2018 13:29:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D5182B67E; Fri, 10 Aug 2018 13:29:21 +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 0B5502B682 for ; Fri, 10 Aug 2018 13:29:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 181DA6E921; Fri, 10 Aug 2018 13:29:20 +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 A694A6E926 for ; Fri, 10 Aug 2018 13:29:18 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180810132916euoutp01d7770b0388ecaeed2d760f0c4fca775f~JiPpbohdM0607806078euoutp018 for ; Fri, 10 Aug 2018 13:29:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180810132916euoutp01d7770b0388ecaeed2d760f0c4fca775f~JiPpbohdM0607806078euoutp018 Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180810132916eucas1p1dcf64464796b978073ce36e16a3ab964~JiPpBdW6w2268722687eucas1p1e; Fri, 10 Aug 2018 13:29:16 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 5A.C2.04294.C239D6B5; Fri, 10 Aug 2018 14:29:16 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20180810132915eucas1p270d9df94b0aaaa17b0eddfb8682bd3bd~JiPoK4ppk2592125921eucas1p2z; Fri, 10 Aug 2018 13:29:15 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20180810132915eusmtrp1b6d473a4b2f38bf837ffa68c0eca6655~JiPn7Ecrb1157411574eusmtrp1w; Fri, 10 Aug 2018 13:29:15 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-7c-5b6d932ca03d Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D3.BA.04128.B239D6B5; Fri, 10 Aug 2018 14:29:15 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.116.147.25]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20180810132914eusmtip147b119c0345a0873c0226f10950f6e86~JiPngfwuM1796317963eusmtip1y; Fri, 10 Aug 2018 13:29:14 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 1/3] drm: drm_fourcc: add Samsung 16x16 tile format Date: Fri, 10 Aug 2018 15:28:59 +0200 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810132901.11844-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAIsWRmVeSWpSXmKPExsWy7djPc7o6k3OjDVac4rWY9bKdxWLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbjFj8ks2B3aP+93HmTz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoErY/p+1oJezopjM2azNzCeYu9i5OSQEDCR2PN3CVsXIxeHkMAKRolfew8xQjhfGCVu zXrNCuF8ZpR49XsDI0zLhe97oFqWM0pMa3wH5XxllFi14DozSBWbgKFE19suNhBbRMBNounw TLBRzAKPGSXW7t4Mtl1YwFni4dIpLCA2i4CqxJMlz6GukpdYveEA0CAODk4BO4l78zJAeiUE 7rNJ7P/zDuwMXoEyiRMn9jBB1LtIPJr8hgXCFpZ4dXwL1BwZidOTe1ggmpsZJdpnzGKHcHoY JbbO2cEGUWUtcfj4RVaQbcwCmhLrd+mDmBICjhLfJxdBmHwSN94KghQzA5mTtk1nhgjzSnS0 CUHMUJOYdXwd3NaDFy5BlXhIXGlxgATPREaJXVPbGScwys9CWLWAkXEVo3hqaXFuemqxUV5q uV5xYm5xaV66XnJ+7iZGYDo4/e/4lx2Mu/4kHWIU4GBU4uEVKM6JFmJNLCuuzD3EKMHBrCTC m2maGy3Em5JYWZValB9fVJqTWnyIUZqDRUmcl08rLVpIID2xJDU7NbUgtQgmy8TBKdXA2K+d YrV4ldcrh38ejiWu0wzUeLLkD7dyRDS4rLE+VtNxsizx9bLLurkbtHQCH3w3Tduad7LG0v+P zbVI54M/7gQ/9276Hqu09I1Kg3Pq0blCGUnnNCz+lkqwMC55bp/6u6AjsN1L3KM+PWchc7Tn wQs3mb9dO+Sk8mSRyLfSWVfu1Ta/d89TYinOSDTUYi4qTgQARjW6FwMDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t/xu7rak3OjDV5vE7SY9bKdxWLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbjFj8ks2B3aP+93HmTz6tqxi9Pi8SS6AOUrPpii/tCRV ISO/uMRWKdrQwkjP0NJCz8jEUs/Q2DzWyshUSd/OJiU1J7MstUjfLkEvY/p+1oJezopjM2az NzCeYu9i5OSQEDCRuPB9D1sXIxeHkMBSRolj52+zQSRkJE5Oa2CFsIUl/lzrgir6zCjxYdIj ZpAEm4ChRNfbLrAGEQEPieZvx9lBipgFnjJKfD34gwUkISzgLPFw6RQwm0VAVeLJkudARRwc vAK2Ep1TQiEWyEus3nCAGSTMKWAncW9eBkhYCKhiwt2DLBMY+RYwMqxiFEktLc5Nzy020itO zC0uzUvXS87P3cQIDM5tx35u2cHY9S74EKMAB6MSDy9Dak60EGtiWXFl7iFGCQ5mJRHeTNPc aCHelMTKqtSi/Pii0pzU4kOMpkAnTWSWEk3OB0ZOXkm8oamhuYWlobmxubGZhZI473mDyigh gfTEktTs1NSC1CKYPiYOTqkGxp328/4I5j/g2RB/8u372Cmnew2v83j2iaY1Sp6S8Cp1jXkU pfxh9mmxGnWbp33tCj89jnKfdZ61W+RyvZBv09KvEq889u+4rDR9a/CC/6zZWo8WLm3gv75g TvWbzAvPzleUy3PPXCZbrxKavEX9ZnHk/7zie7r9BwwLLr98m6W80MvR6OI6FSWW4oxEQy3m ouJEABKv/ExkAgAA Message-Id: <20180810132915eucas1p270d9df94b0aaaa17b0eddfb8682bd3bd~JiPoK4ppk2592125921eucas1p2z@eucas1p2.samsung.com> X-CMS-MailID: 20180810132915eucas1p270d9df94b0aaaa17b0eddfb8682bd3bd X-Msg-Generator: CA X-RootMTR: 20180810132915eucas1p270d9df94b0aaaa17b0eddfb8682bd3bd X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180810132915eucas1p270d9df94b0aaaa17b0eddfb8682bd3bd 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 From: Andrzej Pietrasiewicz Add modifier for tiled formats used by graphics modules found in Samsung Exynos5250/542x/5433 SoCs. This is a simple tiled layout using tiles of 16x16 pixels in a row-major layout. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Marek Szyprowski Reviewed-by: Inki Dae --- include/uapi/drm/drm_fourcc.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 721ab7e54d96..5631b196c07a 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -299,6 +299,15 @@ extern "C" { */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) +/* + * Tiled, 16 (pixels) x 16 (lines) - sized macroblocks + * + * This is a simple tiled layout using tiles of 16x16 pixels in a row-major + * layout. For YCbCr formats Cb/Cr components are taken in such a way that + * they correspond to their 16x16 luma block. + */ +#define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2) + /* * Qualcomm Compressed Format * From patchwork Fri Aug 10 13:29:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10562715 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 256511390 for ; Fri, 10 Aug 2018 13:29:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DF4A2B67D for ; Fri, 10 Aug 2018 13:29:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 017D82B684; Fri, 10 Aug 2018 13:29:27 +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 759682B67D for ; Fri, 10 Aug 2018 13:29:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 47AD96E932; Fri, 10 Aug 2018 13:29:26 +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 F28DA6E921 for ; Fri, 10 Aug 2018 13:29:18 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180810132917euoutp01538f9c2cf21b97c83b6c4e5eeb33d45c~JiPqTZZNF0621306213euoutp01p for ; Fri, 10 Aug 2018 13:29:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180810132917euoutp01538f9c2cf21b97c83b6c4e5eeb33d45c~JiPqTZZNF0621306213euoutp01p Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180810132916eucas1p2126b5d6050cc94a7838456ea1d6847b6~JiPpXXdkf2600526005eucas1p2Q; Fri, 10 Aug 2018 13:29:16 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id B8.B7.04806.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 20180810132915eucas1p18c60ec0bc72fb40b53d0f41a3d43c565~JiPohZpxV1504615046eucas1p1-; Fri, 10 Aug 2018 13:29:15 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20180810132915eusmtrp116f1a777b49a152169b269b050f27845~JiPoSEwuR1157411574eusmtrp1y; Fri, 10 Aug 2018 13:29:15 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-93-5b6d932c2c4e Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D5.BB.04284.B239D6B5; Fri, 10 Aug 2018 14:29:15 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.116.147.25]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20180810132915eusmtip15d12f1d7061856b1c70a55df5fc66c7e~JiPn5md6s1891018910eusmtip1a; 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 2/3] drm/exynos: scaler: Add support for tiled formats Date: Fri, 10 Aug 2018 15:29:00 +0200 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810132901.11844-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIIsWRmVeSWpSXmKPExsWy7djP87o6k3OjDSbMUraY9bKdxWLj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DzWyshUSd/OJiU1J7MstUjfLkEv49L+DqaCRdYV59rL Gxh7jLoYOTkkBEwk3nWtZQKxhQSWMkpcmpwAEZeRODmtgRXCFpb4c62LrYuRC6jmM6PEnoXz 2EASbAKGEl1vu8BsEQEPieZvx9lBipgFnjJKfD34gwUkISzgJjHzzHuwDSwCqhJbZ10Bm8or YCtx7+8BJogN8hKrNxxg7mLk4OAUsJO4Ny8D4iBbiQl3D7JMYORbwMiwilEktbQ4Nz232FCv ODG3uDQvXS85P3cTIzA4tx37uXkH46WNwYcYBTgYlXh4GVJzooVYE8uKK3MPMUpwMCuJ8Gaa 5kYL8aYkVlalFuXHF5XmpBYfYjQFumkis5Rocj4wcvJK4g1NDc0tLA3Njc2NzSyUxHnPG1RG CQmkJ5akZqemFqQWwfQxcXBKNTDmmkk/b2eY0pHSf+E733xGc79Hx6P1Pb+KnmqRePJnQnuH 7Ixz59iOpczkufv+lFOLl2x79Os/dYFaMcL7V9jmZEfp20nv3/VPyfnvv59bLx09+o7lo8Ej xs3TH86xX+P8SfmiIPdZnzm3pK1OZBw/YqlTPqN36WUO5gUGs00NHrxzcp/fsEhXiaU4I9FQ i7moOBEACXsdqmQCAAA= Message-Id: <20180810132915eucas1p18c60ec0bc72fb40b53d0f41a3d43c565~JiPohZpxV1504615046eucas1p1-@eucas1p1.samsung.com> X-CMS-MailID: 20180810132915eucas1p18c60ec0bc72fb40b53d0f41a3d43c565 X-Msg-Generator: CA X-RootMTR: 20180810132915eucas1p18c60ec0bc72fb40b53d0f41a3d43c565 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180810132915eucas1p18c60ec0bc72fb40b53d0f41a3d43c565 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 From: Andrzej Pietrasiewicz Add support for 16x16 tiled formats: NV12/NV21, YUYV and YUV420. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_scaler.c | 133 ++++++++++++--------- 1 file changed, 75 insertions(+), 58 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c index 0ddb6eec7b11..8e761ef63eac 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c +++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c @@ -49,56 +49,46 @@ struct scaler_context { const struct scaler_data *scaler_data; }; -static u32 scaler_get_format(u32 drm_fmt) +struct scaler_format { + u32 drm_fmt; + u32 internal_fmt; + u32 chroma_tile_w; + u32 chroma_tile_h; +}; + +static const struct scaler_format scaler_formats[] = { + { DRM_FORMAT_NV12, SCALER_YUV420_2P_UV, 8, 8 }, + { DRM_FORMAT_NV21, SCALER_YUV420_2P_VU, 8, 8 }, + { DRM_FORMAT_YUV420, SCALER_YUV420_3P, 8, 8 }, + { DRM_FORMAT_YUYV, SCALER_YUV422_1P_YUYV, 16, 16 }, + { DRM_FORMAT_UYVY, SCALER_YUV422_1P_UYVY, 16, 16 }, + { DRM_FORMAT_YVYU, SCALER_YUV422_1P_YVYU, 16, 16 }, + { DRM_FORMAT_NV16, SCALER_YUV422_2P_UV, 8, 16 }, + { DRM_FORMAT_NV61, SCALER_YUV422_2P_VU, 8, 16 }, + { DRM_FORMAT_YUV422, SCALER_YUV422_3P, 8, 16 }, + { DRM_FORMAT_NV24, SCALER_YUV444_2P_UV, 16, 16 }, + { DRM_FORMAT_NV42, SCALER_YUV444_2P_VU, 16, 16 }, + { DRM_FORMAT_YUV444, SCALER_YUV444_3P, 16, 16 }, + { DRM_FORMAT_RGB565, SCALER_RGB_565, 0, 0 }, + { DRM_FORMAT_XRGB1555, SCALER_ARGB1555, 0, 0 }, + { DRM_FORMAT_ARGB1555, SCALER_ARGB1555, 0, 0 }, + { DRM_FORMAT_XRGB4444, SCALER_ARGB4444, 0, 0 }, + { DRM_FORMAT_ARGB4444, SCALER_ARGB4444, 0, 0 }, + { DRM_FORMAT_XRGB8888, SCALER_ARGB8888, 0, 0 }, + { DRM_FORMAT_ARGB8888, SCALER_ARGB8888, 0, 0 }, + { DRM_FORMAT_RGBX8888, SCALER_RGBA8888, 0, 0 }, + { DRM_FORMAT_RGBA8888, SCALER_RGBA8888, 0, 0 }, +}; + +static const struct scaler_format *scaler_get_format(u32 drm_fmt) { - switch (drm_fmt) { - case DRM_FORMAT_NV12: - return SCALER_YUV420_2P_UV; - case DRM_FORMAT_NV21: - return SCALER_YUV420_2P_VU; - case DRM_FORMAT_YUV420: - return SCALER_YUV420_3P; - case DRM_FORMAT_YUYV: - return SCALER_YUV422_1P_YUYV; - case DRM_FORMAT_UYVY: - return SCALER_YUV422_1P_UYVY; - case DRM_FORMAT_YVYU: - return SCALER_YUV422_1P_YVYU; - case DRM_FORMAT_NV16: - return SCALER_YUV422_2P_UV; - case DRM_FORMAT_NV61: - return SCALER_YUV422_2P_VU; - case DRM_FORMAT_YUV422: - return SCALER_YUV422_3P; - case DRM_FORMAT_NV24: - return SCALER_YUV444_2P_UV; - case DRM_FORMAT_NV42: - return SCALER_YUV444_2P_VU; - case DRM_FORMAT_YUV444: - return SCALER_YUV444_3P; - case DRM_FORMAT_RGB565: - return SCALER_RGB_565; - case DRM_FORMAT_XRGB1555: - return SCALER_ARGB1555; - case DRM_FORMAT_ARGB1555: - return SCALER_ARGB1555; - case DRM_FORMAT_XRGB4444: - return SCALER_ARGB4444; - case DRM_FORMAT_ARGB4444: - return SCALER_ARGB4444; - case DRM_FORMAT_XRGB8888: - return SCALER_ARGB8888; - case DRM_FORMAT_ARGB8888: - return SCALER_ARGB8888; - case DRM_FORMAT_RGBX8888: - return SCALER_RGBA8888; - case DRM_FORMAT_RGBA8888: - return SCALER_RGBA8888; - default: - break; - } + int i; - return 0; + for (i = 0; i < ARRAY_SIZE(scaler_formats); i++) + if (scaler_formats[i].drm_fmt == drm_fmt) + return &scaler_formats[i]; + + return NULL; } static inline int scaler_reset(struct scaler_context *scaler) @@ -152,11 +142,11 @@ static inline void scaler_enable_int(struct scaler_context *scaler) } static inline void scaler_set_src_fmt(struct scaler_context *scaler, - u32 src_fmt) + u32 src_fmt, u32 tile) { u32 val; - val = SCALER_SRC_CFG_SET_COLOR_FORMAT(src_fmt); + val = SCALER_SRC_CFG_SET_COLOR_FORMAT(src_fmt) | (tile << 10); scaler_write(val, SCALER_SRC_CFG); } @@ -188,15 +178,19 @@ static inline void scaler_set_src_span(struct scaler_context *scaler, scaler_write(val, SCALER_SRC_SPAN); } -static inline void scaler_set_src_luma_pos(struct scaler_context *scaler, - struct drm_exynos_ipp_task_rect *src_pos) +static inline void scaler_set_src_luma_chroma_pos(struct scaler_context *scaler, + struct drm_exynos_ipp_task_rect *src_pos, const struct scaler_format *fmt) { u32 val; val = SCALER_SRC_Y_POS_SET_YH_POS(src_pos->x << 2); val |= SCALER_SRC_Y_POS_SET_YV_POS(src_pos->y << 2); scaler_write(val, SCALER_SRC_Y_POS); - scaler_write(val, SCALER_SRC_C_POS); /* ATTENTION! */ + val = SCALER_SRC_C_POS_SET_CH_POS( + (src_pos->x * fmt->chroma_tile_w / 16) << 2); + val |= SCALER_SRC_C_POS_SET_CV_POS( + (src_pos->y * fmt->chroma_tile_h / 16) << 2); + scaler_write(val, SCALER_SRC_C_POS); } static inline void scaler_set_src_wh(struct scaler_context *scaler, @@ -366,10 +360,10 @@ static int scaler_commit(struct exynos_drm_ipp *ipp, struct scaler_context *scaler = container_of(ipp, struct scaler_context, ipp); - u32 src_fmt = scaler_get_format(task->src.buf.fourcc); + const struct scaler_format *src_fmt = scaler_get_format(task->src.buf.fourcc); struct drm_exynos_ipp_task_rect *src_pos = &task->src.rect; - u32 dst_fmt = scaler_get_format(task->dst.buf.fourcc); + const struct scaler_format *dst_fmt = scaler_get_format(task->dst.buf.fourcc); struct drm_exynos_ipp_task_rect *dst_pos = &task->dst.rect; pm_runtime_get_sync(scaler->dev); @@ -380,13 +374,14 @@ static int scaler_commit(struct exynos_drm_ipp *ipp, scaler->task = task; - scaler_set_src_fmt(scaler, src_fmt); + scaler_set_src_fmt( + scaler, src_fmt->internal_fmt, task->src.buf.modifier != 0); scaler_set_src_base(scaler, &task->src); scaler_set_src_span(scaler, &task->src); - scaler_set_src_luma_pos(scaler, src_pos); + scaler_set_src_luma_chroma_pos(scaler, src_pos, src_fmt); scaler_set_src_wh(scaler, src_pos); - scaler_set_dst_fmt(scaler, dst_fmt); + scaler_set_dst_fmt(scaler, dst_fmt->internal_fmt); scaler_set_dst_base(scaler, &task->dst); scaler_set_dst_span(scaler, &task->dst); scaler_set_dst_luma_pos(scaler, dst_pos); @@ -617,6 +612,16 @@ static const struct drm_exynos_ipp_limit scaler_5420_one_pixel_limits[] = { .v = { 65536 * 1 / 4, 65536 * 16 }) }, }; +static const struct drm_exynos_ipp_limit scaler_5420_tile_limits[] = { + { IPP_SIZE_LIMIT(BUFFER, .h = { 16, SZ_8K }, .v = { 16, SZ_8K })}, + { IPP_SIZE_LIMIT(AREA, .h.align = 16, .v.align = 16) }, + { IPP_SCALE_LIMIT(.h = {1, 1}, .v = {1, 1})}, + { } +}; + +#define IPP_SRCDST_TILE_FORMAT(f, l) \ + IPP_SRCDST_MFORMAT(f, DRM_FORMAT_MOD_SAMSUNG_16_16_TILE, (l)) + static const struct exynos_drm_ipp_formats exynos5420_formats[] = { /* SCALER_YUV420_2P_UV */ { IPP_SRCDST_FORMAT(NV21, scaler_5420_two_pixel_hv_limits) }, @@ -680,6 +685,18 @@ static const struct exynos_drm_ipp_formats exynos5420_formats[] = { /* SCALER_RGBA8888 */ { IPP_SRCDST_FORMAT(RGBA8888, scaler_5420_one_pixel_limits) }, + + /* SCALER_YUV420_2P_UV TILE */ + { IPP_SRCDST_TILE_FORMAT(NV21, scaler_5420_tile_limits) }, + + /* SCALER_YUV420_2P_VU TILE */ + { IPP_SRCDST_TILE_FORMAT(NV12, scaler_5420_tile_limits) }, + + /* SCALER_YUV420_3P TILE */ + { IPP_SRCDST_TILE_FORMAT(YUV420, scaler_5420_tile_limits) }, + + /* SCALER_YUV422_1P_YUYV TILE */ + { IPP_SRCDST_TILE_FORMAT(YUYV, scaler_5420_tile_limits) }, }; static const struct scaler_data exynos5420_data = { 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+pN0iFGAg1GJh1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ij9RXDYqeF7d7sNKLMUZiYZa 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++) {