From patchwork Mon Dec 10 11:18:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10721101 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 EA19013BF for ; Mon, 10 Dec 2018 11:18:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80ED629612 for ; Mon, 10 Dec 2018 11:18:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7532D29622; Mon, 10 Dec 2018 11:18:42 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 EB1382961E for ; Mon, 10 Dec 2018 11:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726942AbeLJLSl (ORCPT ); Mon, 10 Dec 2018 06:18:41 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:34139 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726888AbeLJLSl (ORCPT ); Mon, 10 Dec 2018 06:18:41 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181210111839euoutp02b11e0926efef7deb7605fddc2accc7a7~u9KbexxW32009220092euoutp02m; Mon, 10 Dec 2018 11:18:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181210111839euoutp02b11e0926efef7deb7605fddc2accc7a7~u9KbexxW32009220092euoutp02m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544440719; bh=NWcEDFeDfBh0C0lPPqXBteQagmavbb8Cz4clnV2XEk4=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=npQcnVRsqLn6rgqroGRpbTHx7u8RoVn0nqYqnmuvaJc1zZ/9hEhZIh7bNEjvrozjf LgpcWBjNJo5csbW4oys4TsfPbXlgqWG/HVUNrnX7G42+G3j1cJUJOHzccZAifWkUZj YsBW76qshQjCBZ+lOvsxZx3WaVuqB58b8OBIyv/I= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181210111839eucas1p292c4c9cafcdf31a948f72a28042c3b78~u9Ka3PvW31889518895eucas1p2U; Mon, 10 Dec 2018 11:18:39 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id B6.C0.04441.E8B4E0C5; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181210111838eucas1p2b9e8a1bddd7c01528d23a546bf36fe9f~u9KaHOOXF1960019600eucas1p2M; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) X-AuditID: cbfec7f2-a1ae89c000001159-b0-5c0e4b8efbc5 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AD.9E.04284.E8B4E0C5; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PJI001ZCQ31VQ20@eusync4.samsung.com>; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 1/3] drm/exynos/decon5433: add dynamic zpos support Date: Mon, 10 Dec 2018 12:18:32 +0100 Message-id: <20181210111834.17916-2-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181210111834.17916-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBIsWRmVeSWpSXmKPExsWy7djPc7p93nwxBj1LDS1urTvHarFxxnpW iytf37NZTLo/gcVixvl9TBZrj9xld2DzuN99nMmjb8sqRo/Pm+QCmKO4bFJSczLLUov07RK4 MlrPbmUtmKha0Xx2P3MD4wL5LkZODgkBE4nHN7pYuxi5OIQEVjBKfJ41kxHC+cwocbPpIiNM 1ZfP29khEssYJZZfuMncxcgB5PxnlOjMAqlhE9CU+Lv5JhuILSKgLLFqXztYPbPAJUaJ1ye7 wQYJC7hJ/Ly0mBnEZhFQldjwbj6YzStgITHpYScLxDJ5idUbDoDN5xSwlGh5nAcyR0LgJavE qqeNbBA1LhJ/n9xihrCFJV4d38IOYctIdHYcZIKw6yWaZl5hhmjuYJQ4sXg5VLO1xOHjF1lB bGYBPolJ26aDLZMQ4JXoaBOCMD0kmj7kQ/zbwyixed9N5gmMkgsYGVYxiqeWFuempxYb5qWW 6xUn5haX5qXrJefnbmIExtfpf8c/7WD8einpEKMAB6MSD29AE2+MEGtiWXFl7iFGCQ5mJRFe 3TSgEG9KYmVValF+fFFpTmrxIUZpDhYlcd5qhgfRQgLpiSWp2ampBalFMFkmDk6pBkYeRt8t f/c7eXn9ZJ+46zfD1K766rIl//+XB85eeD/ENn2RxWGnR1a3PnXPOmJUnjlT6mmodOyxzC1F 5x0mpRlN9Daa71xdam7OY1+7jrH6u3elWLhgWcdyw7mSB1ozWgRfuZSuE1m0Nu7CjoLHFzYv k+66Xt/8sC+iqG9Ge9Ia00MHy3Xk2pRYijMSDbWYi4oTAbL0NMWrAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOJMWRmVeSWpSXmKPExsVy+t/xa7p93nwxBt2r+S1urTvHarFxxnpW iytf37NZTLo/gcVixvl9TBZrj9xld2DzuN99nMmjb8sqRo/Pm+QCmKO4bFJSczLLUov07RK4 MlrPbmUtmKha0Xx2P3MD4wL5LkZODgkBE4kvn7ezdzFycQgJLGGUWHf5FSOE08gk8f3ILnaQ KjYBTYm/m2+ygdgiAsoSq/a1g3UwC1xhlGj/1gVWJCzgJvHz0mJmEJtFQFViw7v5YDavgIXE pIedLBDr5CVWbzgAFOfg4BSwlGh5nAdiCgGVTDuQO4GRZwEjwypGkdTS4tz03GJDveLE3OLS vHS95PzcTYzA4Nh27OfmHYyXNgYfYhTgYFTi4Q1o4o0RYk0sK67MPcQowcGsJMKrmwYU4k1J rKxKLcqPLyrNSS0+xCjNwaIkznveoDJKSCA9sSQ1OzW1ILUIJsvEwSnVwKj76Ng2bym2jzNq ZoqvfxeulSEcWexydfnfP9nahotLv6myvXo31dM8+YGBVbzSO4b8qPTOZrl817PFledfG576 //6bc1Iy217dbuH183zeWuofCjr1x/DQ59bwGWa5NskC4c1vTvw7OK/KUOvWrtkrTQ58qWFl OCrYtsp0RWtpQf8Vt3s6EkosxRmJhlrMRcWJAE0ukp8KAgAA X-CMS-MailID: 20181210111838eucas1p2b9e8a1bddd7c01528d23a546bf36fe9f X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181210111838eucas1p2b9e8a1bddd7c01528d23a546bf36fe9f References: <20181210111834.17916-1-a.hajda@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 DECON has fixed hardware window order. To implement dynamic zpos normalized_zpos of active plane has to be connected to window number, and remaining windows have to be disabled. v2: fixed pixel format setting Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 5b4e0e8b23bc..bdfec5f977e9 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -83,14 +83,6 @@ static const enum drm_plane_type decon_win_types[WINDOWS_NR] = { [CURSON_WIN] = DRM_PLANE_TYPE_CURSOR, }; -static const unsigned int capabilities[WINDOWS_NR] = { - 0, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, -}; - static inline void decon_set_bits(struct decon_context *ctx, u32 reg, u32 mask, u32 val) { @@ -314,12 +306,13 @@ static void decon_win_set_bldmod(struct decon_context *ctx, unsigned int win, } } -static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win, - struct drm_framebuffer *fb) +static void decon_win_set_pixfmt(struct decon_context *ctx, + struct exynos_drm_plane *plane) { - struct exynos_drm_plane plane = ctx->planes[win]; struct exynos_drm_plane_state *state = - to_exynos_plane_state(plane.base.state); + to_exynos_plane_state(plane->base.state); + unsigned int win = state->base.normalized_zpos + ctx->first_win; + struct drm_framebuffer *fb = state->base.fb; unsigned int alpha = state->base.alpha; unsigned int pixel_alpha; unsigned long val; @@ -402,7 +395,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, to_exynos_plane_state(plane->base.state); struct decon_context *ctx = crtc->ctx; struct drm_framebuffer *fb = state->base.fb; - unsigned int win = plane->index; + unsigned int win = state->base.normalized_zpos + ctx->first_win; unsigned int cpp = fb->format->cpp[0]; unsigned int pitch = fb->pitches[0]; dma_addr_t dma_addr = exynos_drm_fb_dma_addr(fb, 0); @@ -446,25 +439,24 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, | BIT_VAL(state->crtc.w * cpp, 14, 0); writel(val, ctx->addr + DECON_VIDW0xADD2(win)); - decon_win_set_pixfmt(ctx, win, fb); + decon_win_set_pixfmt(ctx, plane); /* window enable */ decon_set_bits(ctx, DECON_WINCONx(win), WINCONx_ENWIN_F, ~0); } -static void decon_disable_plane(struct exynos_drm_crtc *crtc, - struct exynos_drm_plane *plane) -{ - struct decon_context *ctx = crtc->ctx; - unsigned int win = plane->index; - - decon_set_bits(ctx, DECON_WINCONx(win), WINCONx_ENWIN_F, 0); -} - static void decon_atomic_flush(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = crtc->ctx; unsigned long flags; + int win = hweight32(crtc->base.state->plane_mask) + ctx->first_win; + + /* disable windows corresponding to disabled planes */ + for (; win < WINDOWS_NR; ++win) { + if (!readl(ctx->addr + DECON_WINCONx(win)) & WINCONx_ENWIN_F) + break; + decon_set_bits(ctx, DECON_WINCONx(win), WINCONx_ENWIN_F, 0); + } spin_lock_irqsave(&ctx->vblank_lock, flags); @@ -538,7 +530,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc) * a destroyed buffer later. */ for (i = ctx->first_win; i < WINDOWS_NR; i++) - decon_disable_plane(crtc, &ctx->planes[i]); + decon_set_bits(ctx, DECON_WINCONx(i), WINCONx_ENWIN_F, 0); decon_swreset(ctx); @@ -607,7 +599,6 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = { .disable_vblank = decon_disable_vblank, .atomic_begin = decon_atomic_begin, .update_plane = decon_update_plane, - .disable_plane = decon_disable_plane, .mode_valid = decon_mode_valid, .atomic_flush = decon_atomic_flush, }; @@ -628,7 +619,9 @@ static int decon_bind(struct device *dev, struct device *master, void *data) ctx->configs[win].num_pixel_formats = ARRAY_SIZE(decon_formats); ctx->configs[win].zpos = win - ctx->first_win; ctx->configs[win].type = decon_win_types[win]; - ctx->configs[win].capabilities = capabilities[win]; + ctx->configs[win].capabilities = EXYNOS_DRM_PLANE_CAP_ZPOS + | EXYNOS_DRM_PLANE_CAP_WIN_BLEND + | EXYNOS_DRM_PLANE_CAP_PIX_BLEND; ret = exynos_plane_init(drm_dev, &ctx->planes[win], win, &ctx->configs[win]); From patchwork Mon Dec 10 11:18:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10721099 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 EEA671751 for ; Mon, 10 Dec 2018 11:18:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEB0529612 for ; Mon, 10 Dec 2018 11:18:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2ADE29608; Mon, 10 Dec 2018 11:18:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 73FBF29612 for ; Mon, 10 Dec 2018 11:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726740AbeLJLSl (ORCPT ); Mon, 10 Dec 2018 06:18:41 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:37806 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726867AbeLJLSl (ORCPT ); Mon, 10 Dec 2018 06:18:41 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181210111839euoutp01af2f25a3a2d12feebdc5e203bb6fa6e6~u9KbnRPT33018530185euoutp01U; Mon, 10 Dec 2018 11:18:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181210111839euoutp01af2f25a3a2d12feebdc5e203bb6fa6e6~u9KbnRPT33018530185euoutp01U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544440719; bh=v4/A+YDFk05Q/Oi8KgB9+oXeLa4gCk51G4MXB0nOm0w=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=tNhxRVbv8xi+jduDc8pMPXVTZr2wacCgnmjXazAAFZuB2y1kUAxrPkXwWYCw94zNE CivTwInpGTtmtX7qEIaqOdse+l97i/MAixfAv6ifvyGnD3Wb6fUB7f9Y9/WCoxkwoc bxJJ0M4mvuGVXh7bV9g+ATrWW4Qy95LX0sBR5+ks= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181210111839eucas1p29ad18b143113d54b49e6546e6b0ed04a~u9KbIRnT40965409654eucas1p2o; Mon, 10 Dec 2018 11:18:39 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 52.4A.04806.F8B4E0C5; Mon, 10 Dec 2018 11:18:39 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181210111838eucas1p2eaf5aa4bfa73efa0b22a609aa0837ea2~u9KaZve7u0965309653eucas1p2m; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-91-5c0e4b8f8a4b Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 5E.9E.04284.E8B4E0C5; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PJI001ZCQ31VQ20@eusync4.samsung.com>; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 2/3] drm/exynos/fimd: create local helper for disabling hardware window Date: Mon, 10 Dec 2018 12:18:33 +0100 Message-id: <20181210111834.17916-3-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181210111834.17916-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBIsWRmVeSWpSXmKPExsWy7djP87r93nwxBo9aOCxurTvHarFxxnpW iytf37NZTLo/gcVixvl9TBZrj9xld2DzuN99nMmjb8sqRo/Pm+QCmKO4bFJSczLLUov07RK4 MvZdnsdYsEmwomf3BbYGxq18XYycHBICJhLn7z1g7GLk4hASWMEocfXkJSjnM6PEouU7mWCq 7p17ywaRWMYo8WPbNCCHA8j5zyjRmQVSwyagKfF38002EFtEQFli1b52dpB6ZoFLjBKvT3Yz gtQLC8RIfF7gCVLDIqAq8WfVc0YQm1fAQmLx2Q0sELvkJVZvOMAMUs4pYCnR8jgPZIyEwFtW iRkXTrJB1LhIvFx8jhXCFpZ4dXwLO4QtI9HZcRDq5nqJpplXmCGaOxglTixeDtVsLXH4+EWw ZmYBPolJ26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j26/TF64MMy7tuv1s9DCf4xKLMUZiYZazEXFiQBHt2WECQIAAA== X-CMS-MailID: 20181210111838eucas1p2eaf5aa4bfa73efa0b22a609aa0837ea2 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181210111838eucas1p2eaf5aa4bfa73efa0b22a609aa0837ea2 References: <20181210111834.17916-1-a.hajda@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 Hardware window disabling is performed in multiple places. Creating helper for it simplifies the code and prepares it for further improvements. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 786a8ee6f10f..a7993f5d8371 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -345,6 +345,14 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, writel(val, ctx->regs + SHADOWCON); } +static void fimd_disable_win(struct fimd_context *ctx, int win) +{ + fimd_enable_video_output(ctx, win, false); + + if (ctx->driver_data->has_shadowcon) + fimd_enable_shadow_channel_path(ctx, win, false); +} + static void fimd_clear_channels(struct exynos_drm_crtc *crtc) { struct fimd_context *ctx = crtc->ctx; @@ -363,12 +371,7 @@ static void fimd_clear_channels(struct exynos_drm_crtc *crtc) u32 val = readl(ctx->regs + WINCON(win)); if (val & WINCONx_ENWIN) { - fimd_enable_video_output(ctx, win, false); - - if (ctx->driver_data->has_shadowcon) - fimd_enable_shadow_channel_path(ctx, win, - false); - + fimd_disable_win(ctx, win); ch_enabled = 1; } } @@ -880,15 +883,11 @@ static void fimd_disable_plane(struct exynos_drm_crtc *crtc, struct exynos_drm_plane *plane) { struct fimd_context *ctx = crtc->ctx; - unsigned int win = plane->index; if (ctx->suspended) return; - fimd_enable_video_output(ctx, win, false); - - if (ctx->driver_data->has_shadowcon) - fimd_enable_shadow_channel_path(ctx, win, false); + fimd_disable_win(ctx, plane->index); } static void fimd_enable(struct exynos_drm_crtc *crtc) @@ -923,7 +922,7 @@ static void fimd_disable(struct exynos_drm_crtc *crtc) * a destroyed buffer later. */ for (i = 0; i < WINDOWS_NR; i++) - fimd_disable_plane(crtc, &ctx->planes[i]); + fimd_disable_win(ctx, i); fimd_enable_vblank(crtc); fimd_wait_for_vblank(crtc); From patchwork Mon Dec 10 11:18:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10721105 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 5DCF213BF for ; Mon, 10 Dec 2018 11:18:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 064E729608 for ; Mon, 10 Dec 2018 11:18:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE46629612; Mon, 10 Dec 2018 11:18:42 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 69D3229613 for ; Mon, 10 Dec 2018 11:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726888AbeLJLSm (ORCPT ); Mon, 10 Dec 2018 06:18:42 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:34144 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726867AbeLJLSl (ORCPT ); Mon, 10 Dec 2018 06:18:41 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181210111840euoutp02bc9df238633234d9d85fd2372f91eecc~u9KcXdEkI2009920099euoutp02o; Mon, 10 Dec 2018 11:18:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181210111840euoutp02bc9df238633234d9d85fd2372f91eecc~u9KcXdEkI2009920099euoutp02o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544440720; bh=Vl9xgLpo86jLpb+DQpAt0+Y5/RecNEwTSYKGxG7OmDs=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=EFp97jCuvHKddwgvBcrrqEivghTnWaBpHyhn8e8E25xRJ3s0QbvZnLqQ8FZynIHrF 8ns9kZWUJQo/ZRviMRKQxd67iBM/E4lo5wd/6Z7f9f7CfVdWTN/WOghr07pd4sWJ68 5szDTtd6Q4RcRLxhvel+k7Rz+Dub+OZ5vyPA/nPI= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181210111840eucas1p225e8da8c718ad0c0ba6ff87f823ea6d9~u9Kb3qkQc0965309653eucas1p2o; Mon, 10 Dec 2018 11:18:40 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 73.4A.04806.F8B4E0C5; Mon, 10 Dec 2018 11:18:39 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181210111838eucas1p2a75354aae1c2761777b71094b96273c3~u9KavXJyY0313803138eucas1p2W; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-94-5c0e4b8fef95 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EE.43.04128.E8B4E0C5; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PJI001ZCQ31VQ20@eusync4.samsung.com>; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 3/3] drm/exynos/fimd: add dynamic zpos support Date: Mon, 10 Dec 2018 12:18:34 +0100 Message-id: <20181210111834.17916-4-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181210111834.17916-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGIsWRmVeSWpSXmKPExsWy7djPc7r93nwxBuen6lncWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw ZRz+8pWp4J9KxcfzaxgbGB/JdTFyckgImEisaexmArGFBFYwSnxv0e9i5AKyPzNKrOrtY+xi 5AArmvDEF6JmGaPEoe9mIGEhgf+MEp1ZIGE2AU2Jv5tvsoHYIgLKEqv2tbODjGEWuMQo8fpk NyNIQljAUeL0lrdgNouAqsT7VxuZQWxeAQuJ5s1b2CDukZdYveEAM8h8TgFLiZbHeSBzJAQ+ skq8XfwZqsZFYsGvTUwQtrDEq+Nb2CFsGYnLk7tZIOx6iaaZV5ghmjsYJU4sXg7VbC1x+PhF VhCbWYB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6yvxHebz+UXnOFwS/DH8n1KLMUZiYZazEXFiQBsveQGCQIAAA== X-CMS-MailID: 20181210111838eucas1p2a75354aae1c2761777b71094b96273c3 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181210111838eucas1p2a75354aae1c2761777b71094b96273c3 References: <20181210111834.17916-1-a.hajda@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 FIMD has fixed hardware window order. To implement dynamic zpos normalized_zpos of active plane has to be connected to window number, and remaining windows have to be disabled. v2: fixed pixel format setting Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 46 ++++++++++-------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index a7993f5d8371..46588a14f0c3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -228,14 +228,6 @@ static const uint32_t fimd_formats[] = { DRM_FORMAT_ARGB8888, }; -static const unsigned int capabilities[WINDOWS_NR] = { - 0, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, -}; - static inline void fimd_set_bits(struct fimd_context *ctx, u32 reg, u32 mask, u32 val) { @@ -636,12 +628,13 @@ static void fimd_win_set_bldmod(struct fimd_context *ctx, unsigned int win, BLENDCON_NEW_8BIT_ALPHA_VALUE); } -static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win, - struct drm_framebuffer *fb, int width) +static void fimd_win_set_pixfmt(struct fimd_context *ctx, + struct exynos_drm_plane *plane) { - struct exynos_drm_plane plane = ctx->planes[win]; struct exynos_drm_plane_state *state = - to_exynos_plane_state(plane.base.state); + to_exynos_plane_state(plane->base.state); + unsigned int win = state->base.normalized_zpos; + struct drm_framebuffer *fb = state->base.fb; uint32_t pixel_format = fb->format->format; unsigned int alpha = state->base.alpha; u32 val = WINCONx_ENWIN; @@ -698,7 +691,7 @@ static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win, * still better to change dma-burst than displaying garbage. */ - if (width < MIN_FB_WIDTH_FOR_16WORD_BURST) { + if (state->src.w < MIN_FB_WIDTH_FOR_16WORD_BURST) { val &= ~WINCONx_BURSTLEN_MASK; val |= WINCONx_BURSTLEN_4WORD; } @@ -781,6 +774,12 @@ static void fimd_atomic_flush(struct exynos_drm_crtc *crtc) if (ctx->suspended) return; + for (i = hweight32(crtc->base.state->plane_mask); i < WINDOWS_NR; i++) { + if (!(readl(ctx->regs + WINCON(i)) & WINCONx_ENWIN)) + break; + fimd_disable_win(ctx, i); + } + for (i = 0; i < WINDOWS_NR; i++) fimd_shadow_protect_win(ctx, i, false); @@ -797,7 +796,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, dma_addr_t dma_addr; unsigned long val, size, offset; unsigned int last_x, last_y, buf_offsize, line_size; - unsigned int win = plane->index; + unsigned int win = state->base.normalized_zpos; unsigned int cpp = fb->format->cpp[0]; unsigned int pitch = fb->pitches[0]; @@ -864,7 +863,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); } - fimd_win_set_pixfmt(ctx, win, fb, state->src.w); + fimd_win_set_pixfmt(ctx, plane); /* hardware window 0 doesn't support color key. */ if (win != 0) @@ -879,17 +878,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, atomic_set(&ctx->win_updated, 1); } -static void fimd_disable_plane(struct exynos_drm_crtc *crtc, - struct exynos_drm_plane *plane) -{ - struct fimd_context *ctx = crtc->ctx; - - if (ctx->suspended) - return; - - fimd_disable_win(ctx, plane->index); -} - static void fimd_enable(struct exynos_drm_crtc *crtc) { struct fimd_context *ctx = crtc->ctx; @@ -1008,7 +996,6 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = { .disable_vblank = fimd_disable_vblank, .atomic_begin = fimd_atomic_begin, .update_plane = fimd_update_plane, - .disable_plane = fimd_disable_plane, .atomic_flush = fimd_atomic_flush, .atomic_check = fimd_atomic_check, .te_handler = fimd_te_handler, @@ -1062,7 +1049,10 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) ctx->configs[i].num_pixel_formats = ARRAY_SIZE(fimd_formats); ctx->configs[i].zpos = i; ctx->configs[i].type = fimd_win_types[i]; - ctx->configs[i].capabilities = capabilities[i]; + ctx->configs[i].capabilities = EXYNOS_DRM_PLANE_CAP_ZPOS + | EXYNOS_DRM_PLANE_CAP_WIN_BLEND + | EXYNOS_DRM_PLANE_CAP_PIX_BLEND; + ret = exynos_plane_init(drm_dev, &ctx->planes[i], i, &ctx->configs[i]); if (ret)