From patchwork Fri Dec 7 10:01:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10717801 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 88C8B417B for ; Fri, 7 Dec 2018 10:02:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 775802DEA7 for ; Fri, 7 Dec 2018 10:02:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BCE82E151; Fri, 7 Dec 2018 10:02:04 +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 2967C2DEA7 for ; Fri, 7 Dec 2018 10:02:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726030AbeLGKCB (ORCPT ); Fri, 7 Dec 2018 05:02:01 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:43442 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbeLGKCB (ORCPT ); Fri, 7 Dec 2018 05:02:01 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181207100158euoutp02500af3845fda6a410c6864ff4bf77cb1~uBLns8-hI3061430614euoutp02L; Fri, 7 Dec 2018 10:01:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181207100158euoutp02500af3845fda6a410c6864ff4bf77cb1~uBLns8-hI3061430614euoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544176918; bh=dORSJ0heDv5reF7Nx27nnHw2HT7cw9u7gcc7hN3ly1g=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=k1DuwbpH0Wq6KmKNwqnw7vnyUkM+NA9aIq2fdfRktp5gK/hmY9fvXZMT3+anqP9bG BKwSjvMfFCbAYHKqNMO79G7Qw8odxo6hOoDAEVzXssDerHR51B9+FI+HeXYayvgSRf 5r6GRskc2FKCF7Ly79V0Rpq7M54cUM47sPcXNfvE= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181207100158eucas1p1a939e928cf78ee059a608ff3dc1a09fb~uBLnMrjp_0856608566eucas1p15; Fri, 7 Dec 2018 10:01:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 48.F2.04294.5154A0C5; Fri, 7 Dec 2018 10:01:57 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181207100157eucas1p25b30167172753f14d0128b0a70e3483e~uBLmT_18S2774027740eucas1p2_; Fri, 7 Dec 2018 10:01:57 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-14-5c0a451566c3 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 9B.09.04128.5154A0C5; Fri, 7 Dec 2018 10:01:57 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PJD006FP2J86Y70@eusync1.samsung.com>; Fri, 07 Dec 2018 10:01:57 +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 REBASED 1/3] drm/exynos/decon5433: add dynamic zpos support Date: Fri, 07 Dec 2018 11:01:50 +0100 Message-id: <20181207100152.30028-2-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181207100152.30028-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRmVeSWpSXmKPExsWy7djP87qirlwxBjs3WVrcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw Zfx8/YK54JxsRcdU7gbGJskuRk4OCQETiS/tE9m7GLk4hARWMEpsWvSdDcL5zCixu7ubGaZq Sut+JojEMkaJLbtuQrX8Z5Q4ceMBK0gVm4CmxN/NN9lAbBEBZYlV+9rBipgFLjFKvD7ZzQiS EBbwlngyeRELiM0ioCrx9dFysDivgIXE5N09LBDr5CVWbzgAtppTwFJi+/qrYDdJCLxllXi1 ax07RJGLxNXWpWwQtrDEq+NboOIyEpcnd0MNqpdomnmFGaK5A+jUxcuhGqwlDh+/CHY2swCf xKRt04GKOIDivBIdbUIQJR4SSzZtgAZGD6PEwrMfmScwSi5gZFjFKJ5aWpybnlpslJdarlec mFtcmpeul5yfu4kRGGWn/x3/soNx15+kQ4wCHIxKPLwVDpwxQqyJZcWVuYcYJTiYlUR4lWy5 YoR4UxIrq1KL8uOLSnNSiw8xSnOwKInzVjM8iBYSSE8sSc1OTS1ILYLJMnFwSjUwCm2qbsh7 n5Zw/p5M8t3azb9+OwklHbvWGlnwdd3MtM6l0neW7pY/b3tO4ljOh6YZ31++OmZXLK0rsiy4 VO+tyRWVuaklDUKNEv5K67o+vp5l/3933+zW7Yv3CJ1yyf6y/+IyjadTw/ZdXC9zQWLLoZXr bT42r1h6YZmx7cwVErvXFhjyvGx5lqXEUpyRaKjFXFScCAAfsuaWrgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBJMWRmVeSWpSXmKPExsVy+t/xy7qirlwxBn/O8FrcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw Zfx8/YK54JxsRcdU7gbGJskuRk4OCQETiSmt+5m6GLk4hASWMEo82f4Iymlkkuh+eZQFpIpN QFPi7+abbCC2iICyxKp97ewgRcwCVxgl2r91sYMkhAW8JZ5MXgTWwCKgKvH10XJGEJtXwEJi 8u4eFoh18hKrNxxgBrE5BSwltq+/CjZUCKhm+efNLBMYeRYwMqxiFEktLc5Nzy020itOzC0u zUvXS87P3cQIDI9tx35u2cHY9S74EKMAB6MSD2+FA2eMEGtiWXFl7iFGCQ5mJRFeJVuuGCHe lMTKqtSi/Pii0pzU4kOM0hwsSuK85w0qo4QE0hNLUrNTUwtSi2CyTBycUg2Mm9wjo7gfPBf9 +GjfFb4bpQJflqROz5za8ORKVf6pf9ZRW/kz7Xw2cfU7hTJuaCtw/Dt5Q+objnslzzjrjVWv puzIE0/+ucPZhfnu7elZbFe3c7guPjmx/ZBBKrfoTIv/VbU5bfVcFistRdoWlzySiZmT0ZF1 Z1/tws1ntnw6X8PkG7JH5U+OEktxRqKhFnNRcSIAZKtkxwsCAAA= X-CMS-MailID: 20181207100157eucas1p25b30167172753f14d0128b0a70e3483e X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181207100157eucas1p25b30167172753f14d0128b0a70e3483e References: <20181207100152.30028-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. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 5b4e0e8b23bc..e0fda6da2ccb 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) { @@ -402,7 +394,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); @@ -452,19 +444,18 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, 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 +529,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 +598,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 +618,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 Fri Dec 7 10:01:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10717797 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 3AA0013AF for ; Fri, 7 Dec 2018 10:02:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AB7E2E151 for ; Fri, 7 Dec 2018 10:02:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E8642E530; Fri, 7 Dec 2018 10:02:04 +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 0971E2E151 for ; Fri, 7 Dec 2018 10:02:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726019AbeLGKCC (ORCPT ); Fri, 7 Dec 2018 05:02:02 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38902 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbeLGKCB (ORCPT ); Fri, 7 Dec 2018 05:02:01 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181207100158euoutp0183267180263da3f71500f302a60552f0~uBLnyekBh0704707047euoutp01b; Fri, 7 Dec 2018 10:01:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181207100158euoutp0183267180263da3f71500f302a60552f0~uBLnyekBh0704707047euoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544176918; bh=v4/A+YDFk05Q/Oi8KgB9+oXeLa4gCk51G4MXB0nOm0w=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=jJAvXAbfdfzv0BDQTGAu5319MsWI7mgeSzvpPqxB0vjzijDlJOtrf4grL50tOT0zD K++IYLdBl8yy+kP8bMW14q6fFZ0svXQWjtWEtI4bOuWFAwwXehX3Mg1ToUZTlXEuuT rdjO09lMrHaq/KuuubtSW5ZhKOT+BNOJQsPV6u+k= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181207100158eucas1p21464fb1a09ffe6a89aa8dcd55f98a903~uBLnRDU-g2782327823eucas1p2C; Fri, 7 Dec 2018 10:01:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 80.19.04441.6154A0C5; Fri, 7 Dec 2018 10:01:58 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181207100157eucas1p2a7ab15738d7d436ced74cc487dc24c21~uBLmmCqCN2771227712eucas1p2q; Fri, 7 Dec 2018 10:01:57 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-1c-5c0a4516d49b Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 2C.09.04128.5154A0C5; Fri, 7 Dec 2018 10:01:57 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PJD006FP2J86Y70@eusync1.samsung.com>; Fri, 07 Dec 2018 10:01:57 +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 REBASED 2/3] drm/exynos/fimd: create local helper for disabling hardware window Date: Fri, 07 Dec 2018 11:01:51 +0100 Message-id: <20181207100152.30028-3-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181207100152.30028-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJIsWRmVeSWpSXmKPExsWy7djP87pirlwxBq9+slrcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw Zey7PI+xYJNgRc/uC2wNjFv5uhg5OSQETCReLLrA1sXIxSEksIJR4tuliewgCSGBz4wSz+/Z wBS9n3GJGaJoGaPEs08vWCGc/4wSJ248YAWpYhPQlPi7+SYbiC0ioCyxal87O0gRs8AlRonX J7sZuxg5OIQFEiU6HrqD1LAIqEqsPHCfBcTmFbCQ+DLzJQvENnmJ1RsOMIPYnAKWEtvXXwU7 T0LgLavEorb1TCBzJARcJC4/SYeoF5Z4dXwLO4QtI3F5cjfUnHqJpplXmCF6O4AOXbycDSJh LXH4+EWwo5kF+CQmbZvODDGTV6KjTQiixEPi4rEJ0GDpYZT49OcE2wRGyQWMDKsYxVNLi3PT U4sN81LL9YoTc4tL89L1kvNzNzECI+z0v+OfdjB+vZR0iFGAg1GJh7fCgTNGiDWxrLgy9xCj BAezkgivki1XjBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHeaoYH0UIC6YklqdmpqQWpRTBZJg5O qQbGfUVXX9s4RPgWR5bJOq8/ul7yZORbA79olgmeuxd4Fy3ebbZVdocEw9otVquPCjentMTY rNNZzSgsy2gknvzQJ6v1VnryO03RRUdcU35snKjWvvg307wnn3+lvly0ZvXydT8yY44wXrRj +iD5dGbgnyuCq45y+p85tPrQfvXHSVt+JjGa6fZGK7EUZyQaajEXFScCANl8d8WsAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBJMWRmVeSWpSXmKPExsVy+t/xy7qirlwxBgtWK1vcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw Zey7PI+xYJNgRc/uC2wNjFv5uhg5OSQETCTez7jEDGILCSxhlPjw07+LkQvIbmSS6H55lAUk wSagKfF38002EFtEQFli1b52dpAiZoErjBLt37rYQRLCAokSu8//BmtgEVCVWHngPpjNK2Ah 8WXmSxaIbfISqzccANvGKWApsX39VTaIzRYSyz9vZpnAyLOAkWEVo0hqaXFuem6xkV5xYm5x aV66XnJ+7iZGYHhsO/Zzyw7GrnfBhxgFOBiVeHgrHDhjhFgTy4orcw8xSnAwK4nwKtlyxQjx piRWVqUW5ccXleakFh9ilOZgURLnPW9QGSUkkJ5YkpqdmlqQWgSTZeLglGpgZPxcxmb5uVV+ +9s5rSusY3PeX1AJVLpx2kzYlX89E9+9hB+dByqYnvmwRE+8cEdsysKYDeq75nW8FZlQqcPO 6Kd6+XJzZM0PjbLFSxOdO7c/vthrvnZBy46cn1c8vpUdfvhwSXtDyd9LmcclVHj+RzbllHJ3 PU1aN2N/1ZLqSttXP+cYhDO8U2Ipzkg01GIuKk4EAI+j+1ALAgAA X-CMS-MailID: 20181207100157eucas1p2a7ab15738d7d436ced74cc487dc24c21 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181207100157eucas1p2a7ab15738d7d436ced74cc487dc24c21 References: <20181207100152.30028-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 Fri Dec 7 10:01:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10717805 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 CC5AC13BF for ; Fri, 7 Dec 2018 10:02:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B98032DEBF for ; Fri, 7 Dec 2018 10:02:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADCE82E151; Fri, 7 Dec 2018 10:02:05 +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 49D3D2DEC4 for ; Fri, 7 Dec 2018 10:02:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726050AbeLGKCC (ORCPT ); Fri, 7 Dec 2018 05:02:02 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38907 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbeLGKCB (ORCPT ); Fri, 7 Dec 2018 05:02:01 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181207100159euoutp01a143d5becb4419ec5cc59952b50eb774~uBLn7RQl10694506945euoutp013; Fri, 7 Dec 2018 10:01:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181207100159euoutp01a143d5becb4419ec5cc59952b50eb774~uBLn7RQl10694506945euoutp013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544176919; bh=XW1vqhIllPtPZrMBxXq9ADNpuIZejpGxDLoosPsCmz0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=DtajXdBJWHUTnbTbN2IGcQkp2+wycB3SbjBTCN+FTToVcbsyJBbp/EydLwadnn3xe vWCyp2fbPFQ9DiDqohnH7I4LoGn5C1bVxv9+LvqWEEoBZB1ta2gw0SMMQD/t1M/GF2 10qXIP91+U3p1bnbD4WbsPqVEmi2o9TaX6gbrIaA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181207100158eucas1p1e204c1d91703cc5c2c5a9fd225f8215d~uBLng3iJM2226222262eucas1p1A; Fri, 7 Dec 2018 10:01:58 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id F0.19.04441.6154A0C5; Fri, 7 Dec 2018 10:01:58 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181207100157eucas1p150fec40afefbe9f5f1f5c676b5e09d54~uBLm5wWHk0854808548eucas1p1n; Fri, 7 Dec 2018 10:01:57 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-1d-5c0a45166c0c Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 99.A3.04284.5154A0C5; Fri, 7 Dec 2018 10:01:57 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PJD006FP2J86Y70@eusync1.samsung.com>; Fri, 07 Dec 2018 10:01:57 +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 REBASED 3/3] drm/exynos/fimd: add dynamic zpos support Date: Fri, 07 Dec 2018 11:01:52 +0100 Message-id: <20181207100152.30028-4-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181207100152.30028-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRmVeSWpSXmKPExsWy7djPc7pirlwxBt96xS1urTvHarFxxnpW iytf37NZTLo/gcVixvl9TBZrj9xld2DzuN99nMmjb8sqRo/Pm+QCmKO4bFJSczLLUov07RK4 Mras38dWcEyyYsLN+gbGZaJdjJwcEgImEjvefWDpYuTiEBJYwSjRe30+M4TzmVFi8dnT7DBV X753MkEkljFKfNzfAOX8Z5Q4ceMBK0gVm4CmxN/NN9lAbBEBZYlV+9rZQYqYBS4xSrw+2c0I khAWcJNYd7MTzGYRUJU43dfEBGLzClhI/Lt4hxFinbzE6g0HmEFsTgFLie3rr7KBDJIQ+Mgq cX/7EmaIIheJ7safTBC2sMSr41ugbpWR6Ow4CBWvl2iaeYUZorkD6NTFy9kgEtYSh49fBDub WYBPYtK26UBFHEBxXomONiGIEg+JbZvWsEG82cMocXrLVLYJjJILGBlWMYqnlhbnpqcWG+al lusVJ+YWl+al6yXn525iBEbZ6X/HP+1g/Hop6RCjAAejEg9vhQNnjBBrYllxZe4hRgkOZiUR XiVbrhgh3pTEyqrUovz4otKc1OJDjNIcLErivNUMD6KFBNITS1KzU1MLUotgskwcnFINjEK1 eVnpJwy123aK/w4zlk+YW8wsdaVSWyPscaWVt2jpLE1T//a82VMMlzRtrbr/sjvm3ZvFF5ZY 5s0O2/7rxmVvSyZFk9dvQjJmSS8O9/aTffnNJWOmxD+v6Rld9bIpk1xcW6OWK3i8PLW+6v6K 2wc4mKcamCldcH7XuvlY9rcPcbLLHILWK7EUZyQaajEXFScCAJJ3FD+uAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBJMWRmVeSWpSXmKPExsVy+t/xy7qirlwxBrf3mVvcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw ZWxZv4+t4JhkxYSb9Q2My0S7GDk5JARMJL5872TqYuTiEBJYwihxeskFZginkUmi++VRFpAq NgFNib+bb7KB2CICyhKr9rWzgxQxC1xhlGj/1sUOkhAWcJNYd7OTEcRmEVCVON3XxARi8wpY SPy7eIcRYp28xOoNB5hBbE4BS4nt66+CDRUCqln+eTPLBEaeBYwMqxhFUkuLc9Nziw31ihNz i0vz0vWS83M3MQLDY9uxn5t3MF7aGHyIUYCDUYmHt8KBM0aINbGsuDL3EKMEB7OSCK+SLVeM EG9KYmVValF+fFFpTmrxIUZpDhYlcd7zBpVRQgLpiSWp2ampBalFMFkmDk6pBka9jpPnppTq hTn+q/ghop28a9PBqqVZdx5NlIn1LGXbkKx7quv+OlYlvQ3nDr8s3LVlzfx3++R42gt+/7id E6G26PVPv2NMNlz5IXOPTWtRdV19YM6RFnnGnMX27H++y+1MnnXM+dBar9iGiXujDD+843Yz n+l8c0L9bcVDuZWbsgRbdm54YsunxFKckWioxVxUnAgArmIO6wsCAAA= X-CMS-MailID: 20181207100157eucas1p150fec40afefbe9f5f1f5c676b5e09d54 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181207100157eucas1p150fec40afefbe9f5f1f5c676b5e09d54 References: <20181207100152.30028-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. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 33 ++++++++---------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index a7993f5d8371..4d2bc32e26b6 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) { @@ -781,6 +773,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 +795,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]; @@ -879,17 +877,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 +995,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 +1048,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)